forked from majnemer/davesdots
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xmonad.hs
82 lines (68 loc) · 2.42 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Actions.CycleWS
import XMonad.Layout.Grid
import XMonad.Layout.Tabbed
import XMonad.Layout.NoBorders(smartBorders)
import XMonad.Layout.ResizableTile
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeysP)
import XMonad.Prompt
import XMonad.Prompt.Shell(shellPrompt)
import XMonad.Prompt.Window
import System.IO(hPutStrLn)
import System.Posix.Unistd(getSystemID, nodeName)
-- Things that should always float
myFloatHook = composeAll
[ className =? "qemu" --> doFloat
, title =? "xfce4-notifyd" --> doIgnore
]
myLayoutHook = tiled ||| Grid ||| simpleTabbed
where
-- default tiling algorithm partitions the screen into two panes
tiled = ResizableTall nmaster delta ratio []
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 1/2
-- Percent of screen to increment by when resizing panes
delta = 3/100
getHostKey :: String -> KeyMask
getHostKey hostname =
if hostname `elem` ["beaujolais", "urbania"] then mod4Mask
else mod1Mask
main = do
host <- fmap nodeName getSystemID -- TODO: make me mighty
xmproc <- spawnPipe "xmobar"
xmonad $ withUrgencyHook NoUrgencyHook defaultConfig
{ manageHook = manageDocks <+> myFloatHook <+> manageHook defaultConfig
, modMask = getHostKey host
, layoutHook = avoidStruts $ smartBorders $ myLayoutHook
, logHook = dynamicLogWithPP $ xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppUrgent = xmobarColor "#FF0000" "" . wrap "**" "**"
, ppTitle = xmobarColor "#8AE234" ""
}
}
`additionalKeysP`
[ ("M-p", shellPrompt defaultXPConfig { position = Top })
, ("M-S-a", windowPromptGoto defaultXPConfig { position = Top })
, ("M-a", windowPromptBring defaultXPConfig { position = Top })
, ("M-S-l", spawn "~/bin/lock")
, ("M-<Left>", moveTo Prev HiddenNonEmptyWS)
, ("M-S-<Left>", shiftToPrev)
, ("M-<Right>", moveTo Next HiddenNonEmptyWS)
, ("M-S-<Right>", shiftToNext)
, ("M-<Up>", windows W.focusUp)
, ("M-S-<Up>", windows W.swapUp)
, ("M-<Down>", windows W.focusDown)
, ("M-S-<Down>", windows W.swapDown)
, ("M-`", toggleWS)
, ("M-s", moveTo Next EmptyWS)
, ("M-S-s", shiftTo Next EmptyWS)
, ("M-[", sendMessage MirrorExpand)
, ("M-]", sendMessage MirrorShrink)
]