Monday, February 5, 2018

Different behavior when launched from terminal instead of Unity launcher



I have written two Perl/Gtk programs. When launched from the dash menu, they run just fine.




However, if I try to launch them from terminal using the very same command found in their .desktop files, their Unity launcher will be blurry and will remain inactive when clicked, if I keep it in the Unity bar.



The problem is solved if the Exec part of the desktop file is replaced with



perl path_to_script


However, that leads to other problems, including a lintian warning and forcing all Perl GUI applications running from terminal to adopt the same launcher.




This issue is quite annoying since one of the programs relies on a different (Python) program in order to be launched and this results in having a blurry and inactive launcher.



I found out what was wrong. I had to enter the correct StartupWMClass at the .desktop file.



For those who are struggling with it, launch the application from terminal and execute in a different terminal the command



xprop | grep WM_CLASS


Click on your application and the output of the previous command will be




WM_CLASS(STRING) = "result"


Add to the .desktop file the following line:



StartupWMClass=result


Substitute result with your output.



No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...