- marked as minor
Export smart gaps state
Hi, I’m currently setting up dk and I was wondering if there is a way to make another program aware of the smart gap state. The idea behind this need is a status bar setup that changes depending on the presence of gaps in the workspace.
I tried looking at xdotool
, wmctrl
and similar solutions to try and guess if a workspace has only one window but the more I look the more I think that would be an extremely messy solution.
For what I’ve seen in the code the gap is silently set at 0
when only a window is available in the workspace, is there a way to make the change not silent?
Maybe it would be possible to use the rule and callback framework you put in place?
Let me know your thoughts on this, and thank you for your work on this nice WM!
Comments (9)
-
reporter -
repo owner Sorry for the delay.
This seems like a good idea and should be easy enough to implement. I'll look into getting it done over the weekend. It will likely just be another field attached to workspaces in
dkcmd status type=full num=1
Thanks for the suggestion and trying out the WM.
-
repo owner Add: status output for ws smart gap state, see
#17→ <<cset 02199278c8a7>>
-
repo owner I've added the initial implementation, you'll still need a way to parse out the info but something like this will get you started
dkcmd status type=full num=1 | sed -n '/^workspaces:/,/^$/p'
Will give you something like this
workspaces: *1:1:tile 2:2:tile 3:3:tile 4:4:tile 5:5:tile 6:6:tile 7:7:tile 8:8:tile 9:9:tile 10:10:grid # number:name active_window nmaster nstack msplit ssplit gappx smartgap padl padr padt padb 1:1 0x03800005 1 3 0.50 0.50 0 0 0 0 0 0 2:2 0x02800002 1 3 0.50 0.50 0 1 0 0 0 0 3:3 0x0040008b 1 3 0.50 0.50 0 0 0 0 0 0 4:4 0x03a00005 1 3 0.50 0.50 0 1 0 0 0 0 5:5 0x00000000 1 3 0.50 0.50 0 0 0 0 0 0 6:6 0x00000000 1 3 0.50 0.50 0 0 0 0 0 0 7:7 0x00000000 1 3 0.50 0.50 0 0 0 0 0 0 8:8 0x00000000 1 3 0.50 0.50 0 0 0 0 0 0 9:9 0x00000000 1 3 0.50 0.50 0 0 0 0 0 0 10:10 0x00000000 1 3 0.50 0.50 50 0 200 200 100 100
And to just grab the smart gap state for each workspace in order you can do
dkcmd status type=full num=1 | sed -n '/^workspaces:/,/^$/p' | awk '{if ($8 ~ "[01]") print $8}'
0 1 0 1 0 0 0 0 0 0
0
smart gaps are not being used on that workspace,1
smart gap is active (meaning no gaps and a single window)Lemme know
-
reporter Very nice, thanks!
Right now I'm out of town, but I'll try the change out as soon as I'm home and get back to you
-
repo owner - changed status to resolved
I think can be called done, if you run into any issues or have other ideas please let me know.
-
reporter Sorry for the unresponsiveness, I’m in the middle of the exam session at uni.
That said I’m positive I can work with
dkcmd status
to get what I need, if I can get Polybar to cooperate.Maybe if it works well enough with the bar we can think about making a callback for this situation instead of polling the status output, but we’ll cross that bridge when we come to it.
-
reporter If you’re curious about the effect:
I managed to make Polybar comply, it was no easy task hahahah
Thanks for the help anyway
-
repo owner That looks really nice and well integrated.
I really appreciate your interest in the project and don't sweat any delays you might have, I'm not always great about timing either. I'd be willing to look into setting up some form of callback but honestly the status command is fairly fast and reasonably optimized. That being said I'm always down to improve things. You should post some screenshots on our forum https://forum.archlabslinux.com Don't worry about what distro etc., everyone's just happy to hang out and share stuff.
- Log in to comment