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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
{-
Docs:
- EZConfig: https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Util-EZConfig.html#g:3
- Media keys: https://hackage.haskell.org/package/X11-1.9/docs/Graphics-X11-ExtraTypes-XF86.html
- Audio control: https://xmonadhaskell.wordpress.com/2018/10/24/xmonad-audio-control/
- XMonad API: https://hackage.haskell.org/package/xmonad
- Contrib API: https://hackage.haskell.org/package/xmonad-contrib
-}
import XMonad
import XMonad.Config
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ManageDocks
import XMonad.Layout.Spiral
import XMonad.Util.CustomKeys (customKeys)
import XMonad.Actions.CopyWindow
import XMonad.Util.EZConfig (additionalKeys)
import Graphics.X11.ExtraTypes.XF86
delKeys conf@(XConfig {modMask = modMask}) = []
nixBin = "/home/ben/.nix-profile/bin/"
insKeys :: XConfig l -> [((KeyMask, KeySym), X ())]
insKeys conf@(XConfig {modMask = modMask}) =
[ ((modMask, xK_y), spawn $ nixBin <> "passmenu")
-- neither of these work:
, ((modMask, xK_u), spawn $ nixBin <> "rofi -sidebar-mode -show window")
, ((modMask, xK_i), spawn $ "rofi -sidebar-mode -show run")
, ((modMask, xK_o), spawn $ nixBin <> "dmenu_run")
, ((modMask, xK_e), spawn "emacsclient -c")
-- sticky windows
, ((modMask, xK_a ), windows copyToAll) -- @@ Make focused window always visible
, ((modMask .|. shiftMask, xK_a ), killAllOtherCopies) -- @@ Toggle window state back
-- media/ function keys
-- backlight
, ((0, xK_F5), spawn "xbacklight -dec 5")
, ((0, xK_F6), spawn "xbacklight -inc 5")
, ((0, xF86XK_KbdBrightnessDown), spawn "xbacklight -dec 5")
, ((0, xF86XK_KbdBrightnessUp), spawn "xbacklight -inc 5")
-- volume controls
, ((0, xK_F1), amixer "2%+")
, ((0, xK_F2), amixer "2%-")
, ((0, xK_F3), amixer "toggle")
, ((0, xF86XK_AudioLowerVolume), amixer "2%+")
, ((0, xF86XK_AudioRaiseVolume), amixer "2%-")
, ((0, xF86XK_AudioMute), amixer "toggle")
]
amixer :: String -> X ()
amixer cmd = spawn $ "amixer -q sset Master " <> cmd
myLayout = spiral (6 / 7)
myWorkspaces = ["1:mail", "2:org", "3:web"] ++ map show [4 .. 9] ++ ["0"]
myConf = additionalKeys c (insKeys c)
where c = def
{ modMask = mod4Mask -- ^ super instead of alt
, normalBorderColor = "#eee8d4" -- ^ solarized base3
, focusedBorderColor = "#2aa198" -- ^ solarized cyan
, manageHook = manageDocks <+> manageHook def
, layoutHook = avoidStruts $ myLayout ||| layoutHook def
, terminal = "/home/ben/.nix-profile/bin/xterm"
, workspaces = myWorkspaces
--, keys = customKeys delKeys insKeys
}
main = xmonad $ ewmh $ docks $ myConf
|