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.89k stars 460 forks source link

Shaking animation never stops #1568

Closed BlueManCZ closed 2 years ago

BlueManCZ commented 3 years ago

Whenever an application window is opened without the user clicking on the dock icon or the notification is received, the icon starts shaking. There is nothing wrong with that. But it never stops doing that. Whenever I click on the icon to focus the window, minimize, click again, etc, the icon is still shaking. I have to close the application and open it again to stop the shaking animation.

Version 71, GNOME 40.4.0

https://user-images.githubusercontent.com/17854950/139556297-610ea889-b31c-441d-8e46-d43c838c38e3.mp4

3v1n0 commented 3 years ago

You should ensure that all the windows that are requiring attention are focused, or shaking will continue.

What app is causing that, though? Any reproducer?

BlackDex commented 3 years ago

Same happens here. For me it is Firefox. I'm not sure on how to see why it is shaking, is there some cli tool or dbus thingy to check?

BlueManCZ commented 3 years ago

It was Firefox for me as well, but I remember I encountered the same problem with Telegram and Geary in the past. I don't know how to reproduce it. It just happens sometimes and it's hard to say why.

inthreedee commented 2 years ago

I've had this happen with multiple applications, but Firefox is the easiest to reproduce. @3v1n0 I can reliably reproduce it with these steps:

  1. Launch Firefox
  2. Minimize Firefox to the dock
  3. Click a link in, for example, a chat window
  4. Firefox should automatically restore its window and open the link in a new tab. The dock icon will be wobbling.
  5. Unfocus/focus/minimize/restore Firefox at this point has no effect on the wobbling.
  6. Additionally, I have my dock configured to minimize/restore a window when I click its icon. This function no longer works.
  7. To fix it, right click the Firefox icon in the dock and select "New Window". The wobbling stops and the click-to-minimize function now works again.

Step 2 is critical. I can't reproduce it unless Firefox is minimized.

BlueManCZ commented 2 years ago

I can confirm what @inthreedee says. Clicking a link and opening it in Firefox (for me no matter if minimized or not) starts the dancing animation. And there are two cases:

  1. If Firefox was minimized, the opening of a new window is enough to stop dancing animation.
  2. If Firefox was not minimized, you have to close the new window in addition for the animation to stop.
inthreedee commented 2 years ago

@BlueManCZ It sounds like you have Firefox configured to open links in a new window?

By compaison, I have mine configured to open links in a new tab in the existing window. This could explain the slightly different behavior we're seeing.

BlueManCZ commented 2 years ago

No no, mine Firefox opens links in new tabs as well. The clicking on the link can be replaced with

firefox --new-tab https://ddg.gg

command or

xdg-open https://ddg.gg

if you have Firefox as the default browser. Result is the same.

markuspfeiffer commented 2 years ago

I can also reproduce it with Firefox like this:

Workaround

wallon-ines commented 2 years ago

Same problem with Firefox and Evolution mail on Fedora 34 with enabled extensions :

tray-icons@zhangkaizhao.com
audio-switcher@albertomosconi
just-perfection-desktop@just-perfection
weatherintheclock@JasonLG1979.github.io
gitlab-extension@infinicode.de
dash-to-dock@micxgx.gmail.com
system-monitor@paradoxxx.zero.gmail.com
argos@pew.worldwidemann.com
user-theme@gnome-shell-extensions.gcampax.github.com
linuxiorr commented 2 years ago

Is there a way to disable the shaking behaviour? I find no use for it, the only thing it's doing for me is just being an unwelcome distraction.

I would love to be able to disable it.

BlueManCZ commented 2 years ago

@linuxiorr Removing or commenting out these two lines in the code should do the trick I guess:

https://github.com/micheleg/dash-to-dock/blob/55e9f07766183ad19668763ce60a8d77eb2ea2a0/appIcons.js#L156

https://github.com/micheleg/dash-to-dock/blob/55e9f07766183ad19668763ce60a8d77eb2ea2a0/appIcons.js#L163

inthreedee commented 2 years ago

Removing or commenting out these two lines in the code should do the trick I guess:

While this does stop the shaking animation, this bug is more than just a cosmetic issue. If you have the click to minimize window feature enabled, that click action stops working when this bug is triggered.

I've tried commenting out the entire notify::urgent block as well, but it still happens.

inthreedee commented 2 years ago

Some investigation: This line is why the click to minimize feature fails to work: https://github.com/micheleg/dash-to-dock/blob/39e5597da42124a23d3f0d5dbca69fea1f3fa96b/appIcons.js#L483-L484

The hasUrgentWindows flag is failing to be properly cleared when an app is brought to the foreground in this way (ie, clicking a link somewhere else that launches Firefox). This is also why the animation is never cleared. Still trying to figure out if this is a bug here or upstream.

inthreedee commented 2 years ago

I have found one part of the solution: https://github.com/micheleg/dash-to-dock/blob/39e5597da42124a23d3f0d5dbca69fea1f3fa96b/appIcons.js#L313-L315

Adding a check so we don't set the urgent flag on focused windows seems to prevent this from happening, like so:

    _addUrgentWindow(window) {
        if (this._urgentWindows.has(window) || window.has_focus())
            return;

This isn't a complete solution though because it doesn't solve the main bug. When the bug is triggered for Firefox, for example, you can unfocus and re-focus Firefox and the wobbling never stops, meaning there is another bug somewhere causing the urgent flag to not be cleared correctly when focusing an application.

BlueManCZ commented 2 years ago

Nice job @inthreedee. I also got time to analyze this a little and found this workaround.

https://github.com/micheleg/dash-to-dock/blob/39e5597da42124a23d3f0d5dbca69fea1f3fa96b/appIcons.js#L144-L149

Insert one line into this function so it looks as follows:

this.connect('notify::focused', () => {
    this.urgent = false;
    if (this.focused)
        this.add_style_class_name('focused');
    else
        this.remove_style_class_name('focused');
})

I guess it's not the cleanest solution but seems to work.

inthreedee commented 2 years ago

It looks like both fixes are required to fully squash this. I've opened a pull request: https://github.com/micheleg/dash-to-dock/pull/1613

@BlueManCZ I modified yours a bit to put your change inside the if statement, so the flag gets cleared only on focus of the window.

inthreedee commented 2 years ago

Heads up for everyone here, some additional debugging help is being requested by @3v1n0 over in the PR. They're having trouble reproducing the problem: https://github.com/micheleg/dash-to-dock/pull/1613#issuecomment-1019027159

hmlendea commented 2 years ago

Can we somehow disable the shaking completely in all situations? I find it incredibly distracting and annoying and at least in my eyes serves no useful purpose. I understand that some might find it useful, but I think for those that do not, there should be a toggle to disable it.

frederikheld commented 2 years ago

I absolutely agree to what @hmlendea says. Please allow to disable this feature completely!

More than often I have the scenario that I restore a Firefox session which opens 10+ windows and I do not want to click each of them individually just to get rid of this annoying animation. If this is supposed to focus my attention, it's doing exactly the opposite: I know that there are tons of new windows, I just made Firefox open them. There is absolutely no need to distract me from what I actually want to do whenever I open the dock!

And even if you want to be notified: the icon just shows that one of those windows must be new, but it doesn't give any hint which one. So it becomes completely useless as soon as you have more than one window of the same application.

ghabit commented 1 year ago

I think shaking functionality is useful indeed. But, here, on archlinux, telegram is continuously shaking while minimized. Is there a way to stop it doing so? Thank you.

ZimbiX commented 1 year ago

@hmlendea @frederikheld @ghabit I've submitted a PR adding a setting to disable icon shaking 🙂 https://github.com/micheleg/dash-to-dock/pull/1896