Guest User

xmonad-shit_2

a guest
Aug 20th, 2012
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import XMonad
  2. import System.Exit
  3. import XMonad.Hooks.ManageDocks
  4. import XMonad.Layout.PerWorkspace
  5. import XMonad.Layout.NoBorders
  6. import XMonad.Hooks.UrgencyHook
  7. import XMonad.Layout.OneBig
  8. import XMonad.Layout.MagicFocus
  9. import XMonad.Layout.Grid
  10. import XMonad.Layout.ShowWName
  11. import XMonad.Layout.ThreeColumns
  12. import XMonad.Layout.NoBorders
  13. import XMonad.Layout.TwoPane
  14. import XMonad.Layout.Reflect
  15. import XMonad.Layout.IM
  16. import Data.Ratio ((%))
  17.  
  18.  
  19. import qualified XMonad.StackSet as W
  20. import qualified Data.Map        as M
  21. ------------------------------------------------------------------------
  22. -- Let's QUAKE!!!
  23.  
  24. myTerm = "urxvt -pe tabbed"
  25. myFont = "-xos4-terminus-medium-r-normal--12-120-72-72-c-60-*-*"
  26. myNormalBorderColor = "#151"
  27. myFocusedBorderColor = "#19f"
  28. myModMask = mod4Mask
  29. myDefaultGaps = [(14,0,0,0)]
  30. myWorkspaces = ["work","write","read","wyrd","internet","communication","media","other","system"]
  31. myManageHook = composeAll
  32.     [ className =? "MPlayer"                --> doFloat
  33.     , resource  =? "desktop_window"         --> doIgnore
  34.     , resource  =? "kdesktop"               --> doIgnore
  35.     , title =? "top"                  --> doF (W.shift "system")
  36.     , title =? "ttytter.pl -hold"     --> doF (W.shift "communication")
  37.     , title =? "vim"                  --> doF (W.shift "write")
  38.     , title =? "fbless"               --> doF (W.shift "read")
  39.     , title =? "wyrd"                 --> doF (W.shift "wyrd")
  40.     , className =? "OpenOffice.org 3.2"     --> doF (W.shift "write")
  41.     , className =? "Contacts"               --> doF (W.shift "write")
  42.     , className =? "Stardict"               --> doF (W.shift "write")
  43.     , className =? "Fbreader"               --> doF (W.shift "read")
  44.     , className =? "Geeqie"                 --> doF (W.shift "read")
  45.     , className =? "Evince"                 --> doF (W.shift "read")
  46.     , className =? "Chmsee"                 --> doF (W.shift "read")
  47.     , className =? "deluge"                 --> doF (W.shift "internet")
  48.     , className =? "Iceweasel"              --> doF (W.shift "internet")
  49.     , className =? "Tsclient"               --> doF (W.shift "internet")
  50.     , className =? "Wireshark"              --> doF (W.shift "internet")
  51.     , className =? "logjam"                 --> doF (W.shift "communication")
  52.     , className =? "Pidgin"                 --> doF (W.shift "communication")
  53.     , className =? "Gimp"                   --> doF (W.shift "media")
  54.     , className =? "Kino"                   --> doF (W.shift "media")
  55.     , className =? "Audacity"               --> doF (W.shift "media")
  56.     , className =? "Mmg"                    --> doF (W.shift "media")
  57.     , className =? "wesnoth-1.10"           --> doF (W.shift "other")
  58.     , className =? "VirtualBox"             --> doF (W.shift "other")]
  59.  
  60. myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
  61.  
  62.     [ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  63.     , ((modMask .|. shiftMask, xK_p     ), spawn "gmrun")
  64.     , ((modMask .|. shiftMask, xK_Up    ), spawn "amixer -q set Master 1+")
  65.     , ((modMask .|. shiftMask, xK_Down  ), spawn "amixer -q set Master 1-")
  66.     , ((modMask .|. shiftMask, xK_c     ), kill)
  67.     , ((modMask,               xK_space ), sendMessage NextLayout)
  68.     , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  69.     , ((modMask,               xK_n     ), refresh)
  70.     , ((modMask,               xK_Tab   ), windows W.focusDown)
  71.     , ((modMask,               xK_j     ), windows W.focusDown)
  72.     , ((modMask,               xK_k     ), windows W.focusUp  )
  73.     , ((modMask,               xK_m     ), windows W.focusMaster  )
  74.     , ((modMask,               xK_Return), windows W.swapMaster)
  75.     , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
  76.     , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
  77.     , ((modMask,               xK_h     ), sendMessage Shrink)
  78.     , ((modMask,               xK_l     ), sendMessage Expand)
  79.     , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
  80.     , ((modMask              , xK_comma ), sendMessage (IncMasterN 1))
  81.     , ((modMask              , xK_period), sendMessage (IncMasterN (-1)))
  82.     , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
  83.     , ((modMask              , xK_q     ), restart "xmonad" True)
  84.     ]
  85.     ++
  86.  
  87.     [((m .|. modMask, k), windows $ f i)
  88.         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  89.         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  90.     ++
  91.  
  92. ------- Something not understanding -----------------------------------------------
  93.     [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
  94.         | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  95.         , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  96.  
  97. ------------------------------------------------------------------------
  98. myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
  99.     [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
  100.     , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
  101.     , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
  102.     ]
  103.  
  104. myLayout = smartBorders $
  105.       onWorkspace "work" (magicFocus (OneBig obWidth obHeight) ||| Full ||| magicFocus (ThreeColMid nmaster delta ratio)) $
  106.       onWorkspace "write" (Full ||| Mirror (TwoPane delta (1/2)) ||| magicFocus (OneBig obWidth obHeight)) $
  107.       onWorkspace "read" (magicFocus (OneBig obWidth obHeight) ||| Full ||| magicFocus (ThreeColMid nmaster delta ratio)) $
  108.       onWorkspace "internet" (Full ||| Mirror (TwoPane delta (1/2))) $
  109.       onWorkspace "communication" ( Full ||| reflectHoriz(withIM (1%5) (ClassName "Pidgin") Grid)) $
  110.       onWorkspace "media" (Full ||| magicFocus (ThreeColMid nmaster delta ratio)) $
  111.       onWorkspace "system" (Grid ||| magicFocus (OneBig obWidth obHeight)) $
  112.       Full
  113.       where
  114.          nmaster = 1
  115.          ratio   = 2/3
  116.          delta   = 3/100
  117.          obHeight = 3/4
  118.          obWidth = 3/4
  119.  
  120. ------------------------------------------------------------------------
  121. main = xmonad defaults
  122. --            { manageHook = myManageHook defaultConfig
  123. --            , layoutHook = avoidStruts  $  layoutHook defaultConfig
  124. --            }
  125.  
  126. defaults = defaultConfig {
  127. --      terminal           = "xterm",
  128.         terminal           = myTerm,
  129.         focusFollowsMouse  = False,
  130.         borderWidth        = 1,
  131.         modMask            = mod4Mask,
  132. --        numlockMask        = mod2Mask,
  133.         normalBorderColor  = myNormalBorderColor,
  134.         focusedBorderColor = myFocusedBorderColor,
  135.         workspaces         = myWorkspaces,
  136.         keys               = myKeys,
  137.         mouseBindings      = myMouseBindings,
  138.         layoutHook         = showWName myLayout,
  139.         manageHook         = myManageHook
  140.     }
RAW Paste Data