adds rule for floating webcam window
[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=10", "JoyPixels:pixelsize=10:antialias=true:autohint=true" };
16 static const char dmenufont[] = "monospace:size=10";
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 { NULL, NULL, "webcam", 0x1FF, 1, -1 },
40 };
41
42 /* layout(s) */
43 static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
44 static const int nmaster = 1; /* number of clients in master area */
45 static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
46
47 static const Layout layouts[] = {
48 /* symbol arrange function */
49 { "◧", tile }, /* first entry is default */
50 { "🗗", NULL }, /* no layout function means floating behavior */
51 { "🔍", monocle }, // TODO hide unfocused windows for background transparency?
52 };
53
54 /* key definitions */
55 #define MODKEY Mod4Mask
56 #define TAGKEYS(KEY,TAG) \
57 { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
58 { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
59 { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
60 { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
61 #define MEDIAKEY(KEY,CMD) {0, KEY, spawn, {.v = (const char *[]){ "sh", "-c", CMD, NULL } } } /* TODO don't fire up unnecessary shells */
62
63 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
64 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
65
66 /* commands */
67 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
68 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
69 static const char *termcmd[] = { "st", NULL };
70 static const char *helpcmd[] = { "st", "-e", "man", "dwm", NULL };
71 static const char *killx[] = { "pkill", "xinit", NULL };
72
73 static Key keys[] = {
74 /* modifier key function argument */
75 { MODKEY, XK_p, spawn, {.v = dmenucmd } },
76 { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
77 { MODKEY, XK_b, togglebar, {0} },
78 { MODKEY, XK_j, focusstack, {.i = +1 } },
79 { MODKEY, XK_k, focusstack, {.i = -1 } },
80 { MODKEY, XK_i, incnmaster, {.i = +1 } },
81 { MODKEY, XK_d, incnmaster, {.i = -1 } },
82 { MODKEY, XK_h, setmfact, {.f = -0.05} },
83 { MODKEY, XK_l, setmfact, {.f = +0.05} },
84 { MODKEY, XK_Return, zoom, {0} },
85 { MODKEY, XK_Tab, view, {0} },
86 { MODKEY|ShiftMask, XK_c, killclient, {0} },
87 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
88 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
89 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
90 { MODKEY, XK_space, setlayout, {0} },
91 { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
92 { MODKEY, XK_0, view, {.ui = ~0 } },
93 { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
94 { MODKEY, XK_comma, focusmon, {.i = -1 } },
95 { MODKEY, XK_period, focusmon, {.i = +1 } },
96 { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
97 { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
98 TAGKEYS( XK_1, 0)
99 TAGKEYS( XK_2, 1)
100 TAGKEYS( XK_3, 2)
101 TAGKEYS( XK_4, 3)
102 TAGKEYS( XK_5, 4)
103 TAGKEYS( XK_6, 5)
104 TAGKEYS( XK_7, 6)
105 TAGKEYS( XK_8, 7)
106 TAGKEYS( XK_9, 8)
107 { MODKEY|ShiftMask, XK_r, quit, {0} }, // just exits dwm, allows for restart
108 { MODKEY|ShiftMask, XK_q, spawn, {.v = killx } }, // kills x session
109
110 { MODKEY|ShiftMask, XK_h, spawn, {.v = helpcmd } },
111 { MODKEY, XK_w, spawn, {.v = (const char*[]){ "tabbed", "-cdps+1", "surf", "-e", NULL } } },
112 { MODKEY|ShiftMask, XK_w, spawn, {.v = (const char*[]){ "chromium", NULL } } },
113 { MODKEY|ShiftMask, XK_x, spawn, {.v = (const char*[]){ "st", "-c", "ish", "-t", "ish", "ish", NULL } } },
114 { MODKEY|ShiftMask, XK_p, spawn, SHCMD("mpc toggle; pkill -USR1 dbar") },
115 { MODKEY|ShiftMask, XK_n, spawn, SHCMD("mpc next; pkill -USR1 dbar") },
116
117 /* XF86 Keys */
118 MEDIAKEY( XF86XK_MonBrightnessUp, "xbacklight -time 100 -inc 5"),
119 MEDIAKEY( XF86XK_MonBrightnessDown, "xbacklight -time 100 -dec 5"),
120 MEDIAKEY( XF86XK_AudioMute, "pactl set-sink-mute @DEFAULT_SINK@ toggle; pkill -USR1 dbar"),
121 MEDIAKEY( XF86XK_AudioLowerVolume, "pactl set-sink-volume @DEFAULT_SINK@ -10%; pkill -USR1 dbar"),
122 MEDIAKEY( XF86XK_AudioRaiseVolume, "pactl set-sink-volume @DEFAULT_SINK@ +5%; pkill -USR1 dbar"),
123 MEDIAKEY( XF86XK_AudioMicMute, "pactl set-source-mute @DEFAULT_SOURCE@ toggle; pkill -USR1 dbar"),
124 MEDIAKEY( XF86XK_WebCam, "mpv --untimed /dev/video0"),
125
126 };
127
128 /* button definitions */
129 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
130 static Button buttons[] = {
131 /* click event mask button function argument */
132 { ClkLtSymbol, 0, Button1, setlayout, {0} },
133 { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
134 { ClkWinTitle, 0, Button2, zoom, {0} },
135 { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
136 { ClkClientWin, MODKEY, Button1, movemouse, {0} },
137 { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
138 { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
139 { ClkTagBar, 0, Button1, view, {0} },
140 { ClkTagBar, 0, Button3, toggleview, {0} },
141 { ClkTagBar, MODKEY, Button1, tag, {0} },
142 { ClkTagBar, MODKEY, Button3, toggletag, {0} },
143 };
144