Guest User

Untitled

a guest
Apr 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. import XMonad
  2.  
  3. import System.IO
  4.  
  5. import qualified XMonad.StackSet as W
  6.  
  7. import Data.Ratio ((%))
  8.  
  9. import XMonad.Actions.Commands
  10. import XMonad.Hooks.DynamicLog
  11. import XMonad.Hooks.ManageDocks
  12. import XMonad.Hooks.UrgencyHook
  13. import XMonad.Layout.Grid
  14. import XMonad.Layout.IM
  15. import XMonad.Layout.NoBorders
  16. import XMonad.Layout.PerWorkspace
  17. import XMonad.Layout.Reflect
  18. import XMonad.Layout.ToggleLayouts
  19. import XMonad.Util.EZConfig (additionalKeys)
  20. import XMonad.Util.Run(spawnPipe, unsafeSpawn)
  21. import XMonad.Util.Scratchpad
  22.  
  23.  
  24. ------------------------------------------------------------------------
  25. -- workspaces
  26.  
  27. myWorkspaces = ["1:comm","2:dev","3:test","4:remote"] ++ map show [5..9]
  28.  
  29. ------------------------------------------------------------------------
  30. -- keybindings
  31.  
  32. myKeybindings =
  33. [ ((mod1Mask, xK_BackSpace), focusUrgent )
  34. , ((mod1Mask, xK_x ), commands >>= runCommand )
  35. , ((mod1Mask, xK_b ), sendMessage ToggleStruts )
  36. , ((0, 0x1008ff11), unsafeSpawn "amixer -q sset Master 5-" ) -- XF86AudioLowerVolume
  37. , ((0, 0x1008ff12), unsafeSpawn "amixer -q sset Master toggle" ) -- XF86AudioMute
  38. , ((0, 0x1008ff13), unsafeSpawn "amixer -q sset Master 5+" ) -- XF86AudioRaiseVolume
  39. , ((0, xK_Print ), unsafeSpawn "scrot '%Y-%m-%d-%H%M_$wx$h.png' -e 'mv $f ~/screenshots/'")
  40. ]
  41. where commands = defaultCommands
  42.  
  43. ------------------------------------------------------------------------
  44. -- window rules
  45.  
  46. myManageHook = scratchpadManageHookDefault <+>
  47. (composeAll
  48. [ className =? "psi" --> doF (W.shift "1:comm") ] )
  49.  
  50.  
  51. ------------------------------------------------------------------------
  52. -- status bar and logging
  53.  
  54. myPP statusPipe = xmobarPP
  55. { ppOutput = hPutStrLn statusPipe
  56. , ppTitle = xmobarColor "green" "" . shorten 60
  57. , ppUrgent = xmobarColor "red" "" . wrap "!" "!"
  58. }
  59.  
  60. myLogHook = dynamicLogWithPP . myPP
  61.  
  62. ------------------------------------------------------------------------
  63. -- layouts
  64.  
  65. tiled = Tall nmaster delta ratio
  66. where nmaster = 1
  67. ratio = 1/2
  68. delta = 3/100
  69.  
  70. imLayout = avoidStruts $
  71. smartBorders $
  72. reflectHoriz $
  73. -- WM_CLASS(STRING) = "main", "psi"
  74. -- Resource is first string, ClassName is second
  75. withIM (1%12) (And (Resource "main") (ClassName "psi")) (reflectHoriz tiled)
  76. -- withIM (1%12) (Role "psimain") (reflectHoriz tiled)
  77.  
  78. genericLayouts = avoidStruts $
  79. smartBorders $
  80. toggleLayouts (noBorders Full) $
  81. tiled ||| Mirror tiled ||| (noBorders Full) ||| imLayout
  82.  
  83. myLayouts = onWorkspace "1:comm" imLayout $
  84. genericLayouts
  85.  
  86.  
  87. ------------------------------------------------------------------------
  88. -- config itself
  89.  
  90. myConfig statusPipe = defaultConfig
  91. { borderWidth = 2
  92. , focusFollowsMouse = True
  93. , terminal = "urxvt"
  94. , normalBorderColor = "grey" -- "#cccccc"
  95. , focusedBorderColor = "black" -- "#cd8b00"
  96. , manageHook = manageDocks <+> myManageHook
  97. , layoutHook = myLayouts
  98. , logHook = myLogHook statusPipe
  99. , workspaces = myWorkspaces
  100. }
  101.  
  102. main = do
  103. statusPipe <- spawnPipe "xmobar ~/.xmonad/xmobar"
  104. xmonad $
  105. withUrgencyHook NoUrgencyHook $
  106. myConfig statusPipe `additionalKeys` myKeybindings
Add Comment
Please, Sign In to add comment