-- Let's be honest. The appeal of XMonad is that it lets you -- indulge two guilty pleasures at once: OCD and using crazy -- programming languages. -- -- This setup assumes you have a GNOME+xmonad setup using something like: -- /usr/share/xsessions/xmonad-gnome.desktop -- /usr/share/gnome-session/sessions/xmonad.session -- -- Add this to gnome-session-properties for extra focus cues: -- xcompmgr -nfCF -D5 import Control.Monad import qualified Data.Map as M import XMonad hiding ((|||)) import XMonad.Layout.LayoutCombinators ((|||)) import qualified XMonad.StackSet as W import XMonad.Util.Replace import XMonad.Util.EZConfig import XMonad.Util.Stack import XMonad.Config.Gnome import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Hooks.DynamicLog import XMonad.Hooks.InsertPosition import XMonad.Hooks.FadeWindows import XMonad.Layout.Named import XMonad.Layout.Grid import XMonad.Layout.NoBorders import XMonad.Layout.MouseResizableTile import XMonad.Layout.BoringWindows import XMonad.Layout.LayoutHints import XMonad.Layout.ToggleLayouts import XMonad.Actions.UpdatePointer import XMonad.Actions.CycleSelectedLayouts --TODO: -- Suppress updatePointer if button1 is down (chromium tab drag) -- Preserve sizes by window instead of position (i.e., let my terminals be small) -- Always add new windows to left side and increment number in left side? -- Shrink all slaves in same pane when adding rather than only splitting next -- Focus previous when closing, not next (inverse of insertPosition) -- FadeWindows - Why did my setup stop working? -- Suppress border flash on workspace switch main = do replace xmonad $ gnomeConfig { -- start with GNOME compatible base modMask = mod4Mask, -- Windows key not used by apps terminal = "x-terminal-emulator", -- use debian/ubuntu system setting workspaces = (workspaces gnomeConfig) ++ [show 0], -- add 0 for an even ten keys = \cfg -> M.union (keys gnomeConfig cfg) (M.fromList $ [ ((modMask cfg, xK_u), sendMessage ShrinkSlave), ((modMask cfg, xK_i), sendMessage ExpandSlave) ] ++ workspaceHotkeys cfg xK_0 0), manageHook = manageHook gnomeConfig -- support fullscreen <+> (isFullscreen --> doFullFloat) -- insert new windows after current instead of before <+> insertPosition Below Newer -- allow space for gnome panel <+> manageDocks, logHook = logHook gnomeConfig -- switch to grid and back depending on number of windows <+> pickLayout [((<=), 8, ["mrt"]), ((>=), 9, ["Grid"])] -- make non focused windows slightly translucent <+> (fadeWindowsLogHook $ opaque -- <+> (isFloating --> transparency 0.1) <+> (isUnfocused --> transparency 0.15) ) -- warp mouse when changing focus with keyboard <+> smartUpdatePointer (Relative 0.5 0.5) -- <+> dynamicLog , -- make non focused windows slightly translucent handleEventHook = handleEventHook gnomeConfig <+> fadeWindowsEventHook, -- no window decorations layoutHook = smartBorders $ -- no red border around fullscreen youtube videos avoidStruts $ -- leave space for gnome panel (?) boringWindows $ -- is this for dialog windows? layoutHintsWithPlacement (0.5, 0.5) $ -- padding around gvim and pterm to fit font (named "mrt" $ -- make it possible to jump to this noBorders $ -- clicking screen edge hits scrollbar instead of border mouseResizableTile { -- two column tiled layout draggerType = FixedDragger { gapWidth = 4, -- big enough to see and click, draggerWidth = 4 -- small enough to stay out of the way }}) ||| Grid -- for >=9 windows (names itself) } where workspaceHotkeys cfg key num = [ (( modMask cfg, key), windows $ W.greedyView $ show num), ((shiftMask .|. modMask cfg, key), windows $ W.shift $ show num)] windowCount = foldlZ_ (\count win -> 1+count) 0 . W.stack . W.workspace . W.current isDragging :: Query Bool isDragging = liftX $ gets dragging >>= \dr -> case dr of Just (d,_) -> return True Nothing -> return False smartUpdatePointer :: PointerPosition -> X () -- this doesn't work smartUpdatePointer p = gets dragging >>= \dr -> case dr of Just (d,_) -> return () Nothing -> updatePointer p pickLayout :: [((Integer -> Integer -> Bool), Integer, [String])] -> X () pickLayout checks = do ws <- gets windowset let howMany = windowCount ws in do forM_ checks $ \(op, val, names) -> do when (howMany `op` val) (cycleThroughLayouts names)