Guest User

Untitled

a guest
Mar 3rd, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.75 KB | None | 0 0
  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 Data.Monoid
  12. import System.Exit
  13.  
  14. import qualified XMonad.StackSet as W
  15. import qualified Data.Map as M
  16.  
  17. -- The preferred terminal program, which is used in a binding below and by
  18. -- certain contrib modules.
  19. --
  20. myTerminal = "xterm"
  21.  
  22. -- Whether focus follows the mouse pointer.
  23. myFocusFollowsMouse :: Bool
  24. myFocusFollowsMouse = True
  25.  
  26. -- Whether clicking on a window to focus also passes the click to the window
  27. myClickJustFocuses :: Bool
  28. myClickJustFocuses = False
  29.  
  30. -- Width of the window border in pixels.
  31. --
  32. myBorderWidth = 0
  33.  
  34. -- modMask lets you specify which modkey you want to use. The default
  35. -- is mod1Mask ("left alt"). You may also consider using mod3Mask
  36. -- ("right alt"), which does not conflict with emacs keybindings. The
  37. -- "windows key" is usually mod4Mask.
  38. --
  39. myModMask = mod1Mask
  40.  
  41. -- The default number of workspaces (virtual screens) and their names.
  42. -- By default we use numeric strings, but any string may be used as a
  43. -- workspace name. The number of workspaces is determined by the length
  44. -- of this list.
  45. --
  46. -- A tagging example:
  47. --
  48. -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
  49. --
  50. myWorkspaces = ["home","www","work","media","terminal","irssi"]
  51.  
  52. -- Border colors for unfocused and focused windows, respectively.
  53. --
  54. myNormalBorderColor = "#dddddd"
  55. myFocusedBorderColor = "#dddddd"
  56. myBar = "xmobar"
  57. ------------------------------------------------------------------------
  58. -- Key bindings. Add, modify or remove key bindings here.
  59. --
  60. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  61.  
  62. -- launch a terminal
  63. [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  64.  
  65. -- launch dmenu
  66. , ((modm, xK_d ), spawn "dmenu_run")
  67.  
  68. -- launch gmrun
  69. , ((modm .|. shiftMask, xK_p ), spawn "gmrun")
  70.  
  71. -- close focused window
  72. , ((modm .|. shiftMask, xK_c ), kill)
  73.  
  74. -- Rotate through the available layout algorithms
  75. , ((modm, xK_space ), sendMessage NextLayout)
  76.  
  77. -- Reset the layouts on the current workspace to default
  78. , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  79.  
  80. -- Resize viewed windows to the correct size
  81. , ((modm, xK_n ), refresh)
  82.  
  83. -- Move focus to the next window
  84. , ((modm, xK_Tab ), windows W.focusDown)
  85.  
  86. -- Move focus to the next window
  87. , ((modm, xK_j ), windows W.focusDown)
  88.  
  89. -- Move focus to the previous window
  90. , ((modm, xK_k ), windows W.focusUp )
  91.  
  92. -- Move focus to the master window
  93. , ((modm, xK_m ), windows W.focusMaster )
  94.  
  95. -- Swap the focused window and the master window
  96. , ((modm, xK_Return), windows W.swapMaster)
  97.  
  98. -- Swap the focused window with the next window
  99. , ((modm .|. shiftMask, xK_j ), windows W.swapDown )
  100.  
  101. -- Swap the focused window with the previous window
  102. , ((modm .|. shiftMask, xK_k ), windows W.swapUp )
  103.  
  104. -- Shrink the master area
  105. , ((modm, xK_h ), sendMessage Shrink)
  106.  
  107. -- Expand the master area
  108. , ((modm, xK_l ), sendMessage Expand)
  109.  
  110. -- Push window back into tiling
  111. , ((modm, xK_t ), withFocused $ windows . W.sink)
  112.  
  113. -- Increment the number of windows in the master area
  114. , ((modm , xK_comma ), sendMessage (IncMasterN 1))
  115.  
  116. -- Deincrement the number of windows in the master area
  117. , ((modm , xK_period), sendMessage (IncMasterN (-1)))
  118.  
  119. -- Toggle the status bar gap
  120. -- Use this binding with avoidStruts from Hooks.ManageDocks.
  121. -- See also the statusBar function from Hooks.DynamicLog.
  122. --
  123. -- , ((modm , xK_b ), sendMessage ToggleStruts)
  124.  
  125. -- Quit xmonad
  126. , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
  127.  
  128. -- Restart xmonad
  129. , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
  130.  
  131. -- Run xmessage with a summary of the default keybindings (useful for beginners)
  132. , ((modMask .|. shiftMask, xK_slash ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -"))
  133. ]
  134. ++
  135.  
  136. --
  137. -- mod-[1..9], Switch to workspace N
  138. -- mod-shift-[1..9], Move client to workspace N
  139. --
  140. [((m .|. modm, k), windows $ f i)
  141. | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  142. , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  143. ++
  144.  
  145. --
  146. -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  147. -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  148. --
  149. [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
  150. | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  151. , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  152.  
  153.  
  154. ------------------------------------------------------------------------
  155. -- Mouse bindings: default actions bound to mouse events
  156. --
  157. myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
  158.  
  159. -- mod-button1, Set the window to floating mode and move by dragging
  160. [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
  161. >> windows W.shiftMaster))
  162.  
  163. -- mod-button2, Raise the window to the top of the stack
  164. , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
  165.  
  166. -- mod-button3, Set the window to floating mode and resize by dragging
  167. , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
  168. >> windows W.shiftMaster))
  169.  
  170. -- you may also bind events to the mouse scroll wheel (button4 and button5)
  171. ]
  172.  
  173. ------------------------------------------------------------------------
  174. -- Layouts:
  175.  
  176. -- You can specify and transform your layouts by modifying these values.
  177. -- If you change layout bindings be sure to use 'mod-shift-space' after
  178. -- restarting (with 'mod-q') to reset your layout state to the new
  179. -- defaults, as xmonad preserves your old layout settings by default.
  180. --
  181. -- The available layouts. Note that each layout is separated by |||,
  182. -- which denotes layout choice.
  183. --
  184. myLayout = tiled ||| Mirror tiled ||| Full
  185. where
  186. -- default tiling algorithm partitions the screen into two panes
  187. tiled = Tall nmaster delta ratio
  188.  
  189. -- The default number of windows in the master pane
  190. nmaster = 1
  191.  
  192. -- Default proportion of screen occupied by master pane
  193. ratio = 1/2
  194.  
  195. -- Percent of screen to increment by when resizing panes
  196. delta = 3/100
  197.  
  198. ------------------------------------------------------------------------
  199. -- Window rules:
  200.  
  201. -- Execute arbitrary actions and WindowSet manipulations when managing
  202. -- a new window. You can use this to, for example, always float a
  203. -- particular program, or have a client always appear on a particular
  204. -- workspace.
  205. --
  206. -- To find the property name associated with a program, use
  207. -- > xprop | grep WM_CLASS
  208. -- and click on the client you're interested in.
  209. --
  210. -- To match on the WM_NAME, you can use 'title' in the same way that
  211. -- 'className' and 'resource' are used below.
  212. --
  213. myManageHook = composeAll
  214. [ className =? "MPlayer" --> doFloat
  215. , className =? "Gimp" --> doFloat
  216. , resource =? "desktop_window" --> doIgnore
  217. , resource =? "kdesktop" --> doIgnore ]
  218.  
  219. ------------------------------------------------------------------------
  220. -- Event handling
  221.  
  222. -- * EwmhDesktops users should change this to ewmhDesktopsEventHook
  223. --
  224. -- Defines a custom handler function for X Events. The function should
  225. -- return (All True) if the default handler is to be run afterwards. To
  226. -- combine event hooks use mappend or mconcat from Data.Monoid.
  227. --
  228. myEventHook = mempty
  229.  
  230. ------------------------------------------------------------------------
  231. -- Status bars and logging
  232.  
  233. -- Perform an arbitrary action on each internal state change or X event.
  234. -- See the 'XMonad.Hooks.DynamicLog' extension for examples.
  235. --
  236. myLogHook = return ()
  237.  
  238. ------------------------------------------------------------------------
  239. -- Startup hook
  240.  
  241. -- Perform an arbitrary action each time xmonad starts or is restarted
  242. -- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
  243. -- per-workspace layout choices.
  244. --
  245. -- By default, do nothing.
  246. myStartupHook = return ()
  247.  
  248. ------------------------------------------------------------------------
  249. -- Now run xmonad with all the defaults we set up.
  250.  
  251. -- Run xmonad with the settings you specify. No need to modify this.
  252. --
  253. main = xmonad defaults
  254.  
  255. -- A structure containing your configuration settings, overriding
  256. -- fields in the default config. Any you don't override, will
  257. -- use the defaults defined in xmonad/XMonad/Config.hs
  258. --
  259. -- No need to modify this.
  260. --
  261. defaults = defaultConfig {
  262. -- simple stuff
  263. terminal = myTerminal,
  264. focusFollowsMouse = myFocusFollowsMouse,
  265. clickJustFocuses = myClickJustFocuses,
  266. borderWidth = myBorderWidth,
  267. modMask = myModMask,
  268. workspaces = myWorkspaces,
  269. normalBorderColor = myNormalBorderColor,
  270. focusedBorderColor = myFocusedBorderColor,
  271.  
  272. -- key bindings
  273. keys = myKeys,
  274. mouseBindings = myMouseBindings,
  275.  
  276. -- hooks, layouts
  277. layoutHook = myLayout,
  278. manageHook = myManageHook,
  279. handleEventHook = myEventHook,
  280. logHook = myLogHook,
  281. startupHook = myStartupHook
  282. }
Advertisement
Add Comment
Please, Sign In to add comment