Guest User

Untitled

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