1

I'm trying to hack my way into not having multiple windows of the same application grouped in the Dock in Ubuntu 18 since it seems this is not an available feature natively or with dash-to-dock. I've tried creating copies of applications by making copies of the .desktop files, i.e. making /usr/share/applications/terminator3.desktop and /usr/share/applications/terminator4.desktop.

After starting these two apps however, they're still grouped together as two windows of Terminator in the Dock. I've changed the values of the fields I thought were relevant in the .desktop files between the copies and made sure that the copies use different executable copies for the Exec and TryExec fields. However, the windows are still grouped as the same application. I've even tried adding comments in the executables (they're Python scripts) to make sure the executables might be diffed by Gnome3 to see if they're the same program.

.desktop files

[Desktop Entry]
Name=terminator3
TryExec=terminator3
Exec=terminator3
Type=Application
WMClass=terminator3
X-WMClass=terminator3
StartupWMClass=terminator3
X-StartupWMClass=terminator3
[NewWindow Shortcut Group]
Exec=terminator3
TargetEnvironment=Unity

-

[Desktop Entry]
Name=terminator4
TryExec=terminator4
Exec=terminator4
Type=Application
WMClass=terminator4
X-WMClass=terminator4
StartupWMClass=terminator4
X-StartupWMClass=terminator4
[NewWindow Shortcut Group]
Exec=terminator4
TargetEnvironment=Unity
pomsky
  • 68,507
lsimmons
  • 205

1 Answers1

1

You cannot do this. Changing the .desktop files and duplicating them in this manner doesn't actually change the application, so all the windows will still have the WMClass atom assigned the same.

You will instead need to use a different extension if you want ungrouped windows. If you want them on the launcher bar (dock as you call it), then you will most likely need to fork the extension and change the code in it to not group windows. There is also the Window list extension available, which when enabled will show a traditional task bar at the bottom of the screen. You might want to use it instead.

Alternatively, some applications may be able to take a --class argument to the executable, as a means to change the WMClass atom, which can be matched with StartupWMClass in the .desktop file, as suggested in this answer.

dobey
  • 40,982
  • thanks for the resp, could you elaborate on what you mean by "Changing the .desktop files and duplicating them in this manner doesn't actually change the application"? The WMClass field is not overwriteable in some way? – lsimmons Dec 04 '19 at 18:21
  • do you know what Ubuntu/Gnome uses to determine what the application is that is started by the .desktop file? If each field and the executable itself is different between the .desktop files, then how does Ubuntu consider them to be the same application? – lsimmons Dec 04 '19 at 18:25
  • just adding the reference here - @dobey – lsimmons Dec 04 '19 at 18:31
  • Right. The WMClass related fields in the file are for matching windows. It doesn't overwrite them, IIRC, and some are not even valid .desktop entries for the specification. Also, are you certain the app is running multiple distinct instances? Most likely it's a single instance, and even when you rename the executables they're still just signalling the existing process to open a new window when started. – dobey Dec 04 '19 at 19:59
  • Here's what I don't understand - if I start up one of the duplicates right after boot with no other terminator windows running, the dock/launcher calls the new terminator window "Terminator" even though nowhere in the duplicate's .desktop file do I use the word "Terminator". So where does the dock/launcher get the name of the application?? @dobey – lsimmons Dec 05 '19 at 18:30
  • Creating an alternate symbolic link to a program, doesn't change the program itself, nor anything that understands what the program does. All you've done is create an elaborate symbolic link to a program. – dobey Dec 05 '19 at 19:15
  • But how does the Dock/Gnome interact with the program when it is placing it in the Dock? It has to be getting the name "Terminator" from somewhere, and I know it's not from the duplicate .desktop file. – lsimmons Dec 05 '19 at 22:24
  • @lsimmons Have you tried adding a custom class to the Exec line and a StartupWMClass entry accordingly as per the link in my comment under the question? – pomsky Dec 06 '19 at 05:34
  • @pomsky yeah I tried that however they are all still grouped together - thanks for your comment. It seems that dobey has a point in that Terminator is running once in the background. seems there is something like a server component run when the first window is started, then any subsequent windows use that first terminator server program). So it seems that the hack that I would need to do would be with Terminator itself to have copied executables create new server components/processes and not just use the existing ones. – lsimmons Dec 06 '19 at 16:33