Guest User

Untitled

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