2

I'm playing around with .desktop files and ended up with this one:

[Desktop Entry] Version=1.0 Name=Music Player (cmus) Comment=Command Line Music Player GenericName=Music Player Exec=cmus Terminal=true X-MultipleArgs=false Type=Application StartupNotify=false 

Everything is working so far.

Now I'm also using i3wm and wanna assign the application to a specific workspace. That's my current configuration:

assign [class="^cmus.*$"] 5:🎡 

Unfortunately the class is not set, as it is not defined yet.

It is working pretty well for other applications which accept an argument, e.g. Firefox:

[Desktop Entry] Version=1.0 Name=Twitter Profile - Firefox Comment=Browse the World Wide Web GenericName=Web Browser Keywords=Internet;WWW;Browser;Web;Explorer Exec=firefox --class="Firefox Social Media" -P "Social Media" %u Terminal=false X-MultipleArgs=false Type=Application Icon=firefox 

With i3wm config:

assign [class="^Firefox Social Media$"] 10:🌐 

Can someone tell me how to define the wm class for .desktop entries starting in a terminal? I couldn't find anything.

2 Answers 2

3

You can't setup WM_CLASS via .desktop file because it is up to application to set up its own WM_CLASS.

But many applications still allow to change their class using standard methods of their toolkit (GTK/Qt) so most of them will respect --class command line option.

0

I'm now using the following workaround which I don't consider an real solution.

As I'm using gnome-terminal, the following is possible to set the wm_class:

[Desktop Entry] Exec=gnome-terminal --class=cmus -e cmus Terminal=false 

Didn't work using the wrapper x-terminal-emulator as it is linked to an wrapper which doesn't support the class.

1
  • 1
    This doesn't seem to actually change the class, at least on Ubuntu 22 with default setup (Wayland). gnome-terminal seems to ignore the parameter entirely and sets WM_CLASS to gnome-terminal-server. Commented Jan 8, 2023 at 20:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.