Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --class on the command line doesn't work in Wayland #55

Open
beville opened this issue Aug 29, 2023 · 3 comments
Open

Using --class on the command line doesn't work in Wayland #55

beville opened this issue Aug 29, 2023 · 3 comments

Comments

@beville
Copy link

beville commented Aug 29, 2023

I've been using Ubuntu 20.04 (using gtkterm 1.0.1) for my work machine for a while. I have a few ".desktop" files set up, so with a single click I could launch gtkterm with a few different profiles from disctinct dock icons. For example:

[Desktop Entry]
Encoding=UTF-8
Name=TTY USB0
Comment=Communicate with the serial port
Exec=gtkterm -c ttyusb0 --class="TTYUSB0"
Terminal=false
Type=Application
Categories=GNOME;Application;Utility;
Icon=gtkterm.png
X-AppStream-Ignore=true
StartupWMClass=TTYUSB0

By launching with the --class option and matching with the "StartupWMClass" in the desktop file, the dock launcher would only have one instance of that profile at a time, which is perfect for resources like serial ports.

I recently updated to Ubuntu 22.04 (running 1.1.1). I set up the same files and unfortunately the --class option doesn't seem to work now, so that the GUI shows a new app running in the dock.

I tested some other gtk applications (such as gparted) and using "--class still works.

Any thoughts on why this might have changed?

@beville
Copy link
Author

beville commented Aug 29, 2023

Following up, I just tried copying the binary for 1.0.1 from an Ubuntu 20.04 system, and it seems to have the same new behavior. So maybe nothing changed on the app side. Maybe it's the GTK libraries? I'm a bit confused!

@wvdakker
Copy link
Owner

I browsed the original gtkterm source and source from the Ubuntu repository.
--class is not a gtkterm command line parameter. I think it is more Ubuntu (Unity ?) kind of thing.

@beville beville changed the title Using --class on the command line doesn't work Using --class on the command line doesn't work in Wayland Aug 29, 2023
@beville
Copy link
Author

beville commented Aug 29, 2023

Yeah, --class is a pass-through GTK option. Any GTK app will let you use that option, and I guess it's passed down via the application object.

I looked into this a bit more, and realized that I was using the Wayland desktop, not X.org. Restarting the desktop with X.org, and the classes work as expected.

You can see this by running the looking glass inspector (Alt+F2, then lg). If you select the windows tab, you see a list of windows including their "wmclass". Under X.org, I see my custom window class name for gtkterm, but under Wayland, it's the default class of "gtkterm".

Some notable other GTK apps that do support this under Wayland are gimp and gparted

No idea how this could be addressed, but maybe there's some call that could be done at the application level?

For now, I'll run under X.org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants