7

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
  • 2,699
  • 4
  • 24
  • 28

5 Answers5

5

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
  • 331
  • 2
  • 5
5

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
  • 51
1

As I found it very helpful, I've made a little script which applies stoncrushers instruction automatically for every chrome app installed because I have a lot of them.

(Considering Totos comment I will show the script below) It's trying to determine the id from a chrome app and appends the xdotool command at the end of the Exec= line

#!/bin/bash

set -e

DIR="$HOME/.local/share/applications" PATTERN="chrome-*.desktop"

if ! command -v xdotool > /dev/null; then echo "installing xdotool..." yes | sudo pacman -S xdotool fi

for file in $(ls $DIR/$PATTERN) do echo "$file:" ID=$(grep -m 1 Exec $file | sed -E 's/^(.)--app-id=(\w).$/\2/g') CMD=" &amp;&amp; xdotool search --sync --classname $ID set_window --class $ID" if grep -q "$CMD" $file; then echo " skip file" continue fi echo " changing file" sed -E -i 's!^(Exec=)(.)$!\1\2'"${CMD}"'!g' $file done

echo "updating desktop database" update-desktop-database $DIR echo "done"

You can find it also here because this script may receive some bugfixes in the future.

Maybe it's also helpful for others.

tchibu
  • 11
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.

0

Oddly enough for me, I have the same problem you described on chrome in manjaro kde but chromium handles web app icons just fine. Its rather odd some people have this issue with chrome and others with chromium, with installing the opposite one seeming to fix the issue. If Im not mistaken though chromium is available in the manjaro repo while chrome is only available via aur, which im guessing may have something to do with it (but i dont know for sure, just a guess). I do hope in one of these next versions of chrome they fix this issue though, but in the meantime my work around is to use chromium for web apps and chrome for access to the good old google account, it seems to be running smooth despite using both of them simultaneously (and im on a 8yr old lenovo G500s i3). Maybe that workaround solution could work for you until Google fixes this.