Fixing desktop shortcut of Lagrange

Posted on: 8th June 2021

I have been using Lagrange to browse Gemini after moving to elementary. It’s beautiful and integrates well with the desktop. A minor issue has been bothering me with Lagrange though. Its the duplicate icon on the Plank whenever Lagrange was invoked.

screenshot of my dock on elementary showing two icons for Lagrange

Perhaps its not annoying for any other user or nobody else uses it on elementary because there were no related issues in their github repo. It took me a while to find the exact option to add in the desktop shortcut that makes this particular problem go away. We need to find the WM_CLASS name for the application by running xprop WM_CLASS in the terminal. This will change the cursor to a cross and then we poke the desired application with this cross - which in my case is Lagrange. The terminal will now show the WM_CLASS name for the application. For Lagrange, it was simply ‘lagrange’.

screenshot of terminal showing the output of xprop WM_CLASS

Once we have the WM_CLASS name, we just need to add this line to the desktop shortcut: StartupWMClass=lagrange

Only problem? I can’t figure out where Flatpak keeps the shortcut. Even adding a shortcut in the usual location ~/local/share/applications proved ineffective. A little duckduckgo later, Arch wiki (all hail arch wiki), shines a light on the mystery. The flatpak desktop shortcuts (its a symlink) reside in ~/.local/share/flatpak/exports/share/applications.

Here’s the shortcut file now:

[Desktop Entry]
Comment=A Beautiful Gemini Client
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/bin/lagrange --file-forwarding fi.skyjake.Lagrange @@u %U @@

and the dock:

screenshot of the dock after applying the fix. Just one icon for Lagrange now.

Logging out, logging back in and adding the shortcut to the Dock once again fixed the annoyance. There’s a chance that when Lagrange updates next time, the changes might go away. For now, I have kept a copy in ~/local/share/applications to deal with it.

tags: elementary flatpak lagrange gemini