4

I am using firefox to run some web applications as "stand alones": I create a new profile with firefox, specific for that application, set the first page, do the login and customize the UI depending on the specific needs.

Then, I can quickly launch an instance of that web app by doing:

firefox --no-remote -P My_app_profile the_app_url

to make it even nicer, I created an my_web_app.desktop file and placed it in ~/.local/share/application, and made it favorite, so I can quickly run it from the gnome shell side bar.

The problem is that, after running the application, I see that firefox is running, and not my app. For example, I made a shortcut for Trello, but after launching it, I see this:

Firefox is highlighted, trello is not

Now, it makes sense because it is firefox that is running, but I would like to see my application highlighted instead, and have the firefox icon free to be used as if no other instance was running.

I thought that gnome may highlight the icons depending on the executable name, but a simple sym-link to firefox would not trigger a name change (i.e. link /usr/bin/firefox /usr/bin/my_app_firefox still counts as firefox).

Do you have any idea on how to fix this? I am using gnome shell 3.18.2.

EDIT 1

Here's the trello.desktop file as an example. I am not an expert on the options, so probably I got something terribly wrong... But if I did, it doesn't look like something that would cause the undesired behavior.

[Desktop Entry]
Version=1.0
Name=Trello (FF)
GenericName=Trello Dashboards
Comment=Trello in FireFox
Exec=firefox --no-remote -P App_Trello http://trello.com
Icon=trello
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Categories=Network;WebBrowser;
Keywords=web;browser;internet;
X-Desktop-File-Install-Version=0.22

EDIT 2

So, I wanted to check the gnome-shell source code to see how this could happen. I found that in the Dash each entry is associated to some shell-app, and apparently I want to ensure that the ID of my applications is unique.

Using looking glass (Alt+F2 lg), I could see that my current running applications are named "firefox.desktop":

appSys = Shell.AppSystem.get_default()
ll = appSys.get_running()
ll[0].get_id() // firefox.desktop (0 is the ID of the firefox app in my case)

If I launch my trello.desktop application, the get_running() method returns the same number of entries, therefore my application does not produce a new entry and my hypothesis of having an unique ID seems seems confirmed.

So, I reach the GAppInfo source code to check out what the ID is, and it sends me back to the xdg menu specification. And, from there, I manage to find this:

To determine the ID of a desktop file, make its full path relative to the $XDG_DATA_DIRS component in which the desktop file is installed, remove the "applications/" prefix, and turn '/' into '-'.

My .desktop file was in $HOME/.local/share/applications, which was NOT in my $XDG_DATA_DIRS.

I moved the trello.deskop file into a directory in that path and restarted the shell, but the application still figures as firefox.desktop, so apparently the ID is still the same, in fact the application is still grouped with other firefox windows.

Any suggestion?

  • Thanks, that's useful, as actually I am missing ~/.local/share/applications in the list: /home/myuser/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/ – AkiRoss Oct 6 '16 at 19:52
  • You're talking about this, just as a reference for interested users: unix.stackexchange.com/questions/314338/… – AkiRoss Oct 6 '16 at 20:12
  • BTW as for the general idea: Would not a more lightweight browser such as Epiphany a better choice for "standalone web applications"? It also has less buttons by default and uses more space for the web "application". – rugk Oct 7 '16 at 14:31
1

So, apparently my second edit wasn't correct: the way it GNOME Shell determines application grouping isn't the one I described.

After asking on the IRC gnome-shell channel, user halfline provided me the policy for grouping applications into Dash icons:

_GTK_APPLICATION_ID property of the window matched to the desktop file id or WM_CLASS matched to the desktop file id or _NET_WM_PID matched to the desktop file started or StartupWMClass in the desktop file matched to WM_CLASS on the window

He also suggested that it may be possible to change firefox WM_CLASS, and he's right, as there is a --class flag for firefox that allows to change it.

Here's an example:

$ firefox &
$ xprop WM_CLASS
WM_CLASS(STRING) = "Navigator", "Firefox"

Using that flag I get

$ firefox --class "Trello" &
$ xprop WM_CLASS
WM_CLASS(STRING) = "Navigator", "Trello"

which it just have to match the desktop file ID. Now icons are correctly grouped.

Also, note that epiphany has the support to create desktop apps, handling correctly the links with the default browser, therefore for my original purpose it is even better than firefox.

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.