Bspwm: feature request: a way to return active monitors

Created on 9 Dec 2018  Â·  3Comments  Â·  Source: baskerville/bspwm

I'm having a little trouble getting the query i need from bspc. What I'm trying to do is send a notification when a window spawns on a desktop that is not active.

If I use bspc subscribe, i can test query -D -n $node.!active; but if i want to use the external rule script instead it becomes difficult. You can no longer check against the node, because it isn't placed yet (i think). Instead I've have been looping through bspc query -M and checking bspc query -D -d "${monitor}:focused" against the value of $desktop.

basically, is there a way to query for bspc wm -d | jq '.monitors[].focusedDesktopId'?/ is it worth adding a way to do this?

Most helpful comment

You shall use .active as of a94093b.

All 3 comments

Yes, the node isn't managed yet. Within the external rules command, the intermediate consequence is given as $4. Inside this string you might extract a desktop selector (desktop=DESK_SEL). And then, you can simply do query -D -d "${DESK_SEL}.!focused". If DESK_SEL is empty, then the new window will appear inside the focused desktop and can therefore be discarded (unless you echo something like desktop=… within the same script…).

Thank you for this help and apologies for not trying a little more.

My problem was overlooking "DESK_SEL.focused" was true for "active" monitors, I really don't know why I didn't at try it

You shall use .active as of a94093b.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bcspragu picture bcspragu  Â·  7Comments

icf20 picture icf20  Â·  5Comments

ithamsteri picture ithamsteri  Â·  4Comments

Anachron picture Anachron  Â·  3Comments

nebulaw2081d picture nebulaw2081d  Â·  4Comments