Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Stuff
Saturday, January 19th, 2008 at 12:21:15pm UTC 

  1. --
  2. -- xmonad example config file.
  3. --
  4. -- A template showing all available configuration hooks,
  5. -- and how to override the defaults in your own xmonad.hs conf file.
  6. --
  7. -- Normally, you'd only override those defaults you care about.
  8. --
  9.  
  10. import XMonad
  11. import System.Exit
  12.  
  13. import qualified XMonad.StackSet as W
  14. import qualified Data.Map        as M
  15.  
  16. -- The preferred terminal program, which is used in a binding below and by
  17. -- certain contrib modules.
  18. --
  19. myTerminal      = "urxvt"
  20.  
  21. -- Width of the window border in pixels.
  22. --
  23. myBorderWidth   = 2
  24.  
  25. -- modMask lets you specify which modkey you want to use. The default
  26. -- is mod1Mask ("left alt").  You may also consider using mod3Mask
  27. -- ("right alt"), which does not conflict with emacs keybindings. The
  28. -- "windows key" is usually mod4Mask.
  29. --
  30. myModMask       = mod1Mask
  31.  
  32. -- The mask for the numlock key. Numlock status is "masked" from the
  33. -- current modifier status, so the keybindings will work with numlock on or
  34. -- off. You may need to change this on some systems.
  35. --
  36. -- You can find the numlock modifier by running "xmodmap" and looking for a
  37. -- modifier with Num_Lock bound to it:
  38. --
  39. -- > $ xmodmap | grep Num
  40. -- > mod2        Num_Lock (0x4d)
  41. --
  42. -- Set numlockMask = 0 if you don't have a numlock key, or want to treat
  43. -- numlock status separately.
  44. --
  45. myNumlockMask   = mod2Mask
  46.  
  47. -- The default number of workspaces (virtual screens) and their names.
  48. -- By default we use numeric strings, but any string may be used as a
  49. -- workspace name. The number of workspaces is determined by the length
  50. -- of this list.
  51. --
  52. -- A tagging example:
  53. --
  54. -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
  55. --
  56. myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
  57.  
  58. -- Border colors for unfocused and focused windows, respectively.
  59. --
  60. myNormalBorderColor  = "#dddddd"
  61. myFocusedBorderColor = "#00ff00"
  62.  
  63. -- Default offset of drawable screen boundaries from each physical
  64. -- screen. Anything non-zero here will leave a gap of that many pixels
  65. -- on the given edge, on the that screen. A useful gap at top of screen
  66. -- for a menu bar (e.g. 15)
  67. --
  68. -- An example, to set a top gap on monitor 1, and a gap on the bottom of
  69. -- monitor 2, you'd use a list of geometries like so:
  70. --
  71. -- > defaultGaps = [(18,0,0,0),(0,18,0,0)] -- 2 gaps on 2 monitors
  72. --
  73. -- Fields are: top, bottom, left, right.
  74. --
  75. myDefaultGaps   = [(15,15,0,0)]
  76.  
  77. ------------------------------------------------------------------------
  78. -- Key bindings. Add, modify or remove key bindings here.
  79. --
  80. myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
  81.  
  82.     -- launch a terminal
  83.     [ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  84.  
  85.     -- launch dmenu
  86.     , ((modMask,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
  87.  
  88.     -- launch gmrun
  89.     , ((modMask .|. shiftMask, xK_p     ), spawn "gmrun")
  90.  
  91.     -- close focused window
  92.     , ((modMask .|. shiftMask, xK_c     ), kill)
  93.  
  94.      -- Rotate through the available layout algorithms
  95.     , ((modMask,               xK_space ), sendMessage NextLayout)
  96.  
  97.     --  Reset the layouts on the current workspace to default
  98.     , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  99.  
  100.     -- Resize viewed windows to the correct size
  101.     , ((modMask,               xK_n     ), refresh)
  102.  
  103.     -- Move focus to the next window
  104.     , ((modMask,               xK_Tab   ), windows W.focusDown)
  105.  
  106.     -- Move focus to the next window
  107.     , ((modMask,               xK_j     ), windows W.focusDown)
  108.  
  109.     -- Move focus to the previous window
  110.     , ((modMask,               xK_k     ), windows W.focusUp  )
  111.  
  112.     -- Move focus to the master window
  113.     , ((modMask,               xK_m     ), windows W.focusMaster  )
  114.  
  115.     -- Swap the focused window and the master window
  116.     , ((modMask,               xK_Return), windows W.swapMaster)
  117.  
  118.     -- Swap the focused window with the next window
  119.     , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
  120.  
  121.     -- Swap the focused window with the previous window
  122.     , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
  123.  
  124.     -- Shrink the master area
  125.     , ((modMask,               xK_h     ), sendMessage Shrink)
  126.  
  127.     -- Expand the master area
  128.     , ((modMask,               xK_l     ), sendMessage Expand)
  129.  
  130.     -- Push window back into tiling
  131.     , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
  132.  
  133.     -- Increment the number of windows in the master area
  134.     , ((modMask              , xK_comma ), sendMessage (IncMasterN 1))
  135.  
  136.     -- Deincrement the number of windows in the master area
  137.     , ((modMask              , xK_period), sendMessage (IncMasterN (-1)))
  138.  
  139.     -- toggle the status bar gap
  140.     , ((modMask              , xK_b     ),
  141.           modifyGap (\i n -> let x = (XMonad.defaultGaps conf ++ repeat (0,0,0,0)) !! i
  142.                              in if n == x then (0,0,0,0) else x))
  143.  
  144.     -- Quit xmonad
  145.     , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
  146.  
  147.     -- Restart xmonad
  148.     , ((modMask              , xK_q     ),
  149.           broadcastMessage ReleaseResources >> restart (Just "xmonad") True)
  150.     ]
  151.     ++
  152.  
  153.     --
  154.     -- mod-[1..9], Switch to workspace N
  155.     -- mod-shift-[1..9], Move client to workspace N
  156.     --
  157.     [((m .|. modMask, k), windows $ f i)
  158.         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  159.         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  160.     ++
  161.  
  162.     --
  163.     -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  164.     -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  165.     --
  166.     [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
  167.         | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  168.         , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  169.  
  170.  
  171. ------------------------------------------------------------------------
  172. -- Mouse bindings: default actions bound to mouse events
  173. --
  174. myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
  175.  
  176.     -- mod-button1, Set the window to floating mode and move by dragging
  177.     [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
  178.  
  179.     -- mod-button2, Raise the window to the top of the stack
  180.     , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
  181.  
  182.     -- mod-button3, Set the window to floating mode and resize by dragging
  183.     , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
  184.  
  185.     -- you may also bind events to the mouse scroll wheel (button4 and button5)
  186.     ]
  187.  
  188. ------------------------------------------------------------------------
  189. -- Layouts:
  190.  
  191. -- You can specify and transform your layouts by modifying these values.
  192. -- If you change layout bindings be sure to use 'mod-shift-space' after
  193. -- restarting (with 'mod-q') to reset your layout state to the new
  194. -- defaults, as xmonad preserves your old layout settings by default.
  195. --
  196. -- The available layouts.  Note that each layout is separated by |||,
  197. -- which denotes layout choice.
  198. --
  199. myLayout = tiled ||| Mirror tiled ||| Full
  200.   where
  201.      -- default tiling algorithm partitions the screen into two panes
  202.      tiled   = Tall nmaster delta ratio
  203.  
  204.      -- The default number of windows in the master pane
  205.      nmaster = 1
  206.  
  207.      -- Default proportion of screen occupied by master pane
  208.      ratio   = 1/2
  209.  
  210.      -- Percent of screen to increment by when resizing panes
  211.      delta   = 3/100
  212.  
  213. ------------------------------------------------------------------------
  214. -- Window rules:
  215.  
  216. -- Execute arbitrary actions and WindowSet manipulations when managing
  217. -- a new window. You can use this to, for example, always float a
  218. -- particular program, or have a client always appear on a particular
  219. -- workspace.
  220. --
  221. -- To find the property name associated with a program, use
  222. -- > xprop | grep WM_CLASS
  223. -- and click on the client you're interested in.
  224. --
  225. -- To match on the WM_NAME, you can use 'title' in the same way that
  226. -- 'className' and 'resource' are used below.
  227. --
  228. myManageHook = composeAll
  229.     [ className =? "MPlayer"        --> doFloat
  230.     , className =? "Gimp"           --> doFloat
  231.     , resource  =? "desktop_window" --> doIgnore
  232.     , resource  =? "kdesktop"       --> doIgnore ]
  233.  
  234.  
  235. ------------------------------------------------------------------------
  236. -- Status bars and logging
  237.  
  238. -- Perform an arbitrary action on each internal state change or X event.
  239. -- See the 'DynamicLog' extension for examples.
  240. --
  241. -- To emulate dwm's status bar
  242. --
  243. -- > logHook = dynamicLogDzen
  244. --
  245. myLogHook = return ()
  246.  
  247. ------------------------------------------------------------------------
  248. -- Now run xmonad with all the defaults we set up.
  249.  
  250. -- Run xmonad with the settings you specify. No need to modify this.
  251. --
  252. main = xmonad defaults
  253.  
  254. -- A structure containing your configuration settings, overriding
  255. -- fields in the default config. Any you don't override, will
  256. -- use the defaults defined in xmonad/XMonad/Config.hs
  257. --
  258. -- No need to modify this.
  259. --
  260. defaults = defaultConfig {
  261.       -- simple stuff
  262.         terminal           = myTerminal,
  263.         borderWidth        = myBorderWidth,
  264.         modMask            = myModMask,
  265.         numlockMask        = myNumlockMask,
  266.         workspaces         = myWorkspaces,
  267.         normalBorderColor  = myNormalBorderColor,
  268.         focusedBorderColor = myFocusedBorderColor,
  269.         defaultGaps        = myDefaultGaps,
  270.  
  271.       -- key bindings
  272.         keys               = myKeys,
  273.         mouseBindings      = myMouseBindings,
  274.  
  275.       -- hooks, layouts
  276.         layoutHook         = myLayout,
  277.         manageHook         = myManageHook,
  278.         logHook            = myLogHook
  279.     }

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right