[xmonad] xmobar, dual-head, and avoidStruts

Andrew Sackville-West andrew at swclan.homelinux.org
Mon Nov 3 11:29:00 EST 2008


On Mon, Nov 03, 2008 at 08:13:46AM -0800, Andrew Sackville-West wrote:
> On Sun, Nov 02, 2008 at 07:56:56PM -0800, Andrew Sackville-West wrote:
> > I finally got around to tweaking my xmonad.hs and had to start using
> > avoidStruts but, it doesn't work with xmobar with a Static
> > position. Works fine with the other positions: Top, Bottom, etc, but
> > with Static, xmonad seems to not know it exists.
> 
> So here is a clue. It appears that the Static position doesn't export
> it's dimensions. Here is xprop on xmobar run with Top position:
> 
> andrew at basement:~$ xprop
> _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DOCK
> _NET_WM_STRUT_PARTIAL(CARDINAL) = 0, 0, 18, 0, 0, 0, 0, 0, 0, 1279, 0,
> 0
> 
> 
> and xprop of xmobar with Static position:
> 
> andrew at basement:~$ xprop
> _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DOCK
> _NET_WM_STRUT_PARTIAL(CARDINAL) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 
> 
> so I guess it's safe to say this is an xmobar problem? 

In Xmobar.hs at line 174 is the following:

getStrutValues (Rectangle x _ w h) c =
    case position c of
    Top         -> [0, 0, nh,  0, 0, 0, 0, 0, nx, nw,  0,  0]
    TopW    _ _ -> [0, 0, nh,  0, 0, 0, 0, 0, nx, nw,  0,  0]
    Bottom      -> [0, 0,  0, nh, 0, 0, 0, 0,  0,  0, nx, nw]
    BottomW _ _ -> [0, 0,  0, nh, 0, 0, 0, 0,  0,  0, nx, nw]
    _           -> [0, 0,  0,  0, 0, 0, 0, 0,  0,  0,  0,  0]
    where nh = fi h
          nx = fi x
          nw = fi (x + fi w - 1)

which makes no allowance for defining strut values for Static. Any
reason why not? 

I made this crude hack (because I don't really understand what's going
on: 

getStrutValues (Rectangle x _ w h) c =
    case position c of
    Top            -> [0, 0, nh,  0, 0, 0, 0, 0, nx, nw,  0,  0]
    TopW    _ _    -> [0, 0, nh,  0, 0, 0, 0, 0, nx, nw,  0,  0]
    Bottom         -> [0, 0,  0, nh, 0, 0, 0, 0,  0,  0, nx, nw]
    BottomW _ _    -> [0, 0,  0, nh, 0, 0, 0, 0,  0,  0, nx, nw]
    Static _ _ _ _ -> [0, 0, nh,  0, 0, 0, 0, 0, nx, nw,  0,  0]
    _              -> [0, 0,  0,  0, 0, 0, 0, 0,  0,  0,  0,  0]
    where nh = fi h
          nx = fi x
          nw = fi (x + fi w - 1)


and this works. With xprop reporting:

andrew at basement:~$ xprop 
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DOCK
_NET_WM_STRUT_PARTIAL(CARDINAL) = 0, 0, 18, 0, 0, 0, 0, 0, 0, 2559, 0,
0

and avoidStruts working properly :)

(the 2559 is because I force my xmobar to be two screens wide). 

So I call this a hack because I don't understand what all the
coordinates mean in the case statement. I just mimicked the one for
Top since that is where I put it anyway. I suspect there needs to be a
little math done to a Static position so that it will work in any
position. Can anybody provide insight into what those coordinates
represent? Then I could possible put together a proper fix.

A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/xmonad/attachments/20081103/5737d4f3/attachment.bin


More information about the xmonad mailing list