baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.79k stars 414 forks source link

bspwm rules do not work on stalonetray #1239

Closed alex3kov closed 3 years ago

alex3kov commented 3 years ago

bspc rule -a Zathura hidden=on -> zathura starts hidden.\ bspc rule -a stalonetray hidden=on -> stalonetray starts visible.\ xprop of stalonetray:

WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
_NET_WM_STRUT_PARTIAL(CARDINAL) = 0, 0, 24, 0, 0, 0, 0, 0, 1896, 1919, 0, 0
_NET_WM_STRUT(CARDINAL) = 0, 0, 24, 0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_DESKTOP(ATOM) = undefined atom # 0xffffffff, undefined atom # 0xffffffff
_NET_WM_STATE(ATOM) = _NET_WM_STATE_STICKY, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_STICKY, _NET_WM_STATE_SKIP_TASKBAR
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x1, 0x0, 0x0, 0x0
STALONETRAY_TIMESTAMP(STALONETRAY_TIMESTAMP) = 0x73
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING
_NET_SYSTEM_TRAY_ORIENTATION(_NET_SYSTEM_TRAY_ORIENTATION) = 0x1
WM_COMMAND(STRING) = { "stalonetray", "-c", "/home/user/dotfiles/stalonetrayrc" }
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 1896, 0
        user specified size: 24 by 24
        program specified minimum size: 24 by 24
        program specified maximum size: 24 by 24
        program specified resize increment: 24 by 24
        program specified base size: 0 by 0
        window gravity: NorthWest
WM_CLASS(STRING) = "stalonetray", "stalonetray"
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: False
        Initial state is Normal State.
WM_NAME(STRING) = "stalonetray"
emanuele6 commented 3 years ago

It's a dock; bspwm won't manage it by default; since it is not managed, even if it's hidden, it won't matter.

You can make bspwm manage it with a manage=on rule (then the hidden flag would work on it), but I bet you don't want it to behave like this (using polybar as example):

Just use the api provided by your dock to hide it (in polybar, it is polybar-msg -pid PID_OF_THE_BAR cmd (toggle|hide|show)). If stalonetray (I have never heard of it so I don't know if it has it) doesn't have an api to do so, just use the hide and show subcommands of xdo to unmap and map the dock; example:

# use this command to hide it
xdo hide -Nstalonetray -nstalonetray
# use this command to show it
xdo show -Nstalonetray -nstalonetray
alex3kov commented 3 years ago

If I add manage=on and hidden=on to bspwmrc then bspwm hides stalonetray on startup (and hits #1147 issue right away - empty space at the top), but then xdo show -Nstalonetray command can't bring it back. Looks like there's no way to toggle hidden flag at runtime with bspc either - matching by class is available only in rules unless I'm missing something in man page.\ I do have a workaround script here, just thought doing it all with bspc would be more "proper".

emanuele6 commented 3 years ago

just thought doing it all with bspc would be more "proper".

I don't think so: it's a dock, not a Window; bspWm is a Window manager. (Also bspwm doesn't manage docks by default intentionally.)

I don't understand why you tried using a manage=on hidden=on rule. I thought I made clear why you wouldn't want to make bspwm manage it. Welp.

but then xdo show -Nstalonetray command can't bring it back

Obviously. The window was never unmapped (xdo hide), it was just being hidden by bspwm; xdo show -Nstalonetray doesn't do anything because the stalonetray "window" is already mapped, you can't see it only because bspwm doesn't show it. If you want to hidelunhide it using bspwm (again, I don't understand why you even tried doing it; it's nonsensical), you need to use bspc to change the hidden flag of the managed window; e.g. like so:

# hide
bspc node "$(xdo id -Nstalonetray -nstalonetray)" -g hidden=on
# unhide
bspc node "$(xdo id -Nstalonetray -nstalonetray)" -g hidden=off
# toggle hidden
bspc node "$(xdo id -Nstalonetray -nstalonetray)" -g hidden

Your script is fine in my opinion.

alex3kov commented 3 years ago

Chill it with the condescension @emanuele6 , not everyone is a bspwm wizard, having domain-specific knowledge doesn't make you smart.\

1147 is my reason to try to manage stalonetray with bspwm instead of xdo

emanuele6 commented 3 years ago

I recorded two videos showing you what will happen if you make bspwm manage a dock; I told you how you can approach the problem; I explained to you why xdo show wasn't unhiding the window; and I even showed you how you can use bspwm to hide your bar (which, again, it's nonsensical) just because you tried doing it.

That was indeed not very smart of me; I should use my time better.