diff --git a/config.h b/config.h new file mode 100644 index 0000000..e074b74 --- /dev/null +++ b/config.h @@ -0,0 +1,187 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const unsigned int borderpx = 4; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ +static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ +static const unsigned int systrayspacing = 2; /* systray spacing */ +static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ +static const int showsystray = 1; /* 0 means no systray */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +#define ICONSIZE (bh - 2) /* icon size */ +#define ICONSPACING (bh - 4) /* space between icon and title */ +static const char *fonts[] = { "monospace:size=9" }; +static const char dmenufont[] = "monospace:size=9"; +static const char col_gray1[] = "#222222"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_cyan[] = "#005577"; +static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, +}; + +static const char *const autostart[] = { + "flatpak", "run", "org.telegram.desktop", NULL, + "nm-applet", NULL, + "dwmblocks", NULL, + "setxkbmap", "-layout", "us,ru", "-option", "grp:caps_toggle", NULL, + NULL /* terminate */ +}; + +typedef struct { + const char *name; + const void *cmd; +} Sp; +const char *telegram_scratchpad[] = { "telegram", NULL }; +const char *keepass_scratchpad[] = {"keepassxc", NULL }; +static Sp scratchpads[] = { + /* name cmd */ + {"telegram", telegram_scratchpad}, + {"keepassxc", keepass_scratchpad}, +}; + +/* tagging */ +static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ + /* class instance title tags mask isfloating monitor */ + { NULL, "telegram", NULL, SPTAG(0), 1, -1 }, + { NULL, "keepassxc", NULL, SPTAG(1), 1, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ +static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[D]", deck }, + { "[]=", tile }, /* first entry is default */ + { "[M]", monocle }, + { "[][]=", tilewide }, + { "><>", NULL }, /* no layout function means floating behavior */ +}; + +/* key definitions */ +#define MODKEY Mod4Mask +#define TAGKEYS(KEY,TAG) \ + {1, {{MODKEY, KEY}}, comboview, {.ui = 1 << TAG} }, \ + {1, {{MODKEY|ControlMask, KEY}}, toggleview, {.ui = 1 << TAG} }, \ + {1, {{MODKEY|ShiftMask, KEY}}, combotag, {.ui = 1 << TAG} }, \ + {1, {{MODKEY|ControlMask|ShiftMask, KEY}}, swaptags, {.ui = 1 << TAG} }, + /* {1, {{MODKEY|ControlMask|ShiftMask, KEY}}, toggletag, {.ui = 1 << TAG} }, \ */ + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { "/bin/sh", "-c", cmd, NULL } + +/* commands */ +static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *termcmd[] = { "wezterm", NULL }; +static const char *browsercmd[] = { "firefox", NULL }; +static const char *brightness_dec[] = { "xbacklight", "-dec", "5", NULL }; +static const char *brightness_inc[] = { "xbacklight", "-inc", "5", NULL }; +static const char *sound_mute[] = SHCMD("pulsemixer --toggle-mute; pkill -RTMIN+9 dwmblocks"); +static const char *sound_dec[] = SHCMD("pulsemixer --change-volume -5; pkill -RTMIN+9 dwmblocks"); +static const char *sound_inc[] = SHCMD("pulsemixer --change-volume +5; pkill -RTMIN+9 dwmblocks"); + +#include +#include "movestack.c" + +// Keychord = {n, nchords, function, argument} +static Keychord keychords[] = { + { 1, { {MODKEY, XK_slash} }, togglebar, {0} }, + { 1, { {MODKEY, XK_j} }, focusstack, {.i = +1 } }, + { 1, { {MODKEY, XK_k} }, focusstack, {.i = -1 } }, + { 1, { {MODKEY, XK_i} }, incnmaster, {.i = +1 } }, + { 1, { {MODKEY, XK_d} }, incnmaster, {.i = -1 } }, + { 1, { {MODKEY, XK_h} }, setmfact, {.f = -0.05} }, + { 1, { {MODKEY, XK_l} }, setmfact, {.f = +0.05} }, + { 1, { {MODKEY|ShiftMask, XK_j} }, movestack, {.i = +1 } }, + { 1, { {MODKEY|ShiftMask, XK_k} }, movestack, {.i = -1 } }, + { 1, { {MODKEY|ShiftMask, XK_Return} }, zoom, {0} }, + { 1, { {MODKEY, XK_Tab} }, view, {0} }, + { 1, { {MODKEY, XK_q} }, killclient, {0} }, + { 1, { {MODKEY|ShiftMask, XK_space} }, togglefloating, {0} }, + { 1, { {MODKEY, XK_0} }, view, {.ui = ~0 } }, + { 1, { {MODKEY|ShiftMask, XK_0} }, tag, {.ui = ~0 } }, + { 1, { {MODKEY, XK_comma} }, focusmon, {.i = -1 } }, + { 1, { {MODKEY, XK_period} }, focusmon, {.i = +1 } }, + { 1, { {MODKEY|ShiftMask, XK_comma} }, tagmon, {.i = -1 } }, + { 1, { {MODKEY|ShiftMask, XK_period} }, tagmon, {.i = +1 } }, + { 1, { {MODKEY|ShiftMask, XK_e} }, quit, {0} }, + TAGKEYS( XK_1, 0 ) + TAGKEYS( XK_2, 1 ) + TAGKEYS( XK_3, 2 ) + TAGKEYS( XK_4, 3 ) + TAGKEYS( XK_5, 4 ) + TAGKEYS( XK_6, 5 ) + TAGKEYS( XK_7, 6 ) + TAGKEYS( XK_8, 7 ) + TAGKEYS( XK_9, 8 ) + + // Layouts + { 2, { {MODKEY, XK_space}, {0, XK_d} }, setlayout, {.v = &layouts[0]} }, // deck + { 2, { {MODKEY, XK_space}, {0, XK_t} }, setlayout, {.v = &layouts[1]} }, // tile + { 2, { {MODKEY, XK_space}, {0, XK_m} }, setlayout, {.v = &layouts[2]} }, // monocle + { 2, { {MODKEY, XK_space}, {0, XK_w} }, setlayout, {.v = &layouts[3]} }, // wide + { 2, { {MODKEY, XK_space}, {0, XK_space} }, setlayout, {.v = &layouts[4]} }, // floating + + // Program runners + { 1, { {MODKEY, XK_p} }, spawn, {.v = dmenucmd } }, + { 1, { {MODKEY, XK_Return} }, spawn, {.v = termcmd } }, + { 2, { {MODKEY, XK_r}, {0, XK_b} }, spawn, {.v = browsercmd } }, + + // Fn Keys + { 1, { {0, XF86XK_MonBrightnessDown} }, spawn, { .v = brightness_dec } }, + { 1, { {0, XF86XK_MonBrightnessUp} }, spawn, { .v = brightness_inc } }, + { 1, { {0, XF86XK_AudioMute} }, spawn, { .v = sound_mute } }, + { 1, { {0, XF86XK_AudioLowerVolume} }, spawn, { .v = sound_dec } }, + { 1, { {0, XF86XK_AudioRaiseVolume} }, spawn, { .v = sound_inc } }, + // { 0, XF86XK_TouchpadOff, spawn, SHCMD("notify-send 'Touchpad turned off'") }, + // { 0, XF86XK_TouchpadOn, spawn, SHCMD("notify-send 'Touchpad turned on'") }, + + // Screenshots + // { 1, { {0, XK_Print} }, spawn, { .v = SHCMD("notify-send hello") } }, + // { 2, { {MODKEY, XK_Print}, {0, XK_a} }, spawn, { .v = SHCMD("screenshot area to clip") } }, + // { 2, { {MODKEY, XK_Print}, {0|ShiftMask, XK_a} }, spawn, { .v = SHCMD("screenshot area to file") } }, + // { 2, { {MODKEY, XK_Print}, {0, XK_space} }, spawn, { .v = SHCMD("screenshot window to clip") } }, + // { 2, { {MODKEY, XK_Print}, {0|ShiftMask, XK_space} }, spawn, { .v = SHCMD("screenshot window to file") } }, + // { 2, { {MODKEY, XK_Print}, {0, XK_Return} }, spawn, { .v = SHCMD("screenshot screen to clip") } }, + // { 2, { {MODKEY, XK_Print}, {0|ShiftMask, XK_Return} }, spawn, { .v = SHCMD("screenshot screen to file") } }, + + // actualfullscreen + { 1, { {MODKEY|ShiftMask, XK_f} }, togglefullscr, {0} }, + + // adjacent tags + {1, { {MODKEY, XK_Left} }, viewtoleft, {0} }, + {1, { {MODKEY, XK_Right} }, viewtoright, {0} }, + {1, { {MODKEY|ShiftMask, XK_Left} }, tagtoleft, {0} }, + {1, { {MODKEY|ShiftMask, XK_Right} }, tagtoright, {0} }, + + // scratchpads + {2, { {MODKEY, XK_s}, {0, XK_t} }, togglescratch, {.ui = 0 } }, + {2, { {MODKEY, XK_s}, {0, XK_x} }, togglescratch, {.ui = 1 } }, +}; + +/* button definitions */ +/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static const Button buttons[] = { + /* click event mask button function argument */ + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY|ShiftMask, Button1, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, +}; +