You are not logged in.

#1 2012-05-26 11:56:08

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Toggle dzen2 bar?

Is there a way to toggle a dzen2 status bar on and off?

I'm currently using herbstluftwm, and I'd like to imitate the behaviour of window managers like Awesome and DWM, which hide the status bar with a keyboard shortcut (default is Mod-b).  I have a dzen2 status bar.  Is there a way to hide and unhide it in a similar way?

Thanks.

Offline

#2 2012-05-26 14:48:29

Wibjarm
Member
Registered: 2012-05-04
Posts: 43

Re: Toggle dzen2 bar?

If hlwm doesn't have a built-in way to toggle the visibility of windows, you can use xdotool to do this.  Just set dzen's -title-name and -slave-name to the same thing, preferably something that won't conflict with anything else, and then bind your key of choice to spawn this:

xdotool search --name <whatever> windowmap %@ || xdotool search --name <whatever> windowunmap %@

  It's not quite as nice and tidy as doing it with something built into the WM itself, but I've been using it for toggling my own dzen bar for a while and it works fine.

Offline

#3 2012-05-26 15:18:05

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Re: Toggle dzen2 bar?

I haven't found anything in the hlwm docs that mention such a function.  Thanks for the suggestion!

Offline

#4 2012-05-26 16:40:23

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Toggle dzen2 bar?

I use "pad" to show and hide the status bar. If your status bar is at the top of the screen, you can use these shortcuts:

hc keybind $Mod-b pad 0 0 0 0 0
hc keybind $Mod-Shift-b pad 0 15 0 0 0

(mod+b hides the bar, mod+shift+b "unhides" it)

Last edited by 2ManyDogs (2012-05-26 16:51:50)

Offline

#5 2012-05-26 19:35:31

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 169

Re: Toggle dzen2 bar?

ibrunton wrote:

Is there a way to toggle a dzen2 status bar on and off?

I'm currently using herbstluftwm, and I'd like to imitate the behaviour of window managers like Awesome and DWM, which hide the status bar with a keyboard shortcut (default is Mod-b).  I have a dzen2 status bar.  Is there a way to hide and unhide it in a similar way?

if you're using the default panel.sh, then it is:

hc keybind $Mod-b emit_hook togglehidepanel

It toggles the visibility of dzen2 and updates the pad

Edit in April 2026: the emit_hook was missing in above code snippet

Last edited by thorsten (2026-04-29 07:18:32)

Offline

#6 2012-05-26 19:38:40

thorsten
Member
From: Germany
Registered: 2010-02-24
Posts: 169

Re: Toggle dzen2 bar?

2ManyDogs wrote:
hc keybind $Mod-b pad 0 0 0 0 0
hc keybind $Mod-Shift-b pad 0 15 0 0

If you omit the 0s at the and or replace them by "", then the padding at this border will be left unchanged, which is more comfortable if one has e.g. a bar at the bottom that shouldn't be affected by this.

Thank you very much for the hlwm-report in the #!-forum :-)

Last edited by thorsten (2012-05-26 19:47:43)

Offline

#7 2012-05-26 19:58:20

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Toggle dzen2 bar?

^ thanks, and you're welcome smile I think a few people started using hlwm after the review...

Offline

#8 2012-05-26 21:15:43

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Re: Toggle dzen2 bar?

thorsten wrote:
ibrunton wrote:

Is there a way to toggle a dzen2 status bar on and off?

I'm currently using herbstluftwm, and I'd like to imitate the behaviour of window managers like Awesome and DWM, which hide the status bar with a keyboard shortcut (default is Mod-b).  I have a dzen2 status bar.  Is there a way to hide and unhide it in a similar way?

if you're using the default panel.sh, then it is:

hc keybind $Mod-b togglehidepanel

It toggles the visibility of dzen2 and updates the pad

I'm currently trying to understand that panel.sh script well enough to adapt it to my own script.

Offline

Board footer

Powered by FluxBB