In KDE plasma 5, how to I create standalone launchers/desktop shortcuts to web apps like gmail?

5

4

I use two operating systems daily: Ubuntu 15.04 with the Unity desktop environment and Manjaro with KDE-plasma-5 desktop. I spend a good chunk of time in my email and it is convenient for me to have it behave like a stanalone program, rather than a tab in chromium.

On both systems, I can create a launcher for gmail, via the settings menu under "More tools". On Ubuntu/Unity, I can add this launcher to the panel and it will act as a standalone program with its own separate icon and keyboard shortcut. On Manjaro/KDE, I the gmail shortcut displays a unique icon, but as soon as the program is started, the gmail window will be recognized as a chromium window and it will be merged with existing chromium windows in the panel instead of retaining the icon that is displayed on the shortcut. I have also tried to create the shortcuts directly with command line flags as described in this rather old post, but the behavior is the same.

How can I mimic the Unity behavior in KDE? Is it possible to get a webapp to behave like a standalone program or will it always merge into any existing open chromium window?

joelostblom

Posted 2015-12-20T05:34:31.233

Reputation: 1 833

So you just want to run a stand-alone instance of a web browser, separate from the regular browser's profile? Try a web search for that? Firefox works great with "-no-remote" and "-p" – Xen2050 – 2015-12-20T08:22:49.117

As I mentioned, I have tried running chrome with the command line flags for a single separate window (both app and url), but this is still merged with any open chrome window. I tried your firefox suggestion and they same thing happens, the window is grouped in the panel together with any other open firefox instance. Using your suggestions, I also have to choose the profile each time rather than having gmail open directly. – joelostblom – 2015-12-20T15:46:17.777

Answers

3

The Problem

The problem causing this issue is that KDE identifies applications for the show a launcher when not running feature by their X11 window class, and chrome does not change the X11 window class, but rather leaves it as google-chrome and instead changes the classname to a unique value.

The Solution

Thankfully, it's possible to force the gmail window to behave the way you want.

  1. Install an application called xdotool with your package manager.
  2. Open up the file manager and browse to ~.local/share/applications/.
  3. Open the .desktop file there that chrome created for your gmail webapp with a text editor
  4. Note the value of StartupWmClass
  5. append the following to the Exec line: &&xdotool search --sync --classname <value> set_window --class <value>, replacing <value> with the value of StartupWmClass.

Here's an example from another webapp I've edited this way:

[Desktop Entry]
Comment=
Exec=/opt/google/chrome/google-chrome --profile-directory=Default --app-id=hlomdbnjeagldabepchlcdhkaagfedim && xdotool search --sync --classname crx_hlomdbnjeagldabepchlcdhkaagfedim set_window --class crx_hlomdbnjeagldabepchlcdhkaagfedim
Icon=chrome-hlomdbnjeagldabepchlcdhkaagfedim-Default
Name=Outlook 365
NoDisplay=false
Path[$e]=
StartupNotify=true
StartupWMClass=crx_hlomdbnjeagldabepchlcdhkaagfedim
Terminal=0
TerminalOptions=
Type=Application
Version=1.0
X-KDE-SubstituteUID=false
X-KDE-Username=

That change will change the window class for the webapp to what KDE is expecting it to be. The app icon may briefly show as the normal chrome icon, but it will quickly be replaced by the proper icon as set in the .desktop file as soon as xdotool completes.

stonecrusher

Posted 2015-12-20T05:34:31.233

Reputation: 261

Thanks for the answer! I have abandoned KDE since I asked this question, but it is good to know that there is a solution to this problem if I ever think about switching back. – joelostblom – 2016-04-22T21:34:18.017

1I think this is fixed with Plasma 5.8, at least it works for me with Chrome (but not Chromium). – hurikhan77 – 2016-10-07T11:40:24.210

@hurikhan77 interesting that chrome would work but not chromium. My kde desktop is down right now due to nouveau failings, but I hope you're right and this ugly hack isn't needed anymore! – stonecrusher – 2016-10-07T16:42:22.340

I tried with plasma 5.8.2 and chrome 54.0.2840.71, under archlinux, and it still doesn't work. It used to work even for chromium a few days ago, but it stopped, probably because of an update. – Jesse – 2016-10-25T11:59:01.613

@Jesse Yes, with the latest upgrade this has changed back to the old behavior for me, too. I wonder which patch it is. – hurikhan77 – 2016-10-30T12:58:14.137

2

Try going to chrome://apps , rigth clicking and app and selecting "open as window"

Source: https://www.wikihow.com/Turn-Your-Favorite-Website-Into-Desktop-Apps-With-Google-Chrome

Zeta

Posted 2015-12-20T05:34:31.233

Reputation: 21