Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-04-24 03:10:10

Case
Member
Registered: 2017-04-15
Posts: 12

xfce-terminal and "--class" command line argument

I'm using WeeChat as an IRC client, which is running in the terminal.My dock (plank) obviously doesn't see a difference between a normal terminal window and a terminal window running WeeChat - so WeeChat doesn't have its own position in the dock, it's just lumped in with the other terminal windows. I'd like to fix that.

The dock identifies and groups windows by their class and name properties - and I thought that all GTK applications support the command line options "--class" and "--name" to change these (refer to "man gtk-options" for more info).

With lxterminal (from LXDE, it's GTK3) this approach works fine:

lxterminal --title=WeeChat --class weechat --name WeeChat --command weechat

Gives me a nice, separate entry in my dock, using the icon I defined in my custom made weechat.desktop file.

But trying to use either the --class or the --name command line argument when invoking xfce4-terminal (Xfce 4.14 on Debian Testing) only results in an error message about an unknown parameter.

What am I missing? Is xfce4-terminal not an actual GTK application but some sort of wrapper?

Offline

#2 2020-04-24 08:23:46

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: xfce-terminal and "--class" command line argument

I think I've got it...

According to the manual of xfce4-terminal:

-T, --title=title
           Set title as the window title for the terminal (ignores dynamically-set title)
(...)
 -I, --icon=icon
           Set the terminal's icon as an icon name or filename.

So I tried:

xfce4-terminal -T Top -I /usr/share/icons/elementary-xfce/actions/48/top.png -e top

And it worked!
CE9kliW.png

Then I made a launcher (right click Whisker Menu, select "Edit applications", then add a launcher with your command, set the icon and category, and save your changes).

Now I have a "Top" desktop app, complete with launcher and custom icon!

Thanks for the idea, seems useful.

Offline

#3 2020-04-24 13:48:35

Case
Member
Registered: 2017-04-15
Posts: 12

Re: xfce-terminal and "--class" command line argument

This works for you, since you're using the regular Xfce panel, where every window gets its own window button. But docks like plank usually group all windows of the same class into a single icon, so you only have one icon for terminal windows, one for LibreOffice Writer windows etc. and you need to hover the mouse pointer over the icon or right-click on the icon to get a list of windows.

AFAICT, to make sure my WeeChat icon doesn't get thrown in with the other terminal windows I need to be able to modify the window class. And I don't understand why xfce4-terminal won't let me do that.

Offline

#4 2020-04-25 09:38:05

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: xfce-terminal and "--class" command line argument

Ah, sorry about that. I've searched another bit, even on the Plank repo issues and questions, but can't find a good hint.

Please tell us any news, it's an interesting question!

Offline

#5 2020-04-25 14:31:41

eriefisher
Member
From: ON, Canada
Registered: 2008-10-25
Posts: 415

Re: xfce-terminal and "--class" command line argument

I tried to create a launcher to see if it would accept class but no go. Xfce4-terminal seem to just ignore gtk

exo-desktop-item-edit --help-gtk
Usage:
  exo-desktop-item-edit [OPTION…] [FILE|FOLDER]

GTK+ Options
  --class=CLASS            Program class as used by the window manager
  --gtk-name=NAME          Program name as used by the window manager
  --display=DISPLAY        X display to use
  --gdk-debug=FLAGS        GDK debugging flags to set
  --gdk-no-debug=FLAGS     GDK debugging flags to unset
  --gtk-module=MODULES     Load additional GTK+ modules
  --g-fatal-warnings       Make all warnings fatal
  --gtk-debug=FLAGS        GTK+ debugging flags to set
  --gtk-no-debug=FLAGS     GTK+ debugging flags to unset

Theoretically it should be possible.
Also

exo-desktop-item-edit [OPTION…] [FILE|FOLDER]

Help Options:
  -h, --help               Show help options
  --help-all               Show all help options
  --help-gtk               Show GTK+ Options

Application Options:
  -c, --create-new         Create a new desktop file in the given directory
  -t, --type               Type of desktop file to create (Application or Link)
  --name                   Preset name when creating a desktop file
  --comment                Preset comment when creating a desktop file
  --command                Preset command when creating a launcher
  --url                    Preset URL when creating a link
  --icon                   Preset icon when creating a desktop file
  -V, --version            Print version information and exit
  --display=DISPLAY        X display to use

Siduction
Debian Sid
Xfce 4.18

Offline

#6 2020-04-26 03:35:41

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: xfce-terminal and "--class" command line argument

Use

 set_wmclass(wmclass_name, wmclass_class)[source]
    Parameters:	

        wmclass_name (str) – window name hint
        wmclass_class (str) – window class hint

maybe? I just did a web-search and saw the above, along with instructions that we "shouldn't do this, because all windows of an application should be the same." Presumably because it breaks the very thing that you are trying to break. So to speak.

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

Board footer

Powered by FluxBB