6

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?

2
  • 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 Dec 20 '15 at 8:22
  • 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 Dec 20 '15 at 15:46
4

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.

5
  • 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 Apr 22 '16 at 21:34
  • 1
    I think this is fixed with Plasma 5.8, at least it works for me with Chrome (but not Chromium). – hurikhan77 Oct 7 '16 at 11:40
  • @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 Oct 7 '16 at 16:42
  • 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 Oct 25 '16 at 11:59
  • @Jesse Yes, with the latest upgrade this has changed back to the old behavior for me, too. I wonder which patch it is. – hurikhan77 Oct 30 '16 at 12:58
4

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

0

NOTE: This is basically the same reply from stonecrusher above, but changed slightly.


Follow the instructions on the stonecrusher answer above, then change the following:

For the Exec setting on the .desktop file, use this:

Exec=/usr/bin/chromium --profile-directory=Default --app=APP_URL; xdotool search --sync --classname APP_DOMAIN set_window --class CUSTOM_WM_class

Make sure to replace these values:

  • APP_URL the app URL you want to display as a chromium app
  • APP_DOMAIN the domain for the app (e.g. For https://web.whatsapp.com it is "web.whatsapp.com")
  • CUSTOM_WM_CLASS is the value of StartupWMClass on your .desktop file

Note that we're using ; xdotool ... instead of && xdotool ... in the command above. This guarantees it will run, regardless of the exit code of the preceding chromium command.


Tip: If you check for the WM Class using xprop WM_CLASS (and subsequently clicking on the window), you will notice that Chromium reports the Website Domain for the app:

WM_CLASS(STRING) = "web.whatsapp.com", "Chromium"

This allows us to match with the domain name of the app when searching using xdotool.

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.