micheleg / dash-to-dock

A dock for the Gnome Shell. This extension moves the dash out of the overview transforming it in a dock for an easier launching of applications and a faster switching between windows and desktops.
https://micheleg.github.io/dash-to-dock/
GNU General Public License v2.0
3.87k stars 460 forks source link

intellihide: enable/disable unredirect when dock shows/hides #2149

Closed taoky closed 5 months ago

taoky commented 7 months ago

This PR tries to workaround #1381 by explicitly disabling unredirection when dock shows (_animateIn), and restoring (_animateOut) when it hides in intellihide mode.

Although there have been extensions disabling unredirection when they are enabled to workaround the glitch, users might still find their dock flickering after:

(This looks like a bug in gnome-shell, but I could not find a reliable way to trigger this.)

In mutter (src/compositor/compositor.c), {disable,enable}_unredirect_for_display controls the counter disable_unredirect_count, and it is used to control whether the compositor is "unredirect inhibited" or not. A similar counter is used here, and is intended to avoid unexpected unredirect enablement. Also note that it is impossible for extensions to know whether unredirection is disabled or not, as this counter is private.

I was worrying about manually disabling/enabling unredirection might affect performance before, but it looks like Meta.{disable,enable}_unredirect_for_display is also used for many components in gnome-shell JavaScript code, so this might not be an issue.

I have tested this for ~2 weeks on my laptop (with no other extensions controlling unredirection) and it works without glitches. This might still need more tests, and the code in patch might not be optimal.