Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
8.0 KiB

13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
  1. -- This is my xmonad configuration. Take it as read that I do not know what I
  2. -- am doing in this file. It is pure magpie behavior with little underlying
  3. -- logic. I do not know Haskell.
  4. -- Some sources:
  5. -- Things I have bookmarked: https://pinboard.in/search/u:brennen?query=xmonad
  6. -- Tyler Cipriani's setup: https://github.com/thcipriani/dotfiles/blob/master/xmonad/xmonad.hs
  7. -- Ben LeMasurier's setup: https://github.com/benlemasurier/ben/blob/master/.xmonad/xmonad.hs
  8. -- http://haskell.org/haskellwiki/Xmonad/Config_archive/John_Goerzen%27s_Configuration
  9. -- http://www.xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Doc-Configuring.html
  10. -- http://hackage.haskell.org/packages/archive/xmonad-contrib/0.8.1/doc/html/XMonad-Doc-Extending.html
  11. -- http://hackage.haskell.org/packages/archive/xmonad-contrib/0.8.1/doc/html/XMonad-Actions-CycleWS.html
  12. -- http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-GridSelect.html
  13. import XMonad
  14. import XMonad.Actions.CycleWS
  15. import XMonad.Actions.GridSelect
  16. import XMonad.Hooks.DynamicLog
  17. import XMonad.Hooks.EwmhDesktops
  18. import XMonad.Hooks.ManageDocks
  19. import XMonad.Hooks.ManageHelpers(isFullscreen, isDialog, doFullFloat, doCenterFloat)
  20. import XMonad.Layout.Accordion
  21. import XMonad.Layout.Fullscreen
  22. import XMonad.Layout.Grid
  23. import XMonad.Layout.NoBorders
  24. import XMonad.Layout.ResizableTile
  25. import XMonad.Layout.Spacing
  26. import XMonad.Layout.Tabbed
  27. import XMonad.Layout.ThreeColumns
  28. import XMonad.Layout.ToggleLayouts
  29. import XMonad.Util.EZConfig(additionalKeysP) -- Easier keybindings
  30. import XMonad.Util.NamedScratchpad
  31. import XMonad.Util.NamedWindows
  32. import XMonad.Util.Run(hPutStrLn)
  33. import XMonad.Util.Run(runInTerm) -- Need this guy for keybindings to external commands
  34. import XMonad.Util.Run(spawnPipe) -- Need this guy for talking to xmobar
  35. import XMonad.Util.Run(unsafeSpawn) -- Need this guy for keybindings to external commands
  36. import XMonad.Util.Scratchpad
  37. import qualified XMonad.StackSet as W -- used by the scratchpad stuff below
  38. -- Tomorrow Night Colors:
  39. colorBackground = "#1d1f21"
  40. colorCurrent = "#282a2e"
  41. colorSelection = "#373b41"
  42. colorForeground = "#c5c8c6"
  43. colorComment = "#969896"
  44. colorRed = "#cc6666"
  45. colorOrange = "#de935f"
  46. colorYellow = "#f0c674"
  47. colorGreen = "#b5bd68"
  48. colorAqua = "#8abeb7"
  49. colorBlue = "#81a2be"
  50. colorPurple = "#b294bb"
  51. -- myTerminal = "uxterm"
  52. myTerminal = "konsole"
  53. -- i3lock is a locking mechanism presumably designed originally for i3.
  54. -- It has a nice little input indicator thingy, and with -i can show an
  55. -- image:
  56. myLockScreen = "i3lock -t --image tree_bg.png"
  57. -- rofi is a launcher similar to dmenu, with some neat extra features.
  58. -- It's in Debian - apt-get install rofi
  59. myLauncher = "rofi -show run -font 'mono 14'"
  60. manageScratchPad :: ManageHook
  61. manageScratchPad = scratchpadManageHookDefault
  62. myManageHook = composeAll
  63. [ resource =? "desktop_window" --> doIgnore
  64. , className =? "Gimp" --> doFloat
  65. , className =? "Vncviewer" --> doFloat
  66. , className =? "Nautilus" --> doFloat
  67. , className =? "Svkbd" --> doFloat
  68. , className =? "Google-chrome" --> doShift "web"
  69. , className =? "Firefox" --> doShift "web"
  70. , isFullscreen --> doFullFloat
  71. , namedScratchpadManageHook scratchpads
  72. ]
  73. -- Named scratchpads - a terminal and a tmux session for editing notes in. I
  74. -- use gnome-terminal with a role for both of these instead of uxterm with a
  75. -- title, because title gets changed by running stuff inside of xterms, seemingly
  76. -- no matter how things are configured. See also /bin/notesession.
  77. scratchpads =
  78. [ NS "scratch" "gnome-terminal --role scratch" (role =? "scratch")
  79. -- this goes: start-x, start-y, width (1.0 is full screen), height:
  80. (customFloating $ W.RationalRect 0.0 0.0 1.0 0.5)
  81. , NS "notes" "gnome-terminal --role=notesession -e notesession" (role =? "notesession")
  82. (customFloating $ W.RationalRect 0.3 0.0 0.7 0.95)
  83. ] where role = stringProperty "WM_WINDOW_ROLE"
  84. myTabConfig = def
  85. { inactiveBorderColor = colorBackground
  86. , activeBorderColor = colorGreen
  87. , activeColor = colorCurrent
  88. , inactiveColor = colorBackground
  89. , inactiveTextColor = colorComment
  90. , activeTextColor = colorForeground
  91. , fontName = "xft: Droid Sans 14"
  92. , decoHeight = 25
  93. }
  94. myLayout = avoidStruts
  95. $ toggleLayouts tiledSpace
  96. $ smartBorders
  97. $ basicRotate
  98. where
  99. basicRotate = tabbed shrinkText myTabConfig |||
  100. fullTiled |||
  101. Mirror fullTiled
  102. --- Full |||
  103. -- ||| Grid
  104. -- ||| ThreeColMid 1 (3/100) (1/2)
  105. tiledSpace = spacing 60 $ ResizableTall nmaster delta ratio []
  106. fullTiled = ResizableTall nmaster delta ratio []
  107. -- The default number of windows in the master pane
  108. nmaster = 1
  109. -- Default proportion of screen occupied by master pane
  110. ratio = toRational (2/(1 + sqrt 5 :: Double))
  111. -- Percent of screen to increment by when resizing panes
  112. delta = 5/100
  113. -- A breakdown of desired workspaces:
  114. -- [NSP] - named scratchpads; created implicitly by namedScratchpad stuff
  115. -- - one gnome-terminal
  116. -- - one gnome-terminal with a tmux containing a vim with notes
  117. -- ...plus:
  118. myWorkspaces =
  119. [ "top" -- monitoring, logs, and remote shells
  120. , "mail" -- originally for thunderbird, now a rarely-used spare
  121. , "irc" -- chat clients (weechat, hipchat, slack, signal, etc.)
  122. , "code" -- development and writing
  123. , "browse" -- web browser(s)
  124. , "org" -- a vim with notes file and such
  125. , "media" -- photos, graphics work, video, file managers, etc.
  126. ]
  127. -- ewmh is Extended Window Manager Hints, useful for wmctrl(1):
  128. -- https://en.wikipedia.org/wiki/Extended_Window_Manager_Hints
  129. main = do
  130. config_with_xmobar <- statusBar myBar myPP toggleStrutsKey defaults
  131. xmonad $ ewmh config_with_xmobar {
  132. manageHook = manageDocks <+> myManageHook,
  133. modMask = mod4Mask
  134. }
  135. -- xmobar setup:
  136. -- https://wiki.archlinux.org/index.php/Xmonad#More_configurable
  137. -- https://stackoverflow.com/questions/21218309/how-to-use-dzen-instead-of-xmobar-in-this-unusual-setup#21445159
  138. myBar = "xmobar"
  139. myPP = xmobarPP { ppCurrent = xmobarColor "green" "" . wrap "@" "" . shorten 50 }
  140. toggleStrutsKey XConfig { XMonad.modMask = modMask } = (modMask, xK_b)
  141. defaults = def {
  142. terminal = myTerminal
  143. , borderWidth = 3
  144. , normalBorderColor = colorGreen
  145. , focusedBorderColor = colorBlue
  146. , layoutHook = smartBorders $ myLayout
  147. , manageHook = manageScratchPad <+> myManageHook
  148. , workspaces = myWorkspaces
  149. , handleEventHook = XMonad.Hooks.EwmhDesktops.fullscreenEventHook
  150. } `additionalKeysP`
  151. -- http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-EZConfig.html
  152. [ ("M-<Right>", nextWS)
  153. -- , ("M-s", scratchpadSpawnActionTerminal $ myTerminal)
  154. , ("M-p", spawn myLauncher)
  155. , ("M-S-l", spawn myLockScreen)
  156. , ("M-<Left>", prevWS)
  157. , ("M-S-<Down>", shiftToNext)
  158. , ("M-S-<Up>", shiftToPrev)
  159. , ("M-S-<Right>", shiftNextScreen)
  160. , ("M-S-<Left>", shiftPrevScreen)
  161. , ("M-z", toggleWS)
  162. , ("M-g", goToSelected def)
  163. , ("M-S-g", spawn "jump-to-window")
  164. -- Invert screen colors using https://github.com/zoltanp/xrandr-invert-colors
  165. -- can be helpful for legibility in really bright or dark environments:
  166. , ("M-i", spawn "xrandr-invert-colors")
  167. -- A basic scratchpad, by analogy to the ~ console in Quake:
  168. , ("M-`", namedScratchpadAction scratchpads "scratch")
  169. -- Notes - I am not sure why I can't use mod-n here, but works with mod-shift-n:
  170. , ("M-S-n", namedScratchpadAction scratchpads "notes")
  171. -- Special laptopish media keys
  172. , ("<XF86AudioMute>", spawn "amixer set Master toggle")
  173. , ("<XF86AudioLowerVolume>", spawn "amixer set Master 2%- unmute")
  174. , ("<XF86AudioRaiseVolume>", spawn "amixer set Master 2%+ unmute")
  175. , ("<XF86MonBrightnessDown>", spawn "xbacklight -dec 5")
  176. , ("<XF86MonBrightnessUp>", spawn "xbacklight -inc 5")
  177. ]