Advertisement
AncientPC

xmonad.hs

Mar 6th, 2012
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- TODO:
  2. -- bind mouse resize corner using flexible resize
  3. import XMonad
  4. import XMonad.Config.Gnome
  5. import Control.Monad (liftM2)
  6.  
  7. import XMonad.Actions.CycleWindows
  8. import XMonad.Actions.CycleWS
  9. --import XMonad.Actions.FlexibleResize
  10. import XMonad.Actions.UpdatePointer
  11.  
  12. import XMonad.Hooks.EwmhDesktops
  13. import XMonad.Hooks.SetWMName
  14. import XMonad.Hooks.ManageHelpers
  15.  
  16. import XMonad.Layout.NoBorders
  17. import XMonad.Layout.ToggleLayouts
  18.  
  19. import qualified XMonad.StackSet as W
  20.  
  21. import XMonad.Util.EZConfig
  22. --import XMonad.Util.Run
  23. import XMonad.Util.Scratchpad
  24.  
  25.  
  26. main = xmonad $ gnomeConfig {
  27.         borderWidth = 2,
  28.         normalBorderColor = "#222",
  29.         focusedBorderColor = "#c50",
  30.         --focusFollowsMouse = False,
  31.  
  32.         terminal = myTerminal,
  33.         modMask = mod4Mask,
  34.  
  35.         workspaces = myWorkspaces,
  36.         logHook = updatePointer (Relative 0.5 0.5),
  37.         layoutHook = smartBorders (layoutHook gnomeConfig),
  38.         handleEventHook = fullscreenEventHook, --fix Chrome full screen
  39.         startupHook = ewmhDesktopsStartup >> setWMName "LG3D",
  40.         manageHook = myManageHook
  41.     }
  42.     `additionalKeysP` myKeys
  43.  
  44. myTerminal = "gnome-terminal"
  45. myWorkspaces = ["1","2","3","4","5","6"]
  46.  
  47. myKeys = [
  48.     ("M4-u", spawn "xmonad --recompile; xmonad --restart"),
  49.     ("C-M1-<Home>", spawn "nautilus"),
  50.     ("C-M1-t", spawn myTerminal),
  51.     ("M4-`", scratchpadSpawnActionCustom "gnome-terminal --disable-factory --name scratchpad"),
  52.     ("M4-f", spawn "firefox"),
  53.     ("M4-b", spawn "chromium"),
  54.  
  55.     -- print screen
  56.     ("<Print>", spawn "gnome-screenshot"),
  57.     ("C-<Print>", spawn "gnome-screenshot -w"),
  58.  
  59.     -- windows
  60.     ("M1-q", kill),
  61.     ("M1-<Tab>", cycleRecentWindows [xK_Alt_L] xK_Tab xK_Tab ), --classic alt-tab behavior
  62.  
  63.     -- workspaces
  64.     ("C-M1-h", prevWS),
  65.     ("C-M1-l", nextWS),
  66.     ("M1-`", toggleWS),
  67.     ("C-S-h", shiftToPrev),
  68.     ("C-S-l", shiftToNext),
  69.  
  70.     -- screens
  71.     ("M4-<Tab>", nextScreen),
  72.     ("C-S-<Tab>", shiftNextScreen)
  73.     ] ++ [
  74.     -- switch to workspace as opposed to swapping
  75.     -- switch to workspace with C- as opposed to M-
  76.     (otherModMasks ++ "C-" ++ [key], action tag) |
  77.     (tag, key)  <- zip myWorkspaces "123456789",
  78.     (otherModMasks, action) <- [ ("", windows . W.view), -- was W.greedyView
  79.     ("S-", windows . W.shift) ]
  80.     ]
  81.  
  82. myManageHook = composeAll [
  83.     className =? "Eog" --> doFloat,
  84.     className =? "Gimp" --> doFloat,
  85.     className =? "banshee" --> viewShift "6",
  86.     appName =? "crx_nckgahadagoaajjgafhacjanaoiihapd" --> doFloat, --Google Chat extension windows
  87.  
  88.     className =? "Do" --> doFloat,
  89.     className =? "Nautilus" --> viewShift "1",
  90.  
  91.     title =? "Top Expanded Edge Panel" --> doIgnore,
  92.     title =? "Bottom Expanded Edge Panel" --> doIgnore,
  93.     resource =? "desktop_window" --> doIgnore,
  94.     isDialog --> doCenterFloat,
  95.     isFullscreen --> doFullFloat
  96.     ] <+> manageScratchPad <+> manageHook defaultConfig
  97.     where viewShift = doF . liftM2 (.) W.view W.shift --shift workspace after move hook
  98.  
  99. -- ScratchPad customizations
  100. manageScratchPad :: ManageHook
  101. manageScratchPad = scratchpadManageHook (W.RationalRect l t w h)
  102.     where
  103.         h = 0.8     -- terminal height
  104.         w = 0.8     -- terminal width
  105.         t = 0.1     -- distance from top edge
  106.         l = 0.1     -- distance from left edge
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement