diff --git a/home-manager/modules/xmonad/xmonad.hs b/home-manager/modules/xmonad/xmonad.hs index 2db5419..2e382f0 100644 --- a/home-manager/modules/xmonad/xmonad.hs +++ b/home-manager/modules/xmonad/xmonad.hs @@ -11,8 +11,12 @@ -- Normally, you'd only override those defaults you care about. -- +{-# LANGUAGE BlockArguments +#-} + import XMonad import Data.Monoid +import Data.List (delete) import Data.Maybe import Data.Function import Data.Functor @@ -159,6 +163,23 @@ myKeymap c = , ("" , spawn "@toggle_touchpad@") , ("M-", spawn "@auxmenu@") + + , ("M-", withDisplay $ \dpy -> withFocused $ \win -> do + wmstate <- getAtom "_NET_WM_STATE" + fullsc <- getAtom "_NET_WM_STATE_FULLSCREEN" + wstate <- fromMaybe [] `fmap` getProp32 wmstate win + + let + ptype = 4 + chWstate f = io $ changeProperty32 dpy win wmstate ptype propModeReplace (f wstate) + isFull = fromIntegral fullsc `elem` wstate + + when (not isFull) $ do + chWstate (fromIntegral fullsc:) + windows $ W.float win $ W.RationalRect 0 0 1 1 + when isFull $ do + chWstate $ delete (fromIntegral fullsc) + windows $ W.sink win) ] ++