Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest Chrome / Dash-To-Dock will have two Icons #215

Open
schmitch opened this issue Sep 1, 2015 · 13 comments
Open

Latest Chrome / Dash-To-Dock will have two Icons #215

schmitch opened this issue Sep 1, 2015 · 13 comments
Labels

Comments

@schmitch
Copy link

schmitch commented Sep 1, 2015

Somehow this worked in the past but I think due to changes in Chrome dash-to-dock can't add Chrome to Favorites with right Click inside the Dash and also if I add the Favorite inside the Applications it will create a new Icon while clicking on the Dash Icon.
This worked in the past.

@nevesnunes
Copy link

The problem is in Chrome's desktop entry, which executes a wrapper. I think GNOME Shell looks at the WM_CLASS window property and creates another icon if it doesn't match with the launcher. Probably not a Dash-To-Dock issue.

You can quickly fix it like this:

sudo sed -i.bak '/\[Desktop Entry\]/a StartupWMClass=Google-chrome-stable' /usr/share/applications/google-chrome.desktop

@micheleg
Copy link
Owner

micheleg commented Sep 5, 2015

Hi,

thanks for the bug support and investigation. There are few problem with chrome (see for instance #128) which I think are probably not strictly related to the extension. Does the problem appear with the extension disabled?

@marcvangend
Copy link

FYI: I had the same problem with the PhpStorm icon after updating to Gnome-shell 3.18. I verified that the StartupWMClass value was already set correctly. Turning off dash-to-dock and turning it back on again seems to have solved the problem.

@micheleg
Copy link
Owner

Thanks for the additional information. Is PhpStorm based on chrome?

@marcvangend
Copy link

No, it's not. PhpStorm stands on its own. It's written in java and spawns multiple java processes. If I understand correctly, that is why it's necessary to explicitly define the StartupWMClass in the .desktop file.

@Yannik
Copy link

Yannik commented Nov 24, 2015

This bug happens to me on Fedora 23 running Gnome 3.18 & Dash to dock as well. For example, it happens on all Jetbrains IDE for me: Phpstorm, PyCharm..
It is very annoying. I am not sure, whether it is the fault of dash to dock though. I did not do a fresh install of my system, but after removing dash to dock it still didn't work.
This worked perfectly gnome < 3.18. (Yes, StartupWMClass is set correctly! xprop WM_CLASS also shows the correct WM_CLASS)

@Yannik
Copy link

Yannik commented Nov 24, 2015

I have collected some more information about this:
There has been a question about the same issue on unix.stackexchange.com: http://unix.stackexchange.com/questions/242824/java-application-appears-twice-in-dash-dock

Someone gave a very useful answer there:

I see this also when using Java based apps.

I have tracked this issue down to Java not null terminating the WM_CLASS string. Mutter seems to return this invalid string as a result and gnome-shell uses this invalid string for matching the application name which obviously fails.

It is a bug in Java as the WM_CLASS string is supposed to be null terminated. I'm not sure what changed in mutter to expose this issue as it worked previously.

Indeed, this is correct.
Quoting from the ICCCM specification (http://www.x.org/docs/ICCCM/icccm.pdf):

4.1.2.5. WM_CLASS Property
The WM_CLASS property (of type STRING without control characters) contains two consecutive null-terminated strings.
[..]
Note that WM_CLASS strings are null-terminated and, thus, differ from the general conventions that STRING properties are null-separated. This inconsistency is necessary for backwards compatibility.

@marcvangend
Copy link

Thanks @Yannik for looking into this. So, if I understand correctly, it is a bug in IntelliJ/PhpStorm that WM_CLASS strings are not formatted correctly? In that case, can you file a bug report upstream? (I would do it myself if I'd know more about java, but "null terminating strings" means nothing to me :-))

@Yannik
Copy link

Yannik commented Nov 24, 2015

Jetbrains IDEs must null-terminate the string to get this working.
Here is a commit that shows how it could be done (only appending a null byte is necessary): Yannik/intellij-community@56e487f
You can easily compile this yourself and then just replace AppUIUtil.class in your lib/phpstorm.jar. I have tested it and it works perfectly. No more duplicate icons. Needs to be re-done on updates to the IDE though.
Edit: While working on this stuff, I noticed that (of course) IDEA shows the same broken behaviour.

@Yannik
Copy link

Yannik commented Nov 25, 2015

Original jetbrains-issue implementing correct WM_CLASS: https://youtrack.jetbrains.com/issue/IDEA-70806
Original commit: Yannik/intellij-community@8e380b9
Refactor that introduces getFrameClass(): Yannik/intellij-community@8abcc87

I don't have the time to go through creating a complete writeup of these notes in a jetbrains bug just now, if someone else can go ahead and do so, please do it.

@tflori
Copy link

tflori commented Mar 18, 2016

https://youtrack.jetbrains.com/issue/WI-31103
I created a new issue on youtrack

@micheleg
Copy link
Owner

@tflori Thanks for the additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants