Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-08-23 13:58:20

xfce-amateur
Member
Registered: 2021-06-23
Posts: 11

Devilspie2 only detects target window on restarting devilspie2

I have
- a script that runs a bunch of offline dictionaries in a tabbed terminal emulator window
- a .desktop file that launches the script and sets its class name to dictionary-en
- devilspie2 which is autostarted each xfce session, and has a rule that selects the window by this class name and calls xseticon to change its icon

this used to work well: every time i launched the script, i could see its terminal window represented in the app switcher by my custom icon.  but recently (since upgrading to MX 23/Debian 12?) it's stopped working.

i experience the following:
- start a fresh xfce session
- launch the script
- app switcher shows its window with the default terminal icon sad
- kill devilspie2
- start devilspie 2
- app now shows the custom icon smile !
- close the terminal window
- launch the script again
- app switcher shows its window with the default terminal icon again hmm

can anyone offer assistance?

similar to: https://unix.stackexchange.com/question … i-fix-this (no solution there)

Offline

#2 2023-08-23 17:07:31

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Devilspie2 only detects target window on restarting devilspie2

Run devilspie2 in debug mode and post back the output. Maybe a hint in there.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2023-08-23 18:36:39

xfce-amateur
Member
Registered: 2021-06-23
Posts: 11

Re: Devilspie2 only detects target window on restarting devilspie2

Hi ToZ, thanks for taking a look at this. It looks pretty ordinary to me:

```
$ devilspie2 -d
Running devilspie2 in debug mode.

Using scripts from folder: /home/user/.config/devilspie2
------------
List of Lua files handling "window_open" events in folder:
/home/user/.config/devilspie2/set-icons.lua
List of Lua files handling "window_close" events in folder:
List of Lua files handling "window_focus" events in folder:
List of Lua files handling "window_blur" events in folder:
------------
Window Name: sdcv – English
Class Instance Name: dictionary-en
Window ID: 88080398
Window Name: sdcv-kitty-EN.desktop - GNU Emacs at host
Class Instance Name: emacs
Window ID: 100663614
Window Name: devilspie2 -d ~
Class Instance Name: kitty
Window ID: 94371854
Window Name: xfce4-panel
Class Instance Name: xfce4-panel
Window ID: 16777241

etc.
```

Is there a way to get more output?

Offline

#4 2023-08-23 18:39:37

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Devilspie2 only detects target window on restarting devilspie2

Well, its recognizing the dictionary-en class/window. Can you post the contents of /home/user/.config/devilspie2/set-icons.lua as well as the desktop file that launches the script?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2023-08-23 19:05:13

xfce-amateur
Member
Registered: 2021-06-23
Posts: 11

Re: Devilspie2 only detects target window on restarting devilspie2

yeah, it recognizes it and sets the icon. but, as mentioned, only when i start dp2 manually with the window in question already open.

this is the content of set-icons.lua:

if (get_class_instance_name() == "dictionary-de") then
  os.execute("xseticon -id " .. get_window_xid() .. " /home/user/.local/share/icons/Papirus-Dark/128x128/bookworm-pink.png");
end

debug_print("Window Name: " .. get_window_name());
debug_print("Class Instance Name: " .. get_class_instance_name());
debug_print("Window ID: " .. get_window_xid());


.desktop file:

[Desktop Entry]
Version=1.0
Name=Stardict: English
GenericName=Dictionary interface
Comment=Stardict Console Version
TryExec=/usr/bin/kitty
Exec=kitty --class dictionary-en --title "sdcv – English" --session /home/user/.config/kitty/sdcv-EN.session --config /home/user/.config/kitty/dict-EN.conf
Type=Application
Icon=accessories-dictionary
Terminal=false
Categories=Utility;
StartupWMClass=dictionary
Keywords=Dictionary;

Offline

#6 2023-08-23 20:28:46

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Devilspie2 only detects target window on restarting devilspie2

I notice that set-icons.lua looks for a class of "dictionary-de", bu the desktop file sets "dictionary-en" in the Exec line and just "dictionary" as the StartupWMClass. I'm kind of surprised that it works at all.

What if you set all those class instances to the same string value (class). Does that make a difference?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2023-08-25 09:00:28

xfce-amateur
Member
Registered: 2021-06-23
Posts: 11

Re: Devilspie2 only detects target window on restarting devilspie2

Yeah, that's a good point. However, trying

StartupWMClass=dictionary-en

just now doesn't make a difference (icon is only set upon restarting dp2). If I go the other way and keep

StartupWMClass=dictionary-en

but delete

--class dictionary-en

from the Exec= line, then the icon isn't even set. The debug output reports

Window Name: sdcv – English
Class Instance Name: kitty
Window ID: 94371854

Last edited by xfce-amateur (2023-08-25 14:19:56)

Offline

#8 2023-08-25 09:11:00

xfce-amateur
Member
Registered: 2021-06-23
Posts: 11

Re: Devilspie2 only detects target window on restarting devilspie2

Trying a different terminal emulator:

[Desktop Entry]
Version=1.0
Name=Stardict in XFCE4 Terminal
GenericName=Dictionary interface
Comment=Stardict Console Version
Exec=xfce4-terminal --command="sdcv --only-data-dir --data-dir /home/user/.stardict/dic/thesauruses/ --color"
Type=Application
Icon=accessories-dictionary
Terminal=false
Categories=Utility;
StartupWMClass=dictionary-en
Keywords=Dictionary;

With this the icon isn't set either, whether on launch of this .desktop item, or on restarting dp2. Debug output:

Window Name: Untitled window
Class Instance Name: xfce4-terminal
Window ID: 94371843

Inspecting with

xprop -spy

also shows:

WM_CLASS(STRING) = "xfce4-terminal", "Xfce4-terminal"

Offline

#9 2023-08-25 14:16:37

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Devilspie2 only detects target window on restarting devilspie2

With respect to xfce4-terminal, which version are you using? With the new version 1.1.0, the following command lets me run a terminal app in a separate xfce4-terminal instance with its own custom icon:

xfce4-terminal --title cmus --class cmus --disable-server --icon playmymusic -x cmus

...there were some fixes in this last version of xfce4-terminal that allows this to work now (no need for devilspie).

I'm unfamilar with the sdcv program, but I did install it and it worked in a similar fashion as cmus above.

As for the issue you are having with devilspie2, I'm not sure why its not working. Perhaps an issue with devilspie2?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#10 2023-08-25 14:25:57

xfce-amateur
Member
Registered: 2021-06-23
Posts: 11

Re: Devilspie2 only detects target window on restarting devilspie2

Ok, thanks for holding space wink and thanks for the tip. I appreciate both!

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.014 seconds, 7 queries executed - Memory usage: 566.72 KiB (Peak: 584 KiB) ]