diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 78c0779..d893e35 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -26,6 +26,7 @@ import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.ManageHelpers import XMonad.Hooks.FadeInactive import XMonad.Hooks.SetWMName +import Monad import Data.Monoid import Data.List import Data.Maybe @@ -143,16 +144,51 @@ gsConfig = defaultGSConfig -- jump back to the center with the spacebar, regardless of the current position. reset = M.singleton (0,xK_space) (const (0,0)) + + +------------------------------------------------------------------------ +-- Fullscreen hack from http://code.google.com/p/xmonad/issues/detail?id=339 + +-- Helper functions to fullscreen the window +fullFloat, tileWin :: Window -> X () +fullFloat w = windows $ W.float w r + where r = W.RationalRect 0 0 1 1 +tileWin w = windows $ W.sink w + +evHook :: Event -> X All +evHook (ClientMessageEvent _ _ _ dpy win typ dat) = do + state <- getAtom "_NET_WM_STATE" + fullsc <- getAtom "_NET_WM_STATE_FULLSCREEN" + isFull <- runQuery isFullscreen win + -- Constants for the _NET_WM_STATE protocol + let remove = 0 + add = 1 + toggle = 2 + -- The ATOM property type for changeProperty + ptype = 4 + action = head dat + when (typ == state && (fromIntegral fullsc) `elem` tail dat) $ do + when (action == add || (action == toggle && not isFull)) $ do + io $ changeProperty32 dpy win state ptype propModeReplace [fromIntegral fullsc] + fullFloat win + when (head dat == remove || (action == toggle && isFull)) $ do + io $ changeProperty32 dpy win state ptype propModeReplace [] + tileWin win + -- It shouldn't be necessary for xmonad to do anything more with this event + return $ All False +evHook _ = return $ All True + ------------------------------------------------------------------------ -- Layouts: -mLayout = smartBorders Full ||| tiled ||| hintedTile Wide ||| simplestFloat ||| Circle ||| magnifier Circle +--mLayout = smartBorders Full ||| tiled ||| hintedTile Wide ||| simplestFloat ||| Circle ||| magnifier Circle +mLayout = smartBorders Full ||| tiled ||| Mirror tiled ||| simplestFloat ||| Circle ||| magnifier Circle where -- default tiling algorithm partitions the screen into two panes --tiled = Tall nmaster delta ratio - --tiled = ResizableTall nmaster delta ratio [] - hintedTile = HintedTile nmaster delta ratio TopLeft - tiled = hintedTile Tall + tiled = ResizableTall nmaster delta ratio [] + --hintedTile = HintedTile nmaster delta ratio TopLeft + --tiled = hintedTile Tall -- The default number of windows in the master pane nmaster = 1 @@ -224,7 +260,7 @@ mConfig = defaultConfig , layoutHook = mLayout --, manageHook = manageSpawn sp <+> mManageHook , manageHook = mManageHook - , handleEventHook = pickyFocusEventHook + , handleEventHook = pickyFocusEventHook >> evHook , startupHook = do ewmhDesktopsStartup >> setWMName "LG3D" return () >> checkKeymap mConfig mKeys