2

I have problem which annoys me beyond recognition

I have workflow in which multiple windows of same program are monitored by script and according to state of the program X window icon is updated to reflect needed action (set-icon $WINID state.png). For a while it was working quite well, however recently I've updated my box to Kubuntu 16.04 - and this was the worst idea EVER.

It looks that task-manager flag "Use launcher icons" was removed and it's not longer an option to disable this - Plasma forces using launcher icons (always).

Moreover this option seems to be removed completely from config files too.

My question is - is it possible to restore this functionality? To restore older version of task-manager?

Or is there any other way to change (by script) icons of buttons on taskbar?

I've tried to disable plasmashell completely and use some other panel (fbpanel, lxpanel, etc.) but those introduce more mess within KDE than help with the problem

  • For anyone stumbling here - I just noticed that somehow google chrome task manager uses actual window icon on kde taskbar, does it mean that source code supporting this is still there? Would it help supporting this in all windows? – yatsek Feb 1 '17 at 15:06
1

Yupi! There is solution

Digging into weird behavior seen in comment (window icon being shown for Chrome Task Manager) I've tested properties of regular Chrome window and Tm window. It looks that TM lacks WM_CLASS property. So to just see window icon on taskbar doing either

xprop -id $WIN_HEX_ID -remove WM_CLASS

or:

xprop -id $WIN_HEX_ID -format WM_CLASS 8s -set WM_CLASS "my-own-class"

would be enough. But...

This creates another problem - very often WM_CLASS is being used by window managers or other programs to well - manage windows and their relative behavior. So throwing away this precious information is very counter-productive. Unfortunatelly as seen in:

Storing and re-storing full WM_CLASS property is right now not possible with xprop

Checking some possible options I was able to do this with python-xlib module:

from Xlib.display import X, Display
from Xlib.Xatom import STRING

display = Display()
root = display.screen().root

win_hex_id = 0x6a00001 #in my case
win = display.create_resource_object('window', win_hex_id)
saved_prop = win.get_full_property(display.intern_atom('WM_CLASS'),
                       X.AnyPropertyType , 128).value

#to change:
win.change_property(display.intern_atom('WM_CLASS'), 
                    STRING, 8, 'my-own-class')

#to go back:
win.change_property(display.intern_atom('WM_CLASS'), 
                    STRING, 8, str(saved_prop) )

As a comment - weird behavior either of KDE or pyhon-xlib is that actual icon change happens on another property action (reading/writing) - so adding:

win.get_full_property(display.intern_atom('WM_CLASS'), X.AnyPropertyType , 128).value

won't hurt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.