[xmonad] manageHook question

Adam Vogt vogt.adam at gmail.com
Fri Mar 11 17:04:38 CET 2011

* On Friday, March 11 2011, Victor Gaydov wrote:

>Could someone give me an example of manageHook that will tile
>window if it's width is more that some constant and float it otherwise?
>And another question, is it possible to send window to specific
>subLayout from manageHook?

Hi Victor,

By the optional floating, do you mean when the window in question requests 
a minimum width, like this function:

exceedsSize :: Dimension -> Dimension -> Query Bool
exceedsSize minWidth minHeight = do
    w <- ask
    d <- liftX (asks display)
    sizeHints <- liftIO (getWMNormalHints d w)
    return $ case sh_min_size sizeHints of
        Just (width,height) -> width > minWidth || height > minHeight
        Nothing -> False

Which can then be used in a ManageHook to float in:

    exceedsSize 500 400 --> doFloat

Many windows do not specify minimum sizes, or the minimum sizes are quite small
so this might not be useful (if it does what it is supposed to, as I didn't
test it).

For the second question do you mean something like the last definition here
which has some issues which might need changing SubLayouts to work


More information about the xmonad mailing list