Guest User

Untitled

a guest
Jul 10th, 2022
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.09 KB | None | 0 0
  1. import System.Exit
  2.  
  3. import XMonad.Actions.CycleWS
  4. import XMonad.Actions.NoBorders
  5.  
  6. import XMonad.Hooks.ManageDocks -- Toggle struts
  7. import XMonad.Hooks.DynamicLog -- xmobar
  8. import XMonad.Hooks.SetWMName
  9. import XMonad.Hooks.ICCCMFocus -- takeTopFocus
  10. import XMonad.Hooks.ManageHelpers
  11. import XMonad.Hooks.EwmhDesktops -- Needed for rescuetime
  12. import XMonad.Hooks.DynamicProperty -- zoom
  13.  
  14. import XMonad.Util.Themes
  15. import XMonad.Util.Run
  16.  
  17. import XMonad.Layout.SubLayouts -- Sublayout: pullGroup, MergeAll, UnMerge
  18. import XMonad.Layout.PerWorkspace
  19. import XMonad.Layout.TwoPane
  20. import XMonad.Layout.Combo
  21. import XMonad.Layout.Spiral
  22. import XMonad.Layout.IM
  23. import XMonad.Layout.Grid
  24. import XMonad.Layout.Reflect
  25. import XMonad.Layout.SimpleDecoration
  26. import XMonad.Layout.NoBorders
  27. import XMonad.Layout.ResizableTile
  28. import XMonad.Layout.Circle
  29. import XMonad.Layout.LayoutScreens
  30. import XMonad.Layout.WindowNavigation
  31. import XMonad.Layout.ThreeColumns
  32. import XMonad.Layout.Named
  33. import XMonad.Layout.MouseResizableTile
  34.  
  35. import XMonad hiding ( (|||) ) -- don't use the normal ||| operator
  36. import XMonad.Layout hiding ( (|||) )
  37. import XMonad.Layout.LayoutCombinators -- use the one from LayoutCombinators instead
  38. import XMonad.Util.EZConfig -- add keybindings easily
  39.  
  40. import Data.List -- for `isSuffixOf`
  41.  
  42. import Foreign.C.Types (CLong) -- checkAtom
  43.  
  44. import qualified XMonad.StackSet as W
  45. import qualified Data.Map as M
  46.  
  47.  
  48. ------------------------------------------------------------------------
  49. -- Helper Functions
  50. --
  51.  
  52. checkDialog :: Query Bool
  53. checkDialog = checkAtom "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_DIALOG"
  54.  
  55. checkAbove :: Query Bool
  56. checkAbove = checkAtom "_NET_WM_STATE" "_NET_WM_STATE_ABOVE"
  57.  
  58. checkAtom :: String -> String -> Query Bool
  59. checkAtom name value = ask >>= \w -> liftX $ do
  60. a <- getAtom name
  61. val <- getAtom value
  62. mbr <- getProp w a
  63. case mbr of
  64. Just [r] -> return $ elem (fromIntegral r) [val]
  65. _ -> return False
  66.  
  67. -- | Helper to read a property
  68. getProp :: Window -> Atom -> X (Maybe [CLong])
  69. getProp w a = withDisplay $ \dpy -> io $ getWindowProperty32 dpy a w
  70.  
  71.  
  72. ------------------------------------------------------------------------
  73.  
  74. -- Window Placement
  75. --
  76.  
  77. -- xprop
  78. myManageHook :: [ManageHook]
  79. myManageHook =
  80. [ resource =? "Do" --> doIgnore
  81. , className =? "/usr/lib/gnome-do/Do.exe" --> doIgnore
  82. , className =? "Synapse" --> doIgnore
  83. , isFullscreen --> doFullFloat
  84. , className =? "Audacious" --> doFloat
  85. , className =? "Pandora" --> doIgnore
  86. , className =? "Evolution-alarm-notify" --> doFloat
  87. , className =? "Xfce4-notifyd" --> doIgnore
  88. , className =? "Galculator" --> doFloat
  89. , className =? "Gnome-panel" --> doFloat
  90. , className =? "Gnome-typing-monitor" --> doIgnore
  91. , className =? "Ggl-gtk" --> doFloat
  92. , className =? "Gnome-display-properties" --> doFloat
  93. , className =? "Gnome-appearance-properties" --> doFloat
  94. , (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
  95. , (className =? "Pidgin" <&&> role =? "log_viewer") --> doFloat
  96. , (className =? "Pidgin" <&&> role =? "accounts") --> doFloat
  97. , className =? "Update-manager" --> doFloat
  98. , role =? "bubble" --> doIgnore
  99. , className =? "Ediff" --> doFloat
  100. , title =? "Ediff" --> doFloat
  101. , className =? "knotes" --> doFloat
  102. , className =? "rdesktop" --> doSideFloat SC
  103. , resource =? "desktop_window" --> doIgnore
  104. , resource =? "kdesktop" --> doIgnore
  105. , resource =? "stalonetray" --> doIgnore
  106. , resource =? "Kupfer.py" --> doIgnore
  107. , className =? "xine" --> doFloat
  108. , className =? "gksudo" --> doFloat
  109. , className =? "gksu" --> doFloat
  110. , className =? "Nm-connection-editor" --> doFloat
  111. , className =? "Lxrandr" --> doFloat
  112. , className =? "Xfce4-display-settings" --> doFloat
  113. , className =? "Wine" --> doFloat
  114. , className =? "Skype" --> doFloat
  115. , className =? "XCalc" --> doFloat
  116. , className =? "Gnome-calculator" --> doFloat
  117. , className =? "Qasmixer" --> doFloat
  118. , className =? "Pavucontrol" --> doFloat
  119. , className =? "Shutter" --> doFloat
  120. , title =? "Print" --> doFloat
  121. , title =? "Google+ Hangouts is sharing your screen with plus.google.com." --> doIgnore
  122. , title =? "LastPass" --> doFloat
  123. , title =? "Confirm Navigation" --> doFloat
  124. , className =? "Blueman-manager" --> doFloat
  125. , title =? "Task Manager - Google Chrome" --> doFloat
  126. , title =? "Google Hangouts is sharing a window with hangouts.google.com." --> doFloat
  127. , title =? "Scid: Header Search" --> doFloat
  128. , title =? "Variations" --> doFloat
  129. , className =? "Dunst" --> doIgnore
  130. , className =? "Nm-openconnect-auth-dialog" --> doFloat
  131. , checkAbove --> doFloat
  132.  
  133. -- Move windows to the right space.
  134. -- web
  135. , className =? "Google-chrome" --> doShift "web"
  136. , className =? "Google-chrome-beta" --> doShift "web"
  137. , className =? "Chromium-browser" --> doShift "web"
  138. , className =? "Opera" --> doShift "web"
  139. , className =? "Opera beta" --> doShift "web"
  140. , className =? "Navigator" --> doShift "web"
  141. , className =? "Pidgin" --> doShift "web"
  142. , className =? "Firefox" --> doShift "web"
  143. , className =? "Brave-browser" --> doShift "web"
  144. , role =? "music.google.com__music_listen" --> doShift "music"
  145. , role =? "www.pandora.com" --> doShift "music"
  146. , role =? "turntable.fm__4e1c691a14169c7aec00ae5f" --> doShift "music"
  147. -- dev
  148. , className =? "Eclipse" --> doShift "dev"
  149. , className =? "SpringSource Tool Suite" --> doShift "dev"
  150. , className =? "xmind zen" --> doShift "dev"
  151. -- emacs
  152. , className =? "Emacs" --> doShift "emacs"
  153. , className =? "Emacs24" --> doShift "emacs"
  154. , className =? "Lotion" --> doShift "emacs"
  155. , className =? "Remember The Milk" --> doShift "emacs"
  156. -- music
  157. , className =? "Spotify" --> doShift "music"
  158. , className =? "spotify" --> doShift "music"
  159. , title =? "spotify" --> doShift "music"
  160. -- gimp
  161. , className =? "Gimp" --> doShift "draw"
  162. , (className =? "Gimp" <&&> fmap ("tool" `isSuffixOf`) role) --> doFloat
  163. , role =? "gimp-preferences" --> doFloat
  164. , role =? "gimp-toolbox-color-dialog" --> doFloat
  165. , role =? "gimp-layer-new" --> doFloat
  166. --, role =? "gimp-color-selection" --> doFloat
  167. --, title =? "Cinelerra: Load" --> doFloat
  168. --, title =? "Layer Attributes" --> doFloat
  169. --, stringProperty "WM_WINDOW_ROLE" =? "presentationWidget" --> doFloat
  170. -- Luminance
  171. , className =? "Luminance-hdr" --> doShift "draw"
  172. -- Dia
  173. , className =? "Dia" --> doShift "draw"
  174. -- Inkscape
  175. , className =? "Inkscape" --> doShift "draw"
  176. -- msg
  177. , className =? "Xchat" --> doShift "msg"
  178. , className =? "Smuxi-frontend-gnome" --> doShift "msg"
  179. , className =? "HipChat" --> doShift "msg"
  180. , className =? "Scudcloud" --> doShift "msg"
  181. , className =? "Slack" --> doShift "msg"
  182. , className =? "Franz" --> doShift "msg"
  183. , className =? "Station" --> doShift "msg"
  184. , className =? "whatsdesk" --> doShift "msg"
  185. -- movies
  186. --, className =? "[vlc" --> doShift "movies"
  187. --, className =? "vlc" --> doFloat
  188. --, className =? "MPlayer" --> doShift "movies"
  189. --, className =? "gnome-mplayer" --> doShift "movies"
  190. --, className =? "Totem" --> doShift "movies"
  191. --, className =? "Gxine" --> doShift "movies"
  192. -- IntelliJ
  193. , className =? "jetbrains-idea-ce" --> doShift "dev"
  194. , className =? "jetbrains-idea" --> doShift "dev"
  195. , className =? "jetbrains-pycharm" --> doShift "dev"
  196. , className =? "jetbrains-pycharm-ce" --> doShift "dev"
  197. , className =? "jetbrains-studio" --> doShift "dev"
  198. , className =? "TeamViewer.exe" --> doShift "dev"
  199. ]
  200. where role = stringProperty "WM_WINDOW_ROLE"
  201. unfloat = ask >>= doF . W.sink
  202.  
  203.  
  204.  
  205.  
  206. -- _NET_WM_DESKTOP(CARDINAL) = 0
  207. -- WM_STATE(WM_STATE):
  208. -- window state: Normal
  209. -- icon window: 0x0
  210. -- _NET_WM_USER_TIME(CARDINAL) = 147591807
  211. -- _NET_WM_STATE(ATOM) = _NET_WM_STATE_ABOVE, _NET_WM_STATE_STAYS_ON_TOP
  212. -- _NET_WM_ICON(CARDINAL) = Icon (64 x 64):
  213. -- _NET_WM_WINDOW_OPACITY(CARDINAL) = 4294967295
  214. -- XdndAware(ATOM) = BITMAP
  215. -- WM_NAME(STRING) =
  216. -- _NET_WM_NAME(UTF8_STRING) = "zoom"
  217. -- _MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x1, 0x0, 0x0, 0x0
  218. -- _NET_WM_WINDOW_TYPE(ATOM) = _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _NET_WM_WINDOW_TYPE_NORMAL
  219. -- _XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
  220. -- WM_CLIENT_LEADER(WINDOW): window id # 0x2c0000d
  221. -- WM_HINTS(WM_HINTS):
  222. -- Client accepts input or input focus: True
  223. -- Initial state is Normal State.
  224. -- _NET_WM_PID(CARDINAL) = 837372
  225. -- _NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 46563144
  226. -- WM_CLASS(STRING) = "zoom", "zoom"
  227. -- WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
  228. -- WM_NORMAL_HINTS(WM_SIZE_HINTS):
  229. -- user specified location: 3065, 40
  230. -- user specified size: 355 by 71
  231. -- program specified minimum size: 355 by 0
  232. -- program specified maximum size: 355 by 16383
  233. -- window gravity: Static
  234. --
  235.  
  236.  
  237. ------------------------------------------------------------------------
  238. -- Colors
  239. --
  240. myActiveTitleColor = "#D68B00" -- Orange (lt)
  241. myInactiveTitleColor = "#282828" -- Dark grey
  242. --myActiveBorderColor = "#EE9A00" -- Orange
  243. --myActiveBorderColor = "#FF6600" -- Dark orange
  244. myActiveBorderColor = "#D3003E" -- Dark red
  245. --myActiveBorderColor = "#B70036" -- Dark dark red
  246. myInactiveBorderColor = "#323232" -- Dark grey
  247. myActiveTextColor = "black"
  248. myInactiveTextColor = "grey"
  249. --myXmobarColor = "#A8FC46" -- Green
  250. myXmobarColor = "#F0E729" -- Yellow
  251.  
  252. ------------------------------------------------------------------------
  253. -- Window Title
  254. --
  255. newTheme :: ThemeInfo
  256. newTheme = TI "" "" "" defaultTheme
  257. myTheme :: ThemeInfo
  258. myTheme =
  259. newTheme { themeName = "myTheme"
  260. , themeAuthor = "My Self"
  261. , themeDescription = "My Theme"
  262. , theme = defaultTheme { activeColor = myActiveTitleColor
  263. , inactiveColor = myInactiveTitleColor
  264. , activeBorderColor = myActiveBorderColor
  265. , inactiveBorderColor = myInactiveBorderColor
  266. , activeTextColor = myActiveTextColor
  267. , inactiveTextColor = myInactiveTextColor
  268. --, fontName = "-*-lucidatypewriter-bold-*-*-*-12-*-*-*-*-*-*-*"
  269. , fontName = "-*-consolas-bold-*-*-*-12-*-*-*-*-*-*-*"
  270. , decoHeight = 12
  271. , decoWidth = 3000
  272. }
  273. }
  274.  
  275. ------------------------------------------------------------------------
  276. -- Layout
  277. --
  278. myLayout = named "tiled" tiled ||| mtiled ||| vtiled ||| named "three" (three) ||| Grid ||| named "mouse" mouse ||| Full
  279. where
  280. -- default tiling algorithm partitions the screen into two panes
  281. tiled = withIM (12/100) (ClassName "Pidgin") $ withIM (13/100) (ClassName "Pidgin") $ withIM (14/100) (ClassName "Pidgin") $ Tall nmaster delta ratio
  282. mtiled = withIM (12/100) (ClassName "Pidgin") $ withIM (13/100) (ClassName "Pidgin") $ withIM (14/100) (ClassName "Pidgin") $ reflectHoriz $ Tall nmaster delta ratio
  283. vtiled = withIM (12/100) (ClassName "Pidgin") $ withIM (13/100) (ClassName "Pidgin") $ withIM (14/100) (ClassName "Pidgin") $ Mirror $ Tall nmaster delta ratio
  284. mouse = mouseResizableTile
  285. three = ThreeColMid 1 (3/100) (1/3)
  286.  
  287. -- The default number of windows in the master pane
  288. nmaster = 1
  289. -- Percent of screen to increment by when resizing panes
  290. delta = 3/100
  291. -- Default proportion of screen occupied by master pane
  292. ratio = 1/2
  293.  
  294. ------------------------------------------------------------------------
  295. -- Key bindings
  296. --
  297.  
  298. -- Used to flip the right and left workspaces in a mutihead display.
  299. withOtherWorkspace f ws = f (otherWorkspace ws) ws
  300. where
  301. otherWorkspace = W.tag . W.workspace . head . W.visible
  302.  
  303. myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
  304.  
  305.  
  306. -- launch a terminal
  307. [ ((modMask .|. controlMask, xK_Return), spawn $ XMonad.terminal conf)
  308. , ((modMask .|. shiftMask, xK_Return), spawn "$HOME/bin/cool-retro-term")
  309.  
  310. -- Launch dmenu
  311. --, ((0, xK_F3 ), spawn "exec `dmenu_path | dmenu -i -b -nb black -nf grey -sb '#444' -sf '#EE9A00'`")
  312. --, ((0, xK_F3 ), spawn "dmenu-do")
  313. --, ((0, xK_F3 ), spawn "bash -c 'dmenu_do -i -b -fn Consolas-10:bold -nb black -nf grey -sb \"#444\" -sf \"#EE9A00\"'")
  314. --, ((0, xK_F3 ), spawn "dmenu_do -i -b -fn 'Consolas-10' -nb black -nf grey -sb '#444' -sf '#EE9A00'")
  315. --, ((0, xK_F3 ), spawn "dmenu_do -i -b -fn 'Anvylon-12' -nb black -nf grey -sb '#444' -sf '#F0E729'")
  316. --, ((0, xK_F3 ), spawn "dmenu_do -i -b -fn 'Anvylon-12' -nb '#0D120F' -nf 'grey' -sb '#444' -sf '#F0E729'")
  317. , ((0, xK_F3 ), spawn "dmenu_do -i -b -fn 'Anvylon-12' -nb '#131B16' -nf 'grey' -sb '#444' -sf '#F0E729'")
  318.  
  319. -- close focused window
  320. , ((modMask, xK_r ), kill)
  321.  
  322. -- Rotate through the available layout algorithms
  323. , ((modMask, xK_l ), sendMessage NextLayout)
  324.  
  325. -- Show layout name
  326. -- #, ((modMask, xK_a ), sendMessage NextLayout >> (curLayout >>= \d->spawn $"xmessage "++d))
  327.  
  328. -- Reset the layouts on the current workspace to default
  329. , ((modMask, xK_h ), setLayout $ XMonad.layoutHook conf)
  330.  
  331. -- Set explicit layout keys (get names from M-a pop-up)
  332. , ((controlMask, xK_1 ), sendMessage $ JumpToLayout "tiled")
  333. , ((controlMask, xK_2 ), sendMessage $ JumpToLayout "three")
  334. , ((controlMask, xK_3 ), sendMessage $ JumpToLayout "Full")
  335. , ((controlMask, xK_4 ), sendMessage $ JumpToLayout "Grid")
  336. , ((controlMask, xK_5 ), sendMessage $ JumpToLayout "mouse")
  337. --, ((controlMask, xK_F1 ), sendMessage $ JumpToLayout "tiled")
  338. --, ((controlMask, xK_F2 ), sendMessage $ JumpToLayout "three")
  339. --, ((controlMask, xK_F3 ), sendMessage $ JumpToLayout "Full")
  340. --, ((controlMask, xK_F4 ), sendMessage $ JumpToLayout "Grid")
  341.  
  342.  
  343. -- Float window across screen
  344. --, ((modMask .|. shiftMask, xK_f), layoutScreens 1 (fixedLayout [Rectangle 0 0 3760 1600]))
  345. --, ((modMask .|. controlMask, xK_f), rescreen)
  346.  
  347. -- Move focus to the next window
  348. , ((modMask, xK_k ), windows W.focusDown)
  349.  
  350. -- Move focus to the previous window
  351. , ((modMask, xK_j ), windows W.focusUp)
  352.  
  353. -- Move focus to the master window
  354. --; , ((modMask, xK_m ), windows W.focusMaster)
  355.  
  356. -- Swap the focused window and the master window
  357. , ((controlMask .|. shiftMask, xK_m ), windows W.swapMaster)
  358.  
  359. -- Swap the focused window with the next window
  360. , ((controlMask .|. shiftMask, xK_k ), windows W.swapDown)
  361.  
  362. -- Swap the focused window with the previous window
  363. , ((controlMask .|. shiftMask, xK_j ), windows W.swapUp)
  364.  
  365. -- Shrink the master area
  366. , ((controlMask .|. shiftMask, xK_h ), sendMessage Shrink)
  367.  
  368. -- Expand the master area
  369. , ((controlMask .|. shiftMask, xK_l ), sendMessage Expand)
  370.  
  371. -- Shrink the slave area
  372. , ((modMask .|. controlMask, xK_h ), sendMessage ShrinkSlave)
  373.  
  374. -- Expand the slave area
  375. , ((modMask .|. controlMask, xK_l ), sendMessage ExpandSlave)
  376.  
  377.  
  378. -- Push window back into tiling and out of float
  379. , ((modMask .|. shiftMask, xK_t ), withFocused $ windows . W.sink)
  380.  
  381. -- Increment the number of windows in the master area
  382. --, ((controlMask .|. shiftMask, xK_comma), sendMessage (IncMasterN 1))
  383.  
  384. -- Deincrement the number of windows in the master area
  385. --, ((controlMask .|. shiftMask, xK_period), sendMessage (IncMasterN (-1)))
  386.  
  387. -- Move windows in sub tabbed layout
  388. -- , ((modMask .|. controlMask, xK_h ), sendMessage $ pullGroup L)
  389. -- , ((modMask .|. controlMask, xK_l ), sendMessage $ pullGroup R)
  390. -- , ((modMask .|. controlMask, xK_k ), sendMessage $ pullGroup U)
  391. -- , ((modMask .|. controlMask, xK_j ), sendMessage $ pullGroup D)
  392.  
  393. -- , ((modMask .|. controlMask, xK_m ), withFocused (sendMessage . MergeAll))
  394. -- , ((modMask .|. controlMask, xK_u ), withFocused (sendMessage . UnMerge))
  395.  
  396. -- , ((modMask .|. controlMask, xK_period), onGroup W.focusUp')
  397. -- , ((modMask .|. controlMask, xK_comma), onGroup W.focusDown')
  398.  
  399. -- Move focus to the next/previous workspaces
  400. , ((modMask, xK_0 ), nextWS)
  401. , ((modMask, xK_9 ), prevWS)
  402. --, ((modMask, xK_F9 ), nextWS)
  403. --, ((modMask, xK_F10 ), prevWS)
  404.  
  405. -- Flip the right and left workspaces in a mutihead display (focus
  406. -- moves with window).
  407. , ((controlMask .|. shiftMask, xK_minus), windows (withOtherWorkspace W.view . withOtherWorkspace W.greedyView))
  408. -- Flip the right and left workspaces in a mutihead display (focus
  409. -- stays on workspace)
  410. , ((modMask, xK_minus ), nextScreen)
  411. --, ((controlMask, xK_minus ), nextScreen)
  412. , ((modMask .|. shiftMask, xK_minus ), shiftNextScreen)
  413.  
  414. -- Move xmobar to other monitor
  415. , ((modMask .|. controlMask, xK_minus ), spawn "killall -s SIGUSR1 xmobar")
  416.  
  417. -- toggle the status bar gap
  418. --, ((controlMask .|. shiftMask, xK_b ), sendMessage ToggleStruts)
  419.  
  420. -- Toggle borders
  421. , ((modMask .|. shiftMask, xK_b ), withFocused toggleBorder)
  422.  
  423. -- Quit xmonad
  424. --, ((controlMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
  425.  
  426. -- Restart xmonad
  427. , ((modMask .|. shiftMask, xK_q ), spawn "xmonad --recompile; xmonad --restart")
  428.  
  429. -- Shutdown
  430. --, ((modMask .|. controlMask, xK_q ), spawn "shutdown")
  431.  
  432. -- Suspend
  433. --, ((modMask .|. controlMask, xK_q ), spawn "sudo pm-suspend")
  434.  
  435. -- Resize viewed windows to the correct size
  436. , ((controlMask .|. shiftMask, xK_r ), refresh)
  437.  
  438. -- Autodetect screen
  439. , ((modMask .|. shiftMask, xK_d ), spawn "$HOME/bin/autodetect")
  440.  
  441. -- Autodetect screen
  442. , ((controlMask .|. shiftMask, xK_d ), spawn "$HOME/bin/autodetect -f")
  443.  
  444. -- Show display configuration app
  445. , ((modMask .|. controlMask, xK_d ), spawn "lxrandr")
  446.  
  447. -- Show volume control app
  448. , ((modMask .|. shiftMask, xK_v ), spawn "pavucontrol")
  449.  
  450. -- Activate screensaver
  451. --, ((modMask .|. controlMask, xK_i ), spawn "gnome-screensaver-command --lock")
  452. , ((modMask .|. controlMask, xK_i ), spawn "xscreensaver-command -lock")
  453. --, ((modMask .|. controlMask, xK_i ), spawn "$HOME/bin/blank-screen")
  454.  
  455. -- Screenshot
  456. --, ((0, xK_Print), spawn "scrot -u -e 'mv $f ~/screenshots/' && xkbbell") -- active window
  457. , ((0, xK_Print), spawn "flameshot gui") -- select screenshot
  458. , ((controlMask, xK_Print), spawn "scrot -e 'mv $f ~/screenshots/' && xkbbell") -- entire workspace
  459. , ((controlMask .|. shiftMask, xK_Print), spawn "scrot -s -d 1 -e 'mv $f ~/screenshots/' && xkbbell") -- sleep first
  460.  
  461. --, ((0, xK_Print), spawn "shutter") -- dialog
  462. --, ((controlMask .|. shiftMask, xK_Print), spawn "shutter -f") -- entire workspace
  463. --, ((controlMask, xK_Print), spawn "sleep 0.2; shutter -a") -- active window; sleep first
  464.  
  465. -- Aqualung
  466. --, ((modMask .|. controlMask, xK_p ), spawn "aqualung -U")
  467. --, ((modMask .|. controlMask, xK_n ), spawn "aqualung -F")
  468.  
  469. -- Multimedia keys
  470. -- XF86AudioLowerVolume
  471. , ((0, 0x1008ff11), spawn "amixer -q sset Master 5%-")
  472. , ((modMask, xK_F10 ), spawn "amixer -q sset Master 5%-")
  473. -- XF86AudioRaiseVolume
  474. , ((0, 0x1008ff13), spawn "amixer -q sset Master 5%+")
  475. , ((modMask, xK_F11 ), spawn "amixer -q sset Master 5%+")
  476. -- XF86AudioMute
  477. --, ((0, 0x1008ff12), spawn "amixer -q sset Master toggle")
  478. --, ((controlMask, xK_F9 ), spawn "amixer -q sset Master toggle")
  479. -- XF86Launch1
  480. --, ((0, 0x1008ff41), spawn "amixer -q sset Master 0%")
  481.  
  482. -- Monitor brightness (dim display)
  483. , ((controlMask, xK_F10 ), spawn "xbacklight -dec 10")
  484. , ((controlMask, xK_F11 ), spawn "xbacklight -inc 10")
  485. ]
  486.  
  487. ++
  488. --
  489. -- mod-[1..9], Switch to workspace N
  490. -- mod-shift-[1..9], Move client to workspace N
  491. --
  492. --[((m .|. modMask, k), windows $ f i)
  493. -- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_8]
  494. -- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  495.  
  496. -- modMask .|. shiftMask, [xK_1 .. xK_8]
  497. [((m .|. modMask, k), windows $ f i)
  498. | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_8]
  499. , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  500. --[((m .|. modMask, k), windows $ f i)
  501. -- | (i, k) <- zip (XMonad.workspaces conf) [xK_F1 .. xK_F8]
  502. -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  503.  
  504. -- ++
  505. --
  506. -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  507. -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  508. --
  509. --[((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
  510. -- | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  511. -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  512. --[((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
  513. -- | (key, sc) <- zip [xK_u, xK_i] [0..]
  514. -- , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  515.  
  516. ------------------------------------------------------------------------
  517. -- Mouse bindings: default actions bound to mouse events
  518. --
  519. myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
  520.  
  521. -- mod-button1, Set the window to floating mode and move by dragging
  522. [ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
  523.  
  524. -- mod-button2, Raise the window to the top of the stack
  525. , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
  526.  
  527. -- mod-button3, Set the window to floating mode and resize by dragging
  528. , ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
  529. , ((modMask .|. shiftMask, button1), (\w -> focus w >> mouseResizeWindow w))
  530.  
  531. -- you may also bind events to the mouse scroll wheel (button4 and button5)
  532. ]
  533.  
  534. ------------------------------------------------------------------------
  535. -- Xmobar
  536. --
  537.  
  538. -- Command to launch the bar.
  539. myBar = "xmobar"
  540.  
  541. -- Custom PP, configure it as you like. It determines what is being written to the bar.
  542. myXmobarPP = xmobarPP { ppTitle = xmobarColor myXmobarColor "" . shorten 200
  543. , ppOrder = \(ws:_:t:_) -> [ws, t]
  544. }
  545.  
  546. -- Key binding to toggle the gap for the bar.
  547.  
  548. toggleStrutsKey XConfig {XMonad.modMask = modMask} = (controlMask .|. shiftMask, xK_b)
  549.  
  550. -- Main configuration, override the defaults to your liking.
  551. myConfig = ewmh defaultConfig
  552. { modMask = mod1Mask
  553. , keys = myKeys
  554. , mouseBindings = myMouseBindings
  555. , manageHook = manageDocks <+> composeAll myManageHook
  556. , startupHook = takeTopFocus >> setWMName "LG3D"
  557. , layoutHook = myLayout
  558. , terminal = "urxvt -e $HOME/etc/tmux/init"
  559. --, terminal = "urxvt"
  560. , workspaces = ["web", "emacs", "dev", "music", "msg", "draw", "log", "movies"]
  561. , focusedBorderColor = myActiveBorderColor
  562. , normalBorderColor = myInactiveBorderColor
  563. , borderWidth = 3
  564. }
  565.  
  566. ------------------------------------------------------------------------
  567. -- main
  568. --
  569. main = xmonad =<< statusBar myBar myXmobarPP toggleStrutsKey myConfig
  570.  
Add Comment
Please, Sign In to add comment