Docklike incorrectly maps windows to .desktop files (maps Sublime Text to Sublime Merge, VSCode to VSCode URL handler)
I currently have Sublime Text and Merge installed on Arch Linux, through the AUR packages. These create .desktop files at /usr/share/applications/sublime_text.desktop
and /usr/share/applications/sublime_merge.desktop
.
On docklike git 588998ad, when I open a Sublime Text window through subl
or the .desktop file (which launches subl), if I have Sublime Merge installed, then docklike instead shows the Sublime Merge app icon. And pinning the .desktop file pins /usr/share/applications/sublime_merge.desktop
to ~/.config/xfce4/panel/docklike-1.rc
, instead of /usr/share/applications/sublime_text.desktop
. Similarly, right-clicking Sublime Text and selecting Edit Launcher instead edits Sublime Merge's launcher.
I think this bug (the icon part, not sure about the pinning part) occurs because GroupWindow::GroupWindow(WnckWindow* wnckWindow)
first calls std::string groupName = Wnck::getGroupName(this);
(which returns "subl"), then AppInfo* appInfo = AppInfos::search(groupName);
which does a fuzzy g_desktop_app_info_search
for "subl", then picks the first result. And Sublime Merge comes alphabetically before Sublime Text.
I'm currently unsure how to handle docking more robustly. xfce4-panel's official windowmenu plugin (source) and xfwm4 pick the proper window icon for Sublime Text windows, but I didn't look into what algorithm they use for finding icons or .desktop files. KWin and plasmashell also handle icons correctly, and plasmashell comes with a built-in dock (source) supporting app clustering, which is robust in my experience, but I didn't look into how it works either.
And pinning VS Code seems to pin /usr/share/applications/visual-studio-code-url-handler.desktop
instead (most or all of the time). I'm not sure exactly what I did (possibly some order of opening VS Code from Whisker Menu, the dock, or terminal code
, and possibly restarting xfce4-panel), but at one point I pinned visual-studio-code-url-handler.desktop
, but Docklike "assigned" the VS Code windows I had open to visual-studio-code.desktop
, and clicking the pinned icon opened VS Code windows under another dock icon. And right now, if I manually edit ~/.config/xfce4/panel/docklike-1.rc
to say visual-studio-code.desktop
, then my open VS Code windows are instead grouped into a different icon under visual-studio-code-url-handler.desktop
.
Similarly, docklike occasionally starts mapping Sublime Text windows to the real Sublime Text .desktop file rather than Sublime Merge, but I haven't figured out what causes it. I've tried and failed to trigger this by launching unrecognized apps without .desktop files, or by installing apps using sudo pacman -S kate
(or -R
to uninstall).
(Also thanks for the code quality, debugging docklike is almost therapeutic compared to the other codebases I've looked at recently.)
(accidentally created an issue on my fork at https://gitlab.xfce.org/nyanpasu64/xfce4-docklike-plugin/-/issues/1, moving it here)