Advertisement
Guest User

xmonad

a guest
May 1st, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. import XMonad hiding ( (|||) )
  2.  
  3. import XMonad.Actions.CycleWS
  4.  
  5. import XMonad.Layout.IndependentScreens
  6. import XMonad.Layout.LayoutCombinators
  7. import XMonad.Layout (Tall)
  8.  
  9. import Data.Monoid (mempty)
  10. import System.Exit
  11.  
  12. import qualified XMonad.StackSet as W
  13. import qualified Data.Map as M
  14.  
  15. myTerminal = "xfce4-terminal"
  16. myModMask = mod4Mask -- Super
  17. myBorderWidth = 3
  18.  
  19. -- Default workspaces
  20. -- Tagging: ["a", "b", "c"] ++ map show [4..9]
  21. myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
  22.  
  23. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  24. [ ((modm, xK_Return), spawn "xfce4-terminal")
  25. -- launch rofi
  26. , ((modm, xK_r ), spawn "rofi -show drun -show-icons")
  27. -- move focus to the previous/next window
  28. , ((modm, xK_Left ), windows W.focusUp)
  29. , ((modm, xK_Right ), windows W.focusDown)
  30. , ((modm, xK_c), kill)
  31. -- shrink/expand master area
  32. , ((modm .|. shiftMask, xK_Left ), sendMessage Shrink)
  33. , ((modm .|. shiftMask, xK_Right), sendMessage Expand)
  34. -- swap the focused window and the next window
  35. , ((modm .|. shiftMask, xK_j), windows W.swapDown)
  36. , ((modm .|. shiftMask, xK_k), windows W.swapUp) -- swap with previous
  37.  
  38. -- restore into tiling mode
  39. , ((modm, xK_t), withFocused $ windows . W.sink)
  40. , ((modm, xK_g), sendMessage $ JumpToLayout "Tall")
  41. , ((modm, xK_f), sendMessage $ JumpToLayout "Full")
  42.  
  43. -- quit xmonad
  44. , ((modm .|. shiftMask, xK_q), io (exitWith ExitSuccess))
  45.  
  46. -- crashes in lightdm, need to fix
  47. --, ((modm, xK_q), spawn "xmonad --recompile; xmonad --restart")
  48. ]
  49. ++
  50.  
  51. -- mod + [1..9] - switch to workspace N
  52. -- mod + shift + N - move client to workspace N
  53.  
  54. [((m .|. modm, k), windows $ f i)
  55. | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  56. , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  57.  
  58. ++
  59.  
  60. -- next/prev screens
  61. [
  62. ((modm, xK_comma), nextScreen)
  63. , ((modm, xK_period), prevScreen)
  64. ]
  65.  
  66. -- [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
  67. -- | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  68. -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  69.  
  70. -- Mouse bindings
  71. myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
  72. [
  73. -- mod+button1 - set to floating mode, and move by dragging
  74. ((modm, button1), \w -> focus w >> mouseMoveWindow w
  75. >> windows W.shiftMaster)
  76. -- mod+button3 - set to floating mode, resize by dragging
  77. , ((modm, button3), \w -> focus w >> mouseResizeWindow w
  78. >> windows W.shiftMaster)
  79. ]
  80.  
  81. -- Layouts
  82. -- More info: https://wiki.haskell.org/Xmonad/Config_archive/Template_xmonad.hs_(0.9)
  83. myLayout = Tall 1 (3/100) (1/2) ||| Full ||| Full
  84.  
  85. -- Window rules
  86. myManageHook = composeAll
  87. [ className =? "Krita" --> doFloat
  88. , className =? "Nemo" --> doFloat
  89. , resource =? "desktop_window" --> doIgnore ]
  90.  
  91. -- Event handling
  92. --
  93. -- Defines a custom handler function for X Events. The function should
  94. -- return (All True) if the default handler is to be run afterwards. To
  95. -- combine event hooks use mappend or mconcat from Data.Monoid.
  96. myEventHook = mempty
  97.  
  98. -- Status bars and logging
  99. myLogHook = return ()
  100.  
  101. myStartupHook = return ()
  102.  
  103. defaults = def
  104. { terminal = myTerminal
  105. , workspaces = withScreens 2 ["web", "code", ""]
  106. , modMask = myModMask
  107. , borderWidth = myBorderWidth
  108. -- key bindings
  109. , keys = myKeys
  110. , mouseBindings = myMouseBindings
  111. -- hooks and layouts
  112. , layoutHook = myLayout
  113. , handleEventHook = myEventHook
  114. , logHook = myLogHook
  115. , startupHook = myStartupHook
  116. }
  117.  
  118.  
  119. main = do xmonad defaults
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement