-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmonad.hs
63 lines (55 loc) · 2.36 KB
/
xmonad.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{-
Inspired by (read: shamelessly copied from):
* https://hackage.haskell.org/package/xmonad-contrib-bluetilebranch-0.9.1.4/docs/XMonad-Hooks-DynamicLog.html
* https://gist.github.com/Soft/763129
-}
import XMonad
import XMonad.Config.Desktop
import XMonad.Hooks.DynamicLog (statusBar, xmobarPP, xmobarColor, ppCurrent, ppOutput, defaultPP, dynamicLogWithPP, wrap, ppVisible, ppTitle, ppLayout, shorten)
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.Themes
import XMonad.Util.EZConfig(additionalKeys, additionalKeysP)
import System.IO
import Graphics.X11.ExtraTypes.XF86
-- The main function.
main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig
-- Command to launch the bar.
myBar = "xmobar"
-- Custom PP, configure it as you like. It determines what is being written to the bar.
myPP = xmobarPP
{ ppCurrent = currentStyle
, ppVisible = visibleStyle
, ppTitle = titleStyle
, ppLayout = (\layout -> case layout of
"Tall" -> "[|]"
"Mirror Tall" -> "[-]"
"ThreeCol" -> "[||]"
"Tabbed" -> "[_]"
"Gimp" -> "[@]"
)
}
where
currentStyle = xmobarColor "#ee9a00" "" . wrap "[" "]"
visibleStyle = wrap "(" ")"
titleStyle = xmobarColor "cyan" "" . shorten 100 . filterCurly
filterCurly = filter (not . isCurly)
isCurly x = x == '{' || x == '}'
-- Key binding to toggle the gap for the bar.
toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
-- Custom key bindings
myKeys = [ ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +1.5%")
, ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -1.5%")
, ("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle")
, ("<XF86AudioPlay>", spawn "playerctl play-pause")
, ("<XF86AudioPrev>", spawn "playerctl previous")
, ("<XF86AudioNext>", spawn "playerctl next")
, ("<XF86MonBrightnessUp>", spawn "lux -a 5%")
, ("<XF86MonBrightnessDown>", spawn "lux -s 5%")
]
-- Main configuration, override the defaults to your liking.
myConfig = def { modMask = mod4Mask
, borderWidth = 2
, normalBorderColor = "#000000"
, focusedBorderColor = "#ee9a00"
} `additionalKeysP` myKeys