3

I have a program that I have written in Python and added to Gnome with a desktop file. When I click the stickied icon in Gnome to launch it, it duplicates the icon on my task bar and opens a new instance. Other stickied applications just get a line under them. When you click these other applications (like Chrome or Sublime Text) and they are already running, gnome just jumps to their window instead of launching a new instance.

Is this behavior something that I need to handle in my application, or is this something that Gnome can handle for me? It is a PyQt4 application with a bash launcher if that makes a difference.

Edit- Forgot to mention that I am running Ubuntu-Gnome 16.10 with Gnome 3.20.4

3
+50

I got this to work.

You need to add the key 'StartupWMClass' to your desktop entry.

StartupWMClass: If specified, it is known that the application will map at least one window with the given string as its WM class or WM name hint.

Protocol information here with more details here.

You can install xprop, run it and click the title bar to find out what class your application is.

  • thanks for coming back to update, exactly what i was looking for – aw04 Aug 19 '17 at 15:36
1

I don't know about the Python API, but this is related to GtkApplication.

Read the GtkApplication HowDoI wiki which says:

GtkApplication defaults to applications being single-instance

See also this question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.