Chromium web apps on KDE Plasma

Chromium has a nice feature letting you make any website behave and look similar to a regular app: have its own icon in app launcher and task bar, and open in a separate window without browser UI. The problem is, on Plasma these web apps still get grouped with each other and Chromium instances in the task bar.

Why does it happen?

Task bar seems to group apps based on a window's Class property, and for all Chromium windows (regular or web apps) of the same profile window Class is the same: it's Class of the first opened window of that profile. Even if you set/change Class of the second window, Chromium will change it back. There is also an Instance name, which does differ for different windows of the same profile, but that seems to be ignored by task bar when making grouping decision.

See also bug report on bugs.kde.org.

Basically, to have a separate task bar icon, Chromium web app should have its own profile and window Class. E.g., we can launch two instances with different --class and --user-data-dir args:

chromium --app=https://example.com --class=webapp-one --user-data-dir=/tmp/webapp-one
chromium --app=https://example.com --class=webapp-two --user-data-dir=/tmp/webapp-two
— and these won't get grouped.

Now let's turn that into a nice .desktop file (assuming your home dir is /home/x, change accordingly):

cat ~/.local/share/applications/Gmail.desktop
[Desktop Entry]
Name=Gmail
Exec=chromium --app=https://gmail.com --class=webapp-gmail --user-data-dir=/home/x/.local/share/webapps/gmail
Icon=/home/x/Pictures/Icons/Gmail.png
StartupWMClass=webapp-gmail
Type=Application

If you are using Chromium with Flatpak, make sure it has access to --user-data-dir. E.g., give it access to xdg-data/webapps or ~/.local/share/webapps (which should be the same) used in .desktop file above.