Linux Desktop Entry and Icons

Written by Luke Arntz on December 14, 2024

tags:

Contents

I’m not picky about terminals in general. I mostly want them to stay out of my way and be able to switch between light and dark themes with the system. I’d been using the standard Gnome Console, but started becoming annoyed with not being able to copy to my local clipboard from Neovim and Tmux on remote systems. Gnome Console does not support the OSC-52 escape sequence that can be used for remote copy from terminal applications that support it like Neovim and Tmux. Becasue of that, I switched to wezterm which works great for remote copy.

The Problem

I am using the wezterm appimage and Gnome wasn’t displaying the Wezterm icon on the dock even though it was set in the wezterm.desktop entry I created (it did show up in the launcher). But, I was able to set the Joplin icon= line in my joplin.desktop file and it worked as expected.

The Fix

So, why wasn’t wezterm working?

The issue is that wezterm’s window class isn’t wezterm. It’s org.wezfurlong.wezterm. I found a post on reddit that explained the .desktop file must be named the same as the window manager class, or StartupWMClass must be set for the icon to appear on the dock.

This will apply to any application you create a .desktop file for. It turns out that Joplin’s window manager class is simply joplin so there was no need for the StartupWMClass setting.

To fix this you must do the following:

  1. Download or copy the icon file to the ~/.icons directory.
  2. Make sure to add the StartupWMClass line in the .desktop file with the correct window manager class. You can find this name in Gnome using the looking glass tool (Alt-F2, type lg, hit enter).
  3. Icons should now appear correctly.

The final wezterm.desktop file (notice line 3):

[Desktop Entry]
Name=WezTerm
StartupWMClass=org.wezfurlong.wezterm
Comment=A GPU-accelerated terminal emulator
Exec=/usr/local/bin/wezterm
Icon=wezterm
Terminal=false
Type=Application
Categories=Application;TerminalEmulator;

Related Articles

Top