Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
6 static unsigned int borderpx
= 3; /* border pixel of windows */
7 static unsigned int gappx
= 5; /* gaps between windows */
8 static unsigned int snap
= 32; /* snap pixel */
9 static int swallowfloating
= 0; /* 1 means swallow floating windows by default */
10 static int showbar
= 1; /* 0 means no bar */
11 static int topbar
= 1; /* 0 means bottom bar */
12 static char font
[] = "monospace:size=12";
13 static char dmenufont
[] = "monospace:size=12";
14 static const char *fonts
[] = { font
,
15 "WenQuanYi Micro Hei:size=12:type=Regular:antialias=true:autohint=true",
16 "Symbols Nerd Font:pixelsize=18:type=2048-em:antialias=true:autohint=true" };
17 static char normbgcolor
[] = "#222222";
18 static char normbordercolor
[] = "#444444";
19 static char normfgcolor
[] = "#bbbbbb";
20 static char selfgcolor
[] = "#eeeeee";
21 static char selbordercolor
[] = "#005577";
22 static char selbgcolor
[] = "#005577";
23 static const unsigned int baralpha
= 0xd0;
24 static const unsigned int borderalpha
= OPAQUE
;
25 static char *colors
[][3] = {
27 [SchemeNorm
] = { normfgcolor
, normbgcolor
, normbordercolor
},
28 [SchemeSel
] = { selfgcolor
, selbgcolor
, selbordercolor
},
30 static const unsigned int alphas
[][3] = {
32 [SchemeNorm
] = { OPAQUE
, baralpha
, borderalpha
},
33 [SchemeSel
] = { OPAQUE
, baralpha
, borderalpha
},
37 static const char *tags
[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
39 static const Rule rules
[] = {
41 * WM_CLASS(STRING) = instance, class
42 * WM_NAME(STRING) = title
44 /* class instance title tags mask isfloating isterminal noswallow monitor */
45 { "Gimp", NULL
, NULL
, 0, 1, 0, 0, -1 },
46 { "Firefox", NULL
, NULL
, 1 << 8, 0, 0, -1, -1 },
47 { "St", NULL
, NULL
, 0, 0, 1, 0, -1 },
48 { NULL
, NULL
, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
52 static float mfact
= 0.55; /* factor of master area size [0.05..0.95] */
53 static int nmaster
= 1; /* number of clients in master area */
54 static int resizehints
= 1; /* 1 means respect size hints in tiled resizals */
55 static const int lockfullscreen
= 1; /* 1 will force focus on the fullscreen window */
57 #include "fibonacci.c"
58 static const Layout layouts
[] = {
59 /* symbol arrange function */
60 { "[]=", tile
}, /* first entry is default */
65 { "><>", NULL
}, /* no layout function means floating behavior */
69 #define MODKEY Mod4Mask
70 #define TAGKEYS(KEY,TAG) \
71 { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
72 { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
73 { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
74 { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
76 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
77 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
80 static char dmenumon
[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
81 static const char *dmenucmd
[] = { "dmenu_run", "-m", dmenumon
, "-fn", dmenufont
, "-nb", normbgcolor
, "-nf", normfgcolor
, "-sb", selbordercolor
, "-sf", selfgcolor
, NULL
};
82 static const char *termcmd
[] = { TERMINAL
, NULL
};
85 * Xresources preferences to load at startup
87 ResourcePref resources
[] = {
88 { "font", STRING
, &font
},
89 { "dmenufont", STRING
, &dmenufont
},
90 { "background", STRING
, &normbgcolor
},
91 { "systemColor", STRING
, &selbgcolor
},
92 { "foreground", STRING
, &normfgcolor
},
93 { "foreground", STRING
, &selfgcolor
},
94 { "background", STRING
, &normbordercolor
},
95 { "systemColor", STRING
, &selbordercolor
},
96 { "borderpx", INTEGER
, &borderpx
},
97 { "snap", INTEGER
, &snap
},
98 { "showbar", INTEGER
, &showbar
},
99 { "topbar", INTEGER
, &topbar
},
100 { "nmaster", INTEGER
, &nmaster
},
101 { "resizehints", INTEGER
, &resizehints
},
102 { "mfact", FLOAT
, &mfact
},
106 static Key keys
[] = {
107 /* modifier key function argument */
108 { MODKEY
|ShiftMask
, XK_b
, togglebar
, {0} },
109 { MODKEY
, XK_j
, focusstack
, {.i
= +1 } },
110 { MODKEY
, XK_k
, focusstack
, {.i
= -1 } },
111 { MODKEY
, XK_i
, incnmaster
, {.i
= +1 } },
112 { MODKEY
, XK_d
, incnmaster
, {.i
= -1 } },
113 { MODKEY
, XK_h
, setmfact
, {.f
= -0.05} },
114 { MODKEY
, XK_l
, setmfact
, {.f
= +0.05} },
115 { MODKEY
, XK_Tab
, view
, {0} },
116 { MODKEY
, XK_0
, view
, {.ui
= ~0 } },
117 { MODKEY
|ShiftMask
, XK_0
, tag
, {.ui
= ~0 } },
118 { MODKEY
, XK_comma
, focusmon
, {.i
= -1 } },
119 { MODKEY
, XK_period
, focusmon
, {.i
= +1 } },
120 { MODKEY
|ShiftMask
, XK_comma
, tagmon
, {.i
= -1 } },
121 { MODKEY
|ShiftMask
, XK_period
, tagmon
, {.i
= +1 } },
123 // reverse concept, modifying based on window size
124 { MODKEY
, XK_minus
, setgaps
, {.i
= +1 } },
125 { MODKEY
|ShiftMask
, XK_equal
, setgaps
, {.i
= -1 } },
126 { MODKEY
, XK_equal
, setgaps
, {.i
= 0 } },
137 { MODKEY
|ShiftMask
, XK_q
, quit
, {0} },
138 { MODKEY
|ControlMask
|ShiftMask
, XK_q
, quit
, {1} },
141 { MODKEY
, XK_t
, setlayout
, {.v
= &layouts
[0]} },
142 { MODKEY
, XK_m
, setlayout
, {.v
= &layouts
[1]} },
143 { MODKEY
, XK_f
, setlayout
, {.v
= &layouts
[2]} },
144 { MODKEY
, XK_r
, setlayout
, {.v
= &layouts
[3]} },
145 { MODKEY
|ShiftMask
, XK_f
, togglefullscr
, {0} },
146 { MODKEY
, XK_space
, zoom
, {0} },
147 { MODKEY
|ShiftMask
, XK_space
, togglefloating
, {0} },
149 /* launch applications */
150 { MODKEY
, XK_q
, killclient
, {0} },
151 { MODKEY
, XK_p
, spawn
, {.v
= dmenucmd
} },
152 { MODKEY
, XK_Return
, spawn
, {.v
= termcmd
} },
153 { MODKEY
|ShiftMask
, XK_l
, spawn
, SHCMD("slock -m \"$(cowsay $(fortune) | lolcat -ft)\"") },
154 { MODKEY
, XK_w
, spawn
, SHCMD("firefox") },
155 { MODKEY
, XK_n
, spawn
, SHCMD(TERMINAL
" -e sudo nmtui") },
156 { MODKEY
, XK_v
, spawn
, SHCMD(TERMINAL
" -e htop") },
157 { MODKEY
, XK_s
, spawn
, SHCMD(TERMINAL
" -e alsamixer") },
160 /* button definitions */
161 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
162 static Button buttons
[] = {
163 /* click event mask button function argument */
164 { ClkLtSymbol
, 0, Button1
, setlayout
, {0} },
165 { ClkLtSymbol
, 0, Button3
, setlayout
, {.v
= &layouts
[2]} },
166 { ClkWinTitle
, 0, Button2
, zoom
, {0} },
167 { ClkStatusText
, 0, Button2
, spawn
, {.v
= termcmd
} },
168 { ClkClientWin
, MODKEY
, Button1
, movemouse
, {0} },
169 { ClkClientWin
, MODKEY
, Button2
, togglefloating
, {0} },
170 { ClkClientWin
, MODKEY
, Button3
, resizemouse
, {0} },
171 { ClkTagBar
, 0, Button1
, view
, {0} },
172 { ClkTagBar
, 0, Button3
, toggleview
, {0} },
173 { ClkTagBar
, MODKEY
, Button1
, tag
, {0} },
174 { ClkTagBar
, MODKEY
, Button3
, toggletag
, {0} },