Skip to content

Conversation

@sebastianlay
Copy link
Contributor

@sebastianlay sebastianlay commented Aug 2, 2025

This is an idea on how to solve the issue of unreadable tooltips (#422) by replacing them with nicer popovers.
I wasn't sure how to add the required padding without affecting the already existing popover for the menu and so I added a custom CSS class. This could probably be solved more elegantly.

Fixes #422
Fixes #324
Fixes #29
Closes #206

@sebastianlay sebastianlay force-pushed the fix-tooltip branch 2 times, most recently from 9d94242 to 73ea874 Compare August 3, 2025 10:19
Copy link
Member

@lenemter lenemter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! This looks very promising! Thanks for taking this on :) I left some comments on the code. Also I think we should copy the tooltip style from the stylesheet. If you need any help on this, I'll be happy to help

@sebastianlay
Copy link
Contributor Author

Thanks for the feedback! I created another commit with the suggested changes. As for the styles I tried to compile the styles from https://github.com/elementary/stylesheet and copy the resulting CSS. However, I was not able to make it match the appearance of the tooltips. Is there any way to open the GTK inspector for the dock to investigate this further?

@lenemter
Copy link
Member

lenemter commented Aug 4, 2025

Unfortunately there's no way to open Gtk inspector because the dock has no focus, so using shortcut doesn't work, and setting GDK_DEBUG=interactive doesn't work either (at least from my experience) because of how the dock is being launched in OS 8.

You can find the source scss here and read more about popover css nodes here

@danirabbit
Copy link
Member

I haven't checked out this branch yet, but I looked at this a while ago and as far as styles, you can use set_css_name to style the popover as a tooltip: https://github.com/elementary/dock/pull/206/files

@sebastianlay
Copy link
Contributor Author

Cool, using the set_css_name works nicely and I also like the immediate tooltip more than the delayed one. I have done the changes and squashed everything into one commit.

There is still one issue, which I am unable to solve: the tooltip styling is not applied to the popover of the 'multitasking view' launcher. The popover is shown and hidden as expected, it just has the default popover styling and I don't know why. I have seen the following error in the logs, which was already present before my changes, but I am unsure if this is related or not: g_object_ref: assertion 'G_IS_OBJECT (object)' failed.

@lenemter
Copy link
Member

lenemter commented Aug 6, 2025

The issue is that set_css_name is a class method. It's not meant to be used by widget users, but rather by widget implementations. I pushed the fix here: #443. After you incorporate these changes into your branch I'll be happy to merge this :)

@danirabbit
Copy link
Member

@lenemter did you test this for both X and Wayland? I had problems with this solution previously. Haven't had time to pull this branch yet but just wanna make sure it's tested on both before being merged

@sebastianlay
Copy link
Contributor Author

@lenemter, I have integrated your changes and rebased the branch once more. Thanks for your patience!

I only tested this PR under X as the dock doesn't start for me at all under Wayland.
I get the following errors in the syslog:

gala[4323]: WL: error in client communication (pid 4323)
io.elementary.d[5954]: Error 22 (Invalid argument) dispatching to Wayland display.

and the following error when running the app directly with debug messages enabled:

wl_display@1: error 1: invalid method 5, object io_elementary_pantheon_panel_v1@49

But these errors are likely unrelated to this PR as they also occur when running the code of the current main branch.

@lenemter
Copy link
Member

lenemter commented Aug 6, 2025

@sebastianlay On wayland the dock requires development version of gala

@sebastianlay
Copy link
Contributor Author

@lenemter, nice, building gala from source did the trick for me. And I can confirm that this PR also works in a 'Secure Session' now. I have also removed the reference to the motion_controller as suggested.

@danirabbit, I had the same issue with the leave event being triggered immediately under X and I solved it by setting autohide = false on the popover. It seems that otherwise the popover would get the focus immediately after opening, which somehow triggered the leave event?

@lenemter lenemter merged commit e3e6dc9 into elementary:main Aug 8, 2025
4 checks passed
@sebastianlay sebastianlay deleted the fix-tooltip branch August 9, 2025 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dock item tooltips appear behind the dock Show tooltips on top of the dock Show ToolTips instantly

3 participants