Chrome Applications and the cursed CSD
I’ve ranted before about Client-Side Decorations (CSD), here and elsewhere, and here’s another one – mostly as a reminder to myself about how to disable CSD on Google Chrome web application windows.
The gist is – CSDs are horrible – they make your desktop look like a mishmash of different operating systems on the same screen, where it is often not clear how to interact with the application windows. The worst case is of course the MS-Windows XP RTL reflected UI, where you had some windows with normal operation buttons (close, maximize, etc) on the right side of the title bar and some windows were in “RTL” mode, so their buttons were on the left side 🤯.
CSDs are still a small problem on MS-Windows, but it is a serious problem on Linux desktops – ever since the (then new) GNOME 3 applications started using client-side decorations, the Linux desktop has mostly been divided into two camps:
GNOME and friends
“CSDs are great, they allow application to put UI into the title bar of the application, and because all the applications you run are our brand-named CSD applications, your desktop looks fine”:
Everyone else
CSDs mean that if you ever want to run an application that wasn’t created by the people that also created your desktop environment – which is often the case for non-purists that need to get work done, your desktop looks an unintuitive mess, and you often spend noticeable time just trying to figure out which buttons is the close button for the app you are looking for:
What are we even doing?!?
As a person running one of the more inclusive desktop environments – Plasma1, it is sometimes hard to fight with all of those different client side decoration apps – GNOME/GTK apps at least can be made to use the Plasma theme (KDE devs work really hard to make that happen), and though the “header bar” UI look and behave weirdly – most GTK applications (such as Firefox and Eclipse) I use aren’t GNOME applications and don’t use the annoying title bar custom UI.
The most annoying is obviously Google Chrome: while for normal windows web browser windows you can disable CSD by going into the appearance settings and enabling “use system title bar and buttons”, there are no such options for “web apps” – i.e. websites that install themselves as applications. I like to use these from time to time, specifically for GMail (as shown) but their CSDs are even worse than GNOME’s: they don’t obey the icon themes, they use different sizes than anything else on the system and they don’t even change color when activated, so looking at two windows it is difficult to figure out which will take your typing!
As far as I can tell, there’s no way to fix that: Google Chrome is a GTK3 application, but for some reason the common workaround for disabling CSD for GTK3 applications doesn’t work for Google Chrome.
But there is another workaround: instead of using the Google Chrome application shortcut to start the application, we can create a new shortcut that uses the Google Chrome command line option “--app
” to start the web site in “application mode” (instead of “--app-id
” that is used to launch installed web applications). This behaves exactly the same as using the installed web application shortcut – in terms of running in its own window and process – but now it obeys the standard Google Chrome settings and can be made to disable CSD. It is even possible to use the standard GTK command line options to give the new window its own custom window class so it is easy to find it using custom window rules and such.
For example, to open GMail as an application, I can use this desktop entry file:
[Desktop Entry]
Exec=/opt/google/chrome/chrome --class=gmailapp --app=https://mail.google.com
Icon=chrome-fmgjjmmmlfnkbppncabfkddbjimcfncm-Default
Name=GMail
StartupNotify=true
Terminal=false
Type=Application
(For the icon I’m using the icon that the Google Chrome application created, so we want to still install it for the icon…)
- inclusive here means: our apps will look native on our desktop as well as others, and we will work hard to make apps from other desktops feel at home on our desktop. [↩]
Thank you for this post. I too like my window title bars to be consistent.
Do you now how we can add tabs to the resulting web app?
Thanks again,
Terry.
The whole point of the
--app
feature is that the resulting window is an application and not a browser, so it has no tabs: its just this one application.In a better world, we could have had window tabs (a-la KDE 3 and BeOS) but we are living in the worst timeline, so we cannot have nice things.
Hi again.
Yes, that makes since. I wanted my cake (web apps) and be able to eat it too (multiple instances of said web app separated by tabs). So much for having nice things.
One more thing, when I launch the web app it always opens as a full height window. It does not remember its size when it was used last. Do you experience this as well? Do you know of a work around.
Thanks,
Terry.
Its a feature that is missing from Chrome’s implementation of
--app
. I think that Chrome doesn’t have that feature anywhere – it doesn’t remember sizes of browser windows for me. But then again I prefer browser windows (and most application windows) as full screen anyway, or tiled.One thing that you can do, if you live on a desktop with window rules – like KDE Plasma – is to set a window rule for the application to always open in a specific geometry.