-
Notifications
You must be signed in to change notification settings - Fork 6
/
xmonad.hs
145 lines (130 loc) · 6.27 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import qualified Data.Map as M
import XMonad
import XMonad.Actions.CopyWindow
import XMonad.Actions.CycleRecentWS
import XMonad.Actions.DynamicWorkspaceGroups
import XMonad.Actions.GridSelect
import XMonad.Actions.WindowBringer
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Layout.NoBorders
import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import XMonad.Prompt
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig
import XMonad.Util.NamedScratchpad
myWorkspaces = ["1","2","3","4","5","6","7","8","9","0"]
myModKey = mod4Mask
-- Non-numeric num pad keys, sorted by number
numPadKeys = [ xK_KP_End, xK_KP_Down, xK_KP_Page_Down -- 1, 2, 3
, xK_KP_Left, xK_KP_Begin, xK_KP_Right -- 4, 5, 6
, xK_KP_Home, xK_KP_Up, xK_KP_Page_Up -- 7, 8, 9
, xK_KP_Insert] -- 0
isTermScratchPad = (className =? "Gnome-terminal") <&&> (stringProperty "WM_WINDOW_ROLE" =? "Scratchpad")
isKeepass = className =? "KeePass2"
isGuayadeque = className =? "Guayadeque"
isDo = className =? "Do"
isZeal = className =? "Zeal"
myTmuxCommand = "tmux -2 new"
myScratchCommand = "gnome-terminal --role=Scratchpad -e '" ++ myTmuxCommand ++ "'"
myTerminal = "gnome-terminal -e '" ++ myTmuxCommand ++ "'"
myScratchpads = [NS "keepass2" "keepass2" isKeepass nonFloating
,NS "terminal" myScratchCommand isTermScratchPad nonFloating
,NS "guayadeque" "guayadeque" isGuayadeque nonFloating
,NS "zeal" "zeal" isZeal nonFloating]
-- general keysimport XMonad.Prompt
myKeys = [((myModKey, xK_p), spawn ("dmenu_run" ++ myDemuConfig))
,((myModKey .|. shiftMask, xK_p), spawn ("p=`echo '' | dmenu -fn ubuntu-mono-10 -p 'Open File:'` && d=`locate $p | dmenu" ++ myDemuConfig ++ "` && xdg-open \"$d\""))
,((myModKey, xK_g), gotoMenuArgs ["-fn", "ubuntu-mono-10", "-l", "20"])
,((myModKey .|. shiftMask, xK_g), goToSelected defaultGSConfig)
,((myModKey .|. shiftMask, xK_b), bringMenuArgs ["-fn", "ubuntu-mono-10", "-l", "20"])
,((myModKey, xK_grave), cycleRecentWS [xK_Super_L] xK_grave xK_grave)
,((mod1Mask .|. shiftMask, xK_a), spawn "keepass2 --auto-type")
,((myModKey .|. controlMask, xK_space), spawn "gnome-do")
-- close focused window
,((myModKey, xK_x), kill)
-- close only the copy of the window
,((myModKey .|. shiftMask, xK_x), kill1)]
++
-- map all my workspaces
-- mod-[1..9] @@ Switch to workspace N
-- mod-shift-[1..9] @@ Move client to workspace N
-- mod-control-shift-[1..9] @@ Copy client to workspace N
[((m .|. myModKey, k), windows $ f i)
| (i, k) <- zip myWorkspaces [xK_1 ..]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask), (copy, shiftMask .|. controlMask)]]
++
-- make the 0 button go to the 0 workspace
[((myModKey, xK_0), windows $ W.greedyView "0")
, ((myModKey .|. shiftMask, xK_0), withFocused (\w -> windows $ W.shift "0"))
, ((myModKey .|. shiftMask .|. controlMask, xK_0), withFocused (\w -> windows $ copy "0"))]
++
-- numberpad
[((m .|. myModKey, k), windows $ f i)
| (i, k) <- zip myWorkspaces numPadKeys
-- shift will send, but ctrl+shift will copy the window to the workspace
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask), (copy, shiftMask .|. controlMask)]]
++
-- named scratch pads
[
((myModKey .|. controlMask, xK_k), namedScratchpadAction myScratchpads "keepass2")
,((myModKey, xK_F12), namedScratchpadAction myScratchpads "terminal")
,((myModKey, xK_F3), namedScratchpadAction myScratchpads "guayadeque")
,((myModKey, xK_z), namedScratchpadAction myScratchpads "zeal")
,((myModKey .|. controlMask, xK_h), namedScratchpadAction myScratchpads "hangouts")
]
-- dynamic workspace groups
++
[
((myModKey .|. controlMask, xK_a), promptWSGroupAdd myXPConfig "Name this group: ")
, ((myModKey, xK_m), promptWSGroupView myXPConfig "Go to group: ")
, ((myModKey .|. controlMask, xK_f), promptWSGroupForget myXPConfig "Forget group: ")
]
where
myDemuConfig = " -l 20 -fn ubuntu-mono-10 "
myXPConfig = defaultXPConfig
{
font = "xft: ubuntu-mono-10"
,promptBorderWidth = 0
}
myLayout = tiled ||| Mirror tiled ||| spiral (toRational (2 / (1 + sqrt 5::Double))) ||| simpleTabbed ||| Full
where
-- default tiling algorithm partitions the screen into two panes
tiled = Tall 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
myManageHook =
[
isFullscreen --> doFullFloat
,isTermScratchPad --> doRectFloat(W.RationalRect 0 0 0.9 0.9)
,isKeepass --> doCenterFloat
,isGuayadeque --> doCenterFloat
,isDo --> doIgnore
,(className =? "Zenity") --> doCenterFloat
,isZeal --> doRectFloat(W.RationalRect 0 0 0.9 0.9)
]
-- IntelliJ Tweaks
++
[
--ignore IntelliJ autocomplete
appName =? "sun-awt-X11-XWindowPeer" <&&> className =? "jetbrains-idea" --> doIgnore
]
main = xmonad $ gnomeConfig {
modMask = myModKey
, terminal = myTerminal
, focusedBorderColor = "#008db8"
, workspaces = myWorkspaces
, layoutHook = avoidStruts $ smartBorders myLayout
, manageHook = manageHook gnomeConfig <+> composeAll myManageHook
, startupHook = do
startupHook gnomeConfig
setWMName "LG3D"
} `additionalKeys` myKeys