loading...

Tweaking Epiphany's webapps icons

mdev88 profile image Martín Vukovic ・2 min read

I've been using Epiphany (Gnome's web browser) to create webapps of some services I use daily so I have them in the form of a desktop app.

Also, I want them to be isolated, and not interfere or know anything about my regular browsing, messing up with sessions and cookies. This way, every webapp runs in a separate profile that acts like a sandbox.

The thing that was bothering me is that because all these webapps are actually the same app (Epiphany), they all had the same icon in the open windows bar (they all have their own launcher icons, but the window buttons in the bottom, the one used to change between apps, were the same). That made me mad...

So I did some research and I found xseticon, a neat little command line tool to change the icons of running applications. It's used like this xseticon -name "Title of the app" /path/to/an/image.png.

But there was still a catch... once the webapp opens, the window title changed to whatever the webpage inside was, so what I did was this:

  1. Open the webapp as usual
  2. Wait half a second to give time for the app to actually open
  3. Use xseticon to change the icon based on the window name, which luckily, all Epiphany webapps start with the title "Blank page" and quickly change to whatever else is being loaded.

The half a second wait gave me enough time to wait for the app to start, and also to catch the correct window title before it changes.

The final script looks like this:

#!/bin/bash
epiphany --application-mode --profile="/home/user/.local/share/epiphany-whatsapp-086ea71f39bc5d178a4c363ad9e448d24b02665a" https://web.whatsapp.com/ &  ## the "&" at the end is very IMPORTANT!

sleep 0.5;

xseticon -name "Blank page" /home/user/.local/share/epiphany-whatsapp-086ea71f39bc5d178a4c363ad9e448d24b02665a/app-icon.png 

The & at the end of the line that launches the app is important because without it, the sleep line would not execute, not until I close the app. By using the & I am starting that process but the execution of the script continues, so then I wait half a second and then change the icon.

That's it!

Alt Text

I'm sure this will be of no use to anyone, but this is the kind of things I do when I get bored.

Posted on by:

Discussion

pic
Editor guide