Sören Bleikertz
01 Dec 2011

Hide Unity Panel in XMonad

In case you are using XMonad with Unity, you might get annoyed by the wasted vertical screen estate due to the Unity panel. Especially, since it is not possible anymore to configure it for auto hide.

However, with XMonad’s XMonad.Hooks.ManageDocks it is possible to circumvent this issue. In my case, I have Unity panel on the top of the screen and xmobar on the bottom, and I would like to hide the Unity panel by default.

We first tell ManageDocks to always show the dock at the Down/bottom (D). The following line is an extension of the defined layouts.

layout = avoidStrutsOn [D] $ ...

Furthermore, I would like to toggle the visibility of the Unity panel by M-B and M-b toggles the visibility of all docks, e.g., xmobar and Unity panel in my case. The following lines extend my keys configuration in XMonad.

, ((modMask              , xK_b     ), sendMessage ToggleStruts)
, ((modMask .|. shiftMask, xK_b     ), sendMessage $ ToggleStrut U)

Now I can enjoy a mostly hidden Unity panel that can be shown on demand.