shell/window-tracker: Update docs on chromium shortcuts

The format of the .desktop file names and their StartupWMClass of
Chromium and Chrome shortcuts has changed, so update the docs to match
the most recent versions of these web browsers.

The user interface to create shortcuts has also changed. They are no
longer created through a "Tools" menu (which doesn't exist anymore), but
rather through a "Save and share" menu. So add that to the docs as well.

Finally, replace the examples using the GNOME Wiki with examples using
the new GNOME Developer Handbook.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7482
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3289>
This commit is contained in:
pesader 2024-04-28 14:53:29 -03:00 committed by Pedro Sader Azevedo
parent ccdd46c0d9
commit 72208da0c2

View File

@ -164,31 +164,26 @@ get_app_from_window_wmclass (MetaWindow *window)
much of the complexity here comes from the desire to support
Chrome apps.
From https://bugzilla.gnome.org/show_bug.cgi?id=673657#c13
Currently Chrome sets WM_CLASS to "Google-chrome" and Chromium sets
it to "Chromium-browser". That happens for the normal browser window, as
well as for its shortcut windows (which can be created through Save and
share -> Create shortcut...)
Currently chrome sets WM_CLASS as follows (the first string is the 'instance',
the second one is the 'class':
The .desktop file names are formatted like so:
${APPLICATION_ID}.flextop.chrome-${WEBSITE_ID}-${PROFILE}.desktop
This file has a matching StartupWMClass, which is formatted like so:
crx_${WEBSITE_ID}
For the normal browser:
WM_CLASS(STRING) = "chromium", "Chromium"
e.g. the .desktop file for a Chromium shortcut to https://handbook.gnome.org
would be located at:
For a bookmarked page (through 'Tools -> Create application shortcuts')
WM_CLASS(STRING) = "wiki.gnome.org__GnomeShell_ApplicationBased", "Chromium"
For an application from the chrome store (with a .desktop file created through
right click, "Create shortcuts" from Chrome's apps overview)
WM_CLASS(STRING) = "crx_blpcfgokakmgnkcojhhkbfbldkacnbeo", "Chromium"
The .desktop file has a matching StartupWMClass, but the name differs, e.g. for
the store app (youtube) there is
.local/share/applications/chrome-blpcfgokakmgnkcojhhkbfbldkacnbeo-Default.desktop
.local/share/applications/org.chromium.Chromium.flextop.chrome-bmfccmnckbnljdcnoglodbceoplecbkl-Default.desktop
with
StartupWMClass=crx_blpcfgokakmgnkcojhhkbfbldkacnbeo
StartupWMClass=crx_bmfccmnckbnljdcnoglodbceoplecbkl
Note that chromium (but not google-chrome!) includes a StartupWMClass=chromium
Note that Chromium (but not Chrome!) includes a StartupWMClass=chromium-browser
in their .desktop file, so we must match the instance first.
Also note that in the good case (regular gtk+ app without hacks), instance and