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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
import XMonad
import Data.Monoid
import System.Exit
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Graphics.X11.ExtraTypes.XF86 (xF86XK_AudioMute,
xF86XK_AudioLowerVolume,
xF86XK_AudioRaiseVolume,
xF86XK_MonBrightnessDown,
xF86XK_MonBrightnessUp)
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks (ToggleStruts(..))
import XMonad.Actions.WindowBringer
import XMonad.Actions.Minimize (minimizeWindow, withLastMinimized, maximizeWindowAndFocus)
import XMonad.Layout.NoBorders (noBorders, smartBorders)
import XMonad.Layout.Minimize (minimize)
import XMonad.Layout.ResizableThreeColumns
import qualified XMonad.Layout.BoringWindows as BW
myTerminal = "urxvt"
myBrowser = "glide"
myLauncher = "dmenu_run"
myBrightnessDown = "brightnessdown"
myBrightnessUp = "brightnessup"
myVolumeDown = "pactl set-sink-volume @DEFAULT_SINK@ -5%"
myVolumeUp = "pactl set-sink-volume @DEFAULT_SINK@ +5%"
myVolumeMute = "pactl set-sink-mute @DEFAULT_SINK@ toggle"
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = False
myClickJustFocuses :: Bool
myClickJustFocuses = False
myBorderWidth = 1
myNormalBorderColor = "#bbbbbb"
myFocusedBorderColor = "#6904f7"
myModMask = mod4Mask
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
------------------------------------------------------------------------
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
, ((modm, xK_d ), spawn myLauncher)
, ((modm, xK_e ), spawn myBrowser)
, ((noModMask , xF86XK_AudioMute), spawn myVolumeMute)
, ((noModMask , xF86XK_AudioLowerVolume), spawn myVolumeDown)
, ((noModMask , xF86XK_AudioRaiseVolume), spawn myVolumeUp)
, ((noModMask , xF86XK_MonBrightnessDown), spawn myBrightnessDown)
, ((noModMask , xF86XK_MonBrightnessUp), spawn myBrightnessUp)
, ((modm .|. shiftMask, xK_g ), gotoMenu)
, ((modm .|. shiftMask, xK_b ), bringMenu)
, ((modm .|. shiftMask, xK_c ), kill)
, ((modm, xK_space ), sendMessage NextLayout)
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
, ((modm, xK_n ), refresh)
, ((modm, xK_Tab ), windows W.focusDown)
, ((modm, xK_j ), windows W.focusDown)
, ((modm, xK_k ), windows W.focusUp)
, ((modm, xK_m ), windows W.focusMaster)
, ((modm, xK_Return), windows W.swapMaster)
, ((modm .|. shiftMask, xK_j ), windows W.swapDown )
, ((modm .|. shiftMask, xK_k ), windows W.swapUp )
, ((modm, xK_h ), sendMessage Shrink)
, ((modm, xK_l ), sendMessage Expand)
, ((modm .|. shiftMask, xK_h ), sendMessage MirrorShrink)
, ((modm .|. shiftMask, xK_l ), sendMessage MirrorExpand)
-- floating -> tiling
, ((modm, xK_t ), withFocused $ windows . W.sink)
-- push and pop from the hidden window stack
, ((modm, xK_backslash), withFocused minimizeWindow)
, ((modm .|. shiftMask, xK_backslash), withLastMinimized maximizeWindowAndFocus)
, ((modm , xK_comma ), sendMessage (IncMasterN 1))
, ((modm , xK_period), sendMessage (IncMasterN (-1)))
, ((modm , xK_b ), sendMessage ToggleStruts)
, ((modm .|. shiftMask, xK_q ), io exitSuccess)
, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
]
++
--
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
--
-- mod-{u,i,o}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{u,i,o}, Move client to screen 1, 2, or 3
--
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_u, xK_i, xK_o] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
------------------------------------------------------------------------
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList
-- mod-button1, Set the window to floating mode and move by dragging
[ ((modm, button1), \w -> focus w >> mouseMoveWindow w
>> windows W.shiftMaster)
-- mod-button2, Raise the window to the top of the stack
, ((modm, button2), \w -> focus w >> windows W.shiftMaster)
-- mod-button3, Set the window to floating mode and resize by dragging
, ((modm, button3), \w -> focus w >> mouseResizeWindow w
>> windows W.shiftMaster)
-- you may also bind events to the mouse scroll wheel (button4 and button5)
]
------------------------------------------------------------------------
-- Layouts:
myLayout = smartBorders tiled ||| smartBorders threeCol ||| smartBorders Full
where
threeCol = ResizableThreeCol nmaster delta (1/3) []
tiled = Tall nmaster delta (3/5)
nmaster = 1
delta = 2/100
------------------------------------------------------------------------
-- Window rules:
-- Execute arbitrary actions and WindowSet manipulations when managing
-- a new window. You can use this to, for example, always float a
-- particular program, or have a client always appear on a particular
-- workspace.
--
-- To find the property name associated with a program, use
-- > xprop | grep WM_CLASS
-- and click on the client you're interested in.
--
-- To match on the WM_NAME, you can use 'title' in the same way that
-- 'className' and 'resource' are used below.
--
myManageHook = composeAll
[ className =? "MPlayer" --> doFloat
, className =? "mpv" --> doFloat
, className =? "Gimp" --> doFloat
, resource =? "desktop_window" --> doIgnore
, resource =? "kdesktop" --> doIgnore ]
------------------------------------------------------------------------
-- Event handling
-- * EwmhDesktops users should change this to ewmhDesktopsEventHook
--
-- Defines a custom handler function for X Events. The function should
-- return (All True) if the default handler is to be run afterwards. To
-- combine event hooks use mappend or mconcat from Data.Monoid.
--
myEventHook = handleEventHook def
------------------------------------------------------------------------
-- Status bars and logging
-- Perform an arbitrary action on each internal state change or X event.
-- See the 'XMonad.Hooks.DynamicLog' extension for examples.
--
myLogHook = return ()
------------------------------------------------------------------------
-- Startup hook
-- Perform an arbitrary action each time xmonad starts or is restarted
-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
-- per-workspace layout choices.
--
-- By default, do nothing.
myStartupHook = return ()
------------------------------------------------------------------------
-- Status bar
mySB = statusBarProp "xmobar" (pure xmobarPP)
------------------------------------------------------------------------
-- Now run xmonad with all the defaults we set up.
-- Run xmonad with the settings you specify. No need to modify this.
--
main = xmonad $ withEasySB mySB defToggleStrutsKey defaults
-- A structure containing your configuration settings, overriding
-- fields in the default config. Any you don't override, will
-- use the defaults defined in xmonad/XMonad/Config.hs
--
-- No need to modify this.
--
defaults = ewmhFullscreen . ewmh $ def {
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
clickJustFocuses = myClickJustFocuses,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
keys = myKeys,
mouseBindings = myMouseBindings,
layoutHook = minimize . BW.boringWindows $ myLayout,
manageHook = myManageHook,
handleEventHook = myEventHook,
logHook = myLogHook,
startupHook = myStartupHook
}
|