uses macro to set media key commands
[dwm.git] / config.h
1 /* See LICENSE file for copyright and license details. */
2
3 #include <X11/XF86keysym.h>
4
5 /* appearance */
6 static const unsigned int borderpx = 1; /* border pixel of windows */
7 static const unsigned int gappx = 8; /* gap pixel between windows */
8 static const unsigned int snap = 16; /* snap pixel */
9 static const unsigned int systraypinning = 1; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
10 static const unsigned int systrayspacing = 2; /* systray spacing */
11 static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
12 static const int showsystray = 1; /* 0 means no systray */
13 static const int showbar = 1; /* 0 means no bar */
14 static const int topbar = 1; /* 0 means bottom bar */
15 static const char *fonts[] = { "monospace:size=9" };
16 static const char dmenufont[] = "monospace:size=9";
17 static const char col_gray1[] = "#222222";
18 static const char col_gray2[] = "#444444";
19 static const char col_gray3[] = "#bbbbbb";
20 static const char col_gray4[] = "#eeeeee";
21 static const char col_cyan[] = "#007799";
22 static const char *colors[][3] = {
23 /* fg bg border */
24 [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
25 [SchemeSel] = { col_gray4, col_cyan, col_cyan },
26 };
27
28 /* tagging */
29 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
30
31 static const Rule rules[] = {
32 /* xprop(1):
33 * WM_CLASS(STRING) = instance, class
34 * WM_NAME(STRING) = title
35 */
36 /* class instance title tags mask isfloating monitor */
37 { "Gimp", NULL, NULL, 0, 1, -1 },
38 { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
39 };
40
41 /* layout(s) */
42 static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
43 static const int nmaster = 1; /* number of clients in master area */
44 static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
45
46 static const Layout layouts[] = {
47 /* symbol arrange function */
48 { "[]=", tile }, /* first entry is default */
49 { "><>", NULL }, /* no layout function means floating behavior */
50 { "[M]", monocle },
51 };
52
53 /* key definitions */
54 #define MODKEY Mod4Mask
55 #define TAGKEYS(KEY,TAG) \
56 { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
57 { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
58 { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
59 { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
60 #define MEDIAKEY(KEY,CMD) {0, KEY, spawn, {.v = (const char *[]){ "sh", "-c", CMD, NULL } } } /* TODO don't fire up unnecessary shells */
61
62 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
63 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
64
65 /* commands */
66 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
67 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
68 static const char *termcmd[] = { "st", NULL };
69 static const char *helpcmd[] = { "st", "-e", "man", "dwm", NULL };
70
71 static Key keys[] = {
72 /* modifier key function argument */
73 { MODKEY, XK_p, spawn, {.v = dmenucmd } },
74 { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
75 { MODKEY, XK_b, togglebar, {0} },
76 { MODKEY, XK_j, focusstack, {.i = +1 } },
77 { MODKEY, XK_k, focusstack, {.i = -1 } },
78 { MODKEY, XK_i, incnmaster, {.i = +1 } },
79 { MODKEY, XK_d, incnmaster, {.i = -1 } },
80 { MODKEY, XK_h, setmfact, {.f = -0.05} },
81 { MODKEY, XK_l, setmfact, {.f = +0.05} },
82 { MODKEY, XK_Return, zoom, {0} },
83 { MODKEY, XK_Tab, view, {0} },
84 { MODKEY|ShiftMask, XK_c, killclient, {0} },
85 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
86 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
87 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
88 { MODKEY, XK_space, setlayout, {0} },
89 { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
90 { MODKEY, XK_0, view, {.ui = ~0 } },
91 { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
92 { MODKEY, XK_comma, focusmon, {.i = -1 } },
93 { MODKEY, XK_period, focusmon, {.i = +1 } },
94 { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
95 { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
96 TAGKEYS( XK_1, 0)
97 TAGKEYS( XK_2, 1)
98 TAGKEYS( XK_3, 2)
99 TAGKEYS( XK_4, 3)
100 TAGKEYS( XK_5, 4)
101 TAGKEYS( XK_6, 5)
102 TAGKEYS( XK_7, 6)
103 TAGKEYS( XK_8, 7)
104 TAGKEYS( XK_9, 8)
105 { MODKEY|ShiftMask, XK_q, quit, {0} },
106
107 { MODKEY|ShiftMask, XK_h, spawn, {.v = helpcmd } },
108
109 /* XF86 Keys */
110 MEDIAKEY( XF86XK_MonBrightnessUp, "xbacklight -inc 10"),
111 MEDIAKEY( XF86XK_MonBrightnessDown, "xbacklight -dec 10"),
112 MEDIAKEY( XF86XK_AudioMute, "pactl set-sink-mute @DEFAULT_SINK@ toggle"),
113 MEDIAKEY( XF86XK_AudioLowerVolume, "pactl set-sink-volume @DEFAULT_SINK@ -10%"),
114 MEDIAKEY( XF86XK_AudioRaiseVolume, "pactl set-sink-volume @DEFAULT_SINK@ +5%"),
115 MEDIAKEY( XF86XK_AudioMicMute, "pactl set-source-mute @DEFAULT_SOURCE@ toggle"),
116 MEDIAKEY( XF86XK_WebCam, "mpv --untimed /dev/video0"),
117
118 };
119
120 /* button definitions */
121 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
122 static Button buttons[] = {
123 /* click event mask button function argument */
124 { ClkLtSymbol, 0, Button1, setlayout, {0} },
125 { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
126 { ClkWinTitle, 0, Button2, zoom, {0} },
127 { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
128 { ClkClientWin, MODKEY, Button1, movemouse, {0} },
129 { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
130 { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
131 { ClkTagBar, 0, Button1, view, {0} },
132 { ClkTagBar, 0, Button3, toggleview, {0} },
133 { ClkTagBar, MODKEY, Button1, tag, {0} },
134 { ClkTagBar, MODKEY, Button3, toggletag, {0} },
135 };
136