Guest User

Untitled

a guest
Jul 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.40 KB | None | 0 0
  1. --
  2. -- xmonad by drot
  3. --
  4.  
  5. import XMonad
  6. import System.Exit
  7.  
  8. import XMonad.Prompt
  9. import XMonad.Prompt.Shell
  10. import XMonad.Util.Run
  11. import XMonad.Hooks.DynamicLog
  12. import XMonad.Hooks.UrgencyHook
  13. import XMonad.Hooks.ManageDocks
  14. import XMonad.Actions.GridSelect
  15. import XMonad.Hooks.FadeInactive
  16. import XMonad.Layout.PerWorkspace
  17. import XMonad.Layout.SimplestFloat
  18. import qualified XMonad.StackSet as W
  19. import qualified Data.Map as M
  20.  
  21. -- Launch xmonad
  22. --
  23. main = do
  24. dzenSbar <- spawnPipe sBarCmd
  25. spawn "xcompmgr"
  26. xmonad $ withUrgencyHook NoUrgencyHook $ myDefaults
  27.  
  28. myDefaults = defaultConfig {
  29. terminal = "urxvtc",
  30. focusFollowsMouse = True,
  31. borderWidth = 1,
  32. modMask = mod4Mask,
  33. workspaces = ["main","www","irc","music","float"],
  34. normalBorderColor = "#888888",
  35. focusedBorderColor = "#9c8e2d",
  36. keys = myKeys,
  37. mouseBindings = myMouseBindings,
  38. layoutHook = myLayoutHook,
  39. manageHook = myManageHook,
  40. logHook = (dynamicLogWithPP $ myDzenPP dzenSbar) >> fadeInactiveLogHook 0.8
  41. }
  42.  
  43. -- Layout configuration
  44. --
  45. myLayoutHook = avoidStruts $ onWorkspace "float" simplestFloat $ tiled ||| Mirror tiled ||| Full
  46. where
  47. -- default tiling algorithm partitions the screen into two panes
  48. tiled = Tall nmaster delta ratio
  49.  
  50. -- The default number of windows in the master pane
  51. nmaster = 1
  52.  
  53. -- Default proportion of screen occupied by master pane
  54. ratio = 1/2
  55.  
  56. -- Percent of screen to increment by when resizing panes
  57. delta = 3/100
  58.  
  59. myManageHook = composeAll
  60. [ className =? "MPlayer" --> doFloat
  61. , className =? "Gimp" --> doFloat ]
  62.  
  63. -- Prompt style
  64. --
  65. myXPConfig = defaultXPConfig
  66. {
  67. font = "-*-anorexia-*-*-*-*-*-*-*-*-*-*-*-*"
  68. , fgColor = "#888888"
  69. , bgColor = "#181818"
  70. , bgHLight = "#181818"
  71. , fgHLight = "#9c8e2d"
  72. , position = Top
  73. }
  74.  
  75. -- Status bar
  76. --
  77. sBarCmd = "dzen2 -ta 'l' -fg '#f0f0f0' -bg '#000000' -fn '-*-anorexia-*-*-*-*-*-*-*-*-*-*-*-*'"
  78.  
  79. -- Pretty printer look
  80. --
  81. myDzenPP dzenSbar = defaultPP
  82. {
  83. ppOutput = hPutStrLn dzenSbar
  84. , ppTitle = dzenColor "#ffffff" "" . wrap "< " " >"
  85. , ppCurrent = wrap "^p()<^fg(#82aeda)" "^fg()>^p()"
  86. , ppUrgent = wrap "!^fg(#e9c789)^p()" "^fg()^p()"
  87. , ppSep = " : "
  88. , ppWsSep = " : "
  89. , ppLayout = xmobarColor "#777777" "" .
  90. (\x -> case x of
  91. "Tall" -> "[]="
  92. "Mirror Tall" -> "=--"
  93. "Full" -> "[M]"
  94. "SimplestFloat" -> "><>"
  95. _ -> x
  96. )
  97. }
  98.  
  99. ------------------------------------------------------------------------
  100. -- Key bindings. Add, modify or remove key bindings here.
  101. --
  102. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  103.  
  104. -- launch a terminal
  105. [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  106.  
  107. -- launch prompt
  108. , ((modm, xK_p ), shellPrompt myXPConfig)
  109.  
  110. -- grid select
  111. , ((modm, xK_g ), goToSelected defaultGSConfig)
  112.  
  113. -- close focused window
  114. , ((modm .|. shiftMask, xK_c ), kill)
  115.  
  116. -- Rotate through the available layout algorithms
  117. , ((modm, xK_space ), sendMessage NextLayout)
  118.  
  119. -- Reset the layouts on the current workspace to default
  120. , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  121.  
  122. -- Resize viewed windows to the correct size
  123. , ((modm, xK_n ), refresh)
  124.  
  125. -- Move focus to the next window
  126. , ((modm, xK_Tab ), windows W.focusDown)
  127.  
  128. -- Move focus to the next window
  129. , ((modm, xK_j ), windows W.focusDown)
  130.  
  131. -- Move focus to the previous window
  132. , ((modm, xK_k ), windows W.focusUp )
  133.  
  134. -- Move focus to the master window
  135. , ((modm, xK_m ), windows W.focusMaster )
  136.  
  137. -- Swap the focused window and the master window
  138. , ((modm, xK_Return), windows W.swapMaster)
  139.  
  140. -- Swap the focused window with the next window
  141. , ((modm .|. shiftMask, xK_j ), windows W.swapDown )
  142.  
  143. -- Swap the focused window with the previous window
  144. , ((modm .|. shiftMask, xK_k ), windows W.swapUp )
  145.  
  146. -- Shrink the master area
  147. , ((modm, xK_h ), sendMessage Shrink)
  148.  
  149. -- Expand the master area
  150. , ((modm, xK_l ), sendMessage Expand)
  151.  
  152. -- Push window back into tiling
  153. , ((modm, xK_t ), withFocused $ windows . W.sink)
  154.  
  155. -- Increment the number of windows in the master area
  156. , ((modm , xK_comma ), sendMessage (IncMasterN 1))
  157.  
  158. -- Deincrement the number of windows in the master area
  159. , ((modm , xK_period), sendMessage (IncMasterN (-1)))
  160.  
  161. -- Toggle the status bar gap
  162. -- Use this binding with avoidStruts from Hooks.ManageDocks.
  163. -- See also the statusBar function from Hooks.DynamicLog.
  164. --
  165.  
  166. -- Quit xmonad
  167. , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
  168.  
  169. -- Restart xmonad
  170. , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
  171. ]
  172. ++
  173.  
  174. --
  175. -- mod-[1..9], Switch to workspace N
  176. -- mod-shift-[1..9], Move client to workspace N
  177. --
  178. [((m .|. modm, k), windows $ f i)
  179. | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  180. , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  181.  
  182. ------------------------------------------------------------------------
  183. -- Mouse bindings: default actions bound to mouse events
  184. --
  185. myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
  186.  
  187. -- mod-button1, Set the window to floating mode and move by dragging
  188. [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
  189. >> windows W.shiftMaster))
  190.  
  191. -- mod-button2, Raise the window to the top of the stack
  192. , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
  193.  
  194. -- mod-button3, Set the window to floating mode and resize by dragging
  195. , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
  196. >> windows W.shiftMaster))
  197.  
  198. -- you may also bind events to the mouse scroll wheel (button4 and button5)
  199. ]
Add Comment
Please, Sign In to add comment