You are not logged in.

#1 2015-12-18 00:50:51

goodmami
Member
Registered: 2013-01-14
Posts: 7

Gnome Shell, .desktop files, and StartupWMClass

I use several web sites like applications, such as for email, calendar, messaging, and sometimes for writing documents. I want these to be lauchable and Alt-Tab'able as applications, and not as separate windows or tabs of one browser instance.

I've done a bit of reading into the .desktop files for creating launchers, and I think I'm doing it right, but I can't get the behavior I want (even though it seems to be a supported behavior).

(this might be relevant: https://bbs.archlinux.org/viewtopic.php?id=181853 )

I'm using Gnome Shell and Google Chrome. Let's take, for instance, the Slack messaging app (yes I know there's a Slack desktop app for download, but it's basically the same as the web app, but a 80Mb package). Here's my .desktop file:

$ cat .local/share/applications/slack.desktop 
[Desktop Entry]
Name=Slack
Exec=google-chrome-stable --app=http://groupname.slack.com --class="Slack"
Icon=Slack_Icon
Terminal=false
Type=Application
StartupNotify=true
StartupWMClass=Slack

I've set both StartupWMClass to Slack AND I use the GTK --class option on the Exec line as well. Everything works beautifully except for that the browser window is grouped as "Google Chrome" and not "Slack". I also note the following:

$ google-chrome-stable -h | grep -A5 "user-data-dir"
       --user-data-dir=DIR
              Specifies  the directory that user data (your "profile") is kept
              in.  Defaults to ~/.config/google-chrome .   Separate  instances
              of  Google  Chrome  must  use  separate  user  data directories;
              repeated invocations of google-chrome  will  reuse  an  existing
              process for a given user data directory.

I tried setting --user-data-dir=~/somewhere-else, but it does nothing for the window grouping. Instead, all it seems to do is ignore my cache (so I need to login to my accounts again, which would be fine if the window grouping worked).

I tried Firefox, and while using --class=Slack DOES make the window be called "Slack", subsequent invocations of Firefox (without --class) just get grouped under that instance.

Am I missing something, or is there some bug here? If the latter, I can't tell if it's with the browser(s), Gnome Shell, or something else.

extra credit: if you can solve the above, how about the case where an instance creates new windows. One example is overleaf.com, where opening a project opens it in a new window. I want that grouped under its parent app.

Any help appreciated. Thanks

Offline

#2 2015-12-21 20:45:31

boban_dj
Member
Registered: 2015-03-17
Posts: 150

Re: Gnome Shell, .desktop files, and StartupWMClass

You should have a look at i3 wm, it goes beyond what you try to do here.

Offline

#3 2015-12-22 00:01:41

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Gnome Shell, .desktop files, and StartupWMClass

Chrome can create .desktop files like that by itself with the "add to desktop" menu entry. An app created like that gets its own icon on Gnome's dock and is not grouped with other Chrome windows. When I look at the .desktop file, it looks strange compared to the one you wrote. It does not use "--class" and there's no URL anywhere, instead a weird ID with a parameter "--app-id".

Offline

#4 2015-12-22 07:03:55

goodmami
Member
Registered: 2013-01-14
Posts: 7

Re: Gnome Shell, .desktop files, and StartupWMClass

boban_dj: thanks for the suggestion, but changing desktop environments is more than I'm looking to do right now. I've tried xmonad before and I can see the appeal of tiling window managers, but it's not for me right now.

Ropid: I didn't know about the "add to desktop" menu entry. That's much easier than manually creating the desktop entries. I don't know what the app-id is, but it didn't solve my problem (the window was still grouped with the other Chrome windows). But it worked for you? What version of Chrome are you running? I'm on 46.0.2490.86.

Offline

#5 2015-12-22 08:49:38

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Gnome Shell, .desktop files, and StartupWMClass

I see version 47.0.2526.106 here.

Offline

#6 2016-01-05 19:18:41

goodmami
Member
Registered: 2013-01-14
Posts: 7

Re: Gnome Shell, .desktop files, and StartupWMClass

I've updated to the same as you (47.0.2526.106 (64-bit)), but nothing has changed WRT window grouping. Maybe Chrome isn't at fault here, but instead my Gnome Shell configuration? I wouldn't know where to look, though.

Offline

Board footer

Powered by FluxBB