Comment 13 for bug 1103833

Revision history for this message
Sebastian Thürrschmidt (thuerrschmidt) wrote :

So according to the lastet comments adding a StartupWMClass corresponding to the name of the application's executable to each Wine .desktop file would be a temporary workaround for this problem, until it's fixed in Wine? Let's try it:

find "$HOME/.local/share/applications/wine/Programs" -name '*.desktop' -exec perl -pi -e 'if (m/^Exec=.+ \/Unix (.+\.lnk)/) { ($l = $1) =~ s/\\\\ / /g; $r = qx[env WINEDEBUG=-all wine shortcut /f:"$l" /a:q]; if ($r =~ m/\nTargetPath=(?:.+\\)?([^\\\n]+)/) { print "StartupWMClass=$1\n"; } }' '{}' \;

And hey, it works! Mostly, that is, for me. A few exceptions turned out to be due to to EITHER differences in capitalization between what's in the .lnk file and the actual exectutable on disk OR some internal shenanigans by program loaders/cracks.

Try this workarond at your own risk. Be sure to backup ~/.local/share/applications/wine/Programs beforehand. You may have to run "xdg-desktop-menu forceupdate" to see any changes. YMMV. To revert the changes, i.e. to remove all StartupWMClass lines from all Wine .desktop files:

find "$HOME/.local/share/applications/wine/Programs" -name '*.desktop' -exec perl -pi -e 's/StartupWMClass=.+\n//' '{}' \;

This workaround (or a permanent fix) also seems to fix https://bugs.launchpad.net/ubuntu/+source/unity/+bug/704187. And maybe https://bugs.launchpad.net/ubuntu/+source/unity/+bug/998591.