Create .desktop files for Ubuntu
.desktop
files lately to make launching apps easier, I thought I’d write myself a quick reminder of what I did and how it works. If it’s useful to you too, then great! I have one application in a weird path, and another that needs a specific environment variable set for it to work.
Let’s start with OBS. On 20.04 and because I’m using a Wacom Tablet, there is a magic incantation required when it runs. By creating a .desktop
file for it, I can add that and run it from the usual launcher rather than needed a special terminal script or alias.
The file is ~/.local/share/applications/obs.desktop
and looks like this:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=OBS Studio
Icon=/path/to/images/obs-logo.png
Exec=env QT_XCB_TABLET_LEGACY_COORDINATES=1 obs
I also have this one pinned as a favourite so it launches on a Super + [number]
keyboard combination!
Another example is the webpages-as-apps I’ve been packaging lately (blog post coming on that too I promise but tl;dr try nativefier!), the executables are in a weird path and since I expect to re-package fairly often, I don’t want to have to copy things around all the time. No problem! The desktop file doesn’t care, and puts them in my proper launcher regardless:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Twitch Stream Manager
Exec=/wild/long/and/unlikely/path/StreamManagerLJ
Icon=/path/to/images/twitch-logo.png
Hopefully now I’ve written this down, I’ll remember how this works next time without having to come and look up all the instructions … AGAIN :)
Also published on Medium.
hilarious and useful. i feel the same about a lot of my blog entries.