-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathxmonad.hs
274 lines (216 loc) · 8.23 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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
----------------------------------------------------------------------
-- welcome to my XMonad configuration uwu*
----------------------------------------------------------------------
----------------------------------------------------------------------
-- pre require softwares
----------------------------------------------------------------------
{--
- alacritty: blazingly fast terminal emulator
- picom: basic compositor for Xorg
- feh: set a wallpaper and preview an images
- maim: take a screenshot
- dmenu: tiny application launcher
- thunar: popular file manager
- brightnessctl: increase and decrease the brightness
- pamixer: increase and decrease the volume
--}
----------------------------------------------------------------------
-- to-do
----------------------------------------------------------------------
{--
- set the script path in more smart way
- make full screen support
--}
----------------------------------------------------------------------
-- import modules
----------------------------------------------------------------------
import XMonad
{-- extended Window Manager Hints --}
import XMonad.Hooks.EwmhDesktops (ewmh)
{-- layouts --}
import XMonad.Layout.Gaps (gaps, Direction2D(D, L, R, U))
import XMonad.Layout.Spacing (spacingRaw, Border(Border))
-- import XMonad.Layout.ThreeColumns
import XMonad.Layout.Grid
{-- some funny layouts --}
-- import XMonad.Layout.Roledex
-- import XMonad.Layout.Circle
{-- launch process --}
import XMonad.Util.SpawnOnce (spawnOnce)
{-- for keybinds --}
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Graphics.X11.ExtraTypes.XF86 (
xF86XK_AudioLowerVolume,
xF86XK_AudioRaiseVolume,
xF86XK_AudioMute,
xF86XK_MonBrightnessUp,
xF86XK_MonBrightnessDown
)
import XMonad.Util.Dmenu
----------------------------------------------------------------------
-- variables
----------------------------------------------------------------------
myTerminal = "alacritty" {-- default terminal --}
myModMask = mod4Mask {-- super --}
myFocusFollowsMouse = True
myBorderWidth = 1
myNormalBorderColor = "#000000"
myFocusedBorderColor = "#0000ff"
myWorkspaces = ["1", "2", "3", "4", "5"]
-- myWorkspaces = ["零", "壱", "弐", "参", "肆", "伍"]
-- own custom variables
myHomeDir = "/home/tailr"
myAppLauncher = "dmenu_run"
myFileManager = "thunar"
my_sh_ss_full = myHomeDir ++ "/.config/xmonad/scripts/ss.sh -f"
my_sh_ss_select = myHomeDir ++ "/.config/xmonad/scripts/ss.sh -s"
my_sh_rand_wall = myHomeDir ++ "/.config/xmonad/scripts/rand_wall.sh"
----------------------------------------------------------------------
-- auto start programs
----------------------------------------------------------------------
myStartupHook = do
spawnOnce "xrandr --output eDP-1 --brightness 1.0"
spawnOnce "~/.fehbg"
{-- compositer --}
spawnOnce "picom"
-- spawnOnce "picom --experimental-backend" {-- picom fork --}
spawnOnce "xsetroot -cursor_name left_ptr"
spawnOnce "fcitx5"
-- spawnOnce "dunst"
----------------------------------------------------------------------
-- keybinds
----------------------------------------------------------------------
myKeys conf@(XConfig {XMonad.modMask = super}) = M.fromList $
[
{-- launch a terminal --}
((super, xK_Return),
spawn myTerminal),
{-- launch an Application launcher --}
((super, xK_d),
spawn myAppLauncher),
{-- take a screenshot --}
((super , xK_s),
spawn my_sh_ss_full),
((super .|. shiftMask, xK_s),
spawn my_sh_ss_select),
{-- set a wallpaper randomly --}
((super, xK_w),
spawn my_sh_rand_wall),
{-- kill a focused window --}
((super, xK_q),
kill),
{-- compile XMonad --}
((super, xK_r),
spawn "xmonad --recompile; xmonad --restart"),
{-- launch a filemanager --}
((super, xK_f),
spawn "thunar"),
{-- control brightness --}
((0, xF86XK_MonBrightnessUp),
spawn "brightnessctl s +5%"),
((0, xF86XK_MonBrightnessDown),
spawn "brightnessctl s 5-%"),
{-- control volume --}
((0, xF86XK_AudioRaiseVolume),
spawn "pamixer --increase 5"),
((0, xF86XK_AudioLowerVolume),
spawn "pamixer --decrease 5"),
((0, xF86XK_AudioMute),
spawn "pamixer --toggle-mute"),
((super, xK_space),
sendMessage NextLayout),
{-- move window focus --}
((super, xK_j),
windows W.focusUp),
((super, xK_k),
windows W.focusDown),
{-- expand the master window --}
((super, xK_l),
sendMessage Expand),
{-- shrink the master window --}
((super, xK_h),
sendMessage Shrink),
{-- swap the focused window and master window --}
((super, xK_c),
windows W.swapMaster),
{-- back to tiling mode --}
((super, xK_t),
withFocused $ windows . W.sink)
]
++
[
{-- move the workspace or send the window to the any workspaces --}
((m .|. super, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
]
----------------------------------------------------------------------
-- window rules
----------------------------------------------------------------------
myManageHook = composeAll
[
{-- ignore --}
className =? "Bar" --> doIgnore,
-- className =? "Eww" --> doIgnore,
-- className =? "polybar" --> doIgnore,
{-- float --}
className =? "XClock" --> doFloat,
className =? "XCalc" --> doFloat,
className =? "Gimp" --> doFloat,
className =? "feh" --> doFloat,
-- className =? "Thunar" --> doFloat,
-- className =? "vlc" --> doFloat,
-- className =? "discord" --> doFloat,
-- className =? "Spotify" --> doFloat,
className =? "Bar" --> doFloat
-- className =? "Eww" --> doFloat,
-- className =? "polybar" --> doFloat
]
----------------------------------------------------------------------
-- window layouts
----------------------------------------------------------------------
myLayoutHook =
{-- gap size for the around the window --}
{-- left Right Top Bottom --}
-- gaps [(L, 32), (R, 32), (U, 120), (D, 130)]
gaps [(L, 0), (R, 0), (U, 0), (D, 40)]
{-- gap size for the each window --}
$ spacingRaw True (Border gap gap gap gap)
True (Border gap gap gap gap)
True
{-- three columns layout --}
-- $ ThreeCol nmaster delta fraction
-- ||| ThreeColMid nmaster delta fraction
-- ||| Full
{-- master layout --}
-- $ Tall nmaster delta fraction
-- ||| Full
{-- custom layout --}
$ Tall nmaster delta fraction
||| Grid
||| Full
{-- local variables for the layouts --}
where
nmaster = 1
delta = 3/100
fraction = 1/2
gap = 1
----------------------------------------------------------------------
-- main
----------------------------------------------------------------------
main = xmonad $ ewmh defaults
defaults = def
{
terminal = myTerminal,
modMask = myModMask,
focusFollowsMouse = myFocusFollowsMouse,
borderWidth = myBorderWidth,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
workspaces = myWorkspaces,
keys = myKeys,
manageHook = myManageHook,
layoutHook = myLayoutHook,
startupHook = myStartupHook
}