0

How to achieve the same behavior(hide the python.exe from taskbar) with Python on Linux? (my target is mainly Raspbian(LXDE) and Gnome)

similar to this or this, however I don't want to use wx or pygame as a window provider as I already use one (sdl2), therefore it probably needs to be some call exactly like win32gui does.

Obviously I haven't tried anything, because I have no clue where to begin, so even some ideas might help.

Community
  • 1
  • 1
Peter Badida
  • 11,310
  • 10
  • 44
  • 90
  • Wouldn't `xlsclients` or `xwininfo -root -tree` always show your window? – Roland Smith Jan 12 '17 at 23:27
  • @RolandSmith even on Windows there are ways how to get it and if not, you can go bashing on the process tree and there you might find it anyway. The important thing is disabling it in GUI, so that user doesn't see it as a "bug". Similar to e.g. old KDE widgets on the desktop (afaik, those didn't have window on taskbar too). – Peter Badida Jan 13 '17 at 00:01

1 Answers1

2

Xorg is the way. If you don't have that, happy searching further.

Basically, you can call this command:

xprop -name <unique window name> -f _NET_WM_STATE 32a \
-set _NET_WM_STATE _NET_WM_STATE_SKIP_TASKBAR

or

xprop -id <window id> -f _NET_WM_STATE 32a \
-set _NET_WM_STATE _NET_WM_STATE_SKIP_TASKBAR

to remove something from taskbar and the window managers should respect that.

Ubuntu's Unity is something special, so if you have multiple windows stacked on a single taskbar icon it either ignores that command, or it already used the command, to stack the icons into that single icon with little arrows on the sides.

I still haven't found the way how to hide that. Feel free to ping me.

Peter Badida
  • 11,310
  • 10
  • 44
  • 90
  • How do you find the "unique window name" or "window id" ? – dtmland Mar 02 '17 at 15:48
  • @dtmland ID can be obtained e.g. from `_NET_ACTIVE_WINDOW`, which is useful for getting a window that may or may not have a non-unique name, therefore hard to target with a string. Obviously you could get an active window's title too, but if that's not unique, then it won't behave like you'd expect and might target completely different window. Unique window name is your window's name - I for example add at the end of the title PID of a process I create a window with, which is quite safe bet for me as I don't have the title actually visible anywhere. – Peter Badida Mar 02 '17 at 16:16
  • Where can I obtain `_NET_ACTIVE_WINDOW` ? I don't see it listed when running xprop with the crosshair and selecting my window? – dtmland Mar 02 '17 at 16:21
  • @dtmland `xprop -root _NET_ACTIVE_WINDOW` [should get it](http://superuser.com/q/1170344/571014). See [WM spec latest](https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html) as a guide for what means what of that properties. – Peter Badida Mar 02 '17 at 16:29