work on config.h

This commit is contained in:
Luca Bilke 2023-02-04 22:14:15 +01:00
parent d16e5324ee
commit 079a50c7cb
3 changed files with 292 additions and 98 deletions

View File

@ -1,2 +1,6 @@
TODO: https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8 TODO: https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8
TODO: config.h TODO: continue reworking keybinds, add layout binds, remove binds related to gaps, add stack binds
TODO: add remaining systray vars to config.h
FIX: barschemes needs constants as colors
FIX: remove dmenumon/dmenucmd references in dwm.c or come up with a better solution

372
config.h
View File

@ -1,120 +1,310 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#define BROWSER "librewolf"
#define TERMINAL "kitty"
#define PLAYER "firefox" /* this is currently only passed to playerctl as the client to control */
/* appearance */ /* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int borderpx = 2;
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 20;
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1;
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1;
static const char *fonts[] = { "monospace:size=10" }; static const int swallowfloating = 0;
static const char dmenufont[] = "monospace:size=10"; static const int showsystray = 1;
static const char col_gray1[] = "#222222"; static const int systrayonleft = 0;
static const char col_gray2[] = "#444444"; static char *fonts[] = {
static const char col_gray3[] = "#bbbbbb"; "monospace:pixelsize=14",
static const char col_gray4[] = "#eeeeee"; "monospace:pixelsize=20",
static const char col_cyan[] = "#005577"; "monospace:pixelsize=30",
static const char *colors[][3] = { };
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, static char *colors[] = {
[SchemeSel] = { col_gray4, col_cyan, col_cyan }, [0] = "#000000", [1] = "#7f0000", [2] = "#007f00", [3] = "#7f7f00",
[4] = "#00007f", [5] = "#7f007f", [6] = "#007f7f", [7] = "#cccccc",
[8] = "#333333", [9] = "#ff0000", [10] = "#00ff00", [11] = "#ffff00",
[12] = "#0000ff", [13] = "#ff00ff", [14] = "#00ffff", [15] = "#ffffff",
/* Extra Colors (not accessible with SGR escapes) */
[16] = "#222222", [17] = "#444444",
};
static char *barschemes[][3] = {
/* fg bg border */
[SchemeNorm] = {colors[15], colors[0], colors[16]},
[SchemeSel] = {colors[15], colors[4], colors[17]},
[SchemeStatus] = {colors[7], colors[0], "#000000"}, // Statusbar right
[SchemeTagsSel] = {colors[0], colors[4], "#000000"}, // Tagbar left selected
[SchemeTagsNorm] = {colors[7], colors[0], "#000000"}, // Tagbar left unselected
[SchemeInfoSel] = {colors[7], colors[0], "#000000"}, // infobar middle selected
[SchemeInfoNorm] = {colors[7], colors[0], "#000000"}, // infobar middle unselected
}; };
/* tagging */ /* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; static const char *tags[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
static const Rule rules[] = { static const Rule rules[] = {
/* xprop(1): /* xprop(1):
* WM_CLASS(STRING) = instance, class * WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title * WM_NAME(STRING) = title
*/ * If X, Y, W or H are between 0 and 1 (inclusive), their values interpreted as percentages of the current monitor resolution.
/* class instance title tags mask isfloating monitor */ * If X or Y are negative, they are subtracted from the current monitor resolution and then that value is interpreted.
{ "Gimp", NULL, NULL, 0, 1, -1 }, class instance title scratch key tags mask isfloating isterminal noswallow x, y, w, h borderpx */
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 }, { NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, 0, 0, 0, 0, -1 },
{ "Xournalpp", "xournalpp", NULL, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1 },
{ "Zathura", "org.pwmt.zathura", NULL, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1 },
{ NULL, "kitty", NULL, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1 },
{ "Qalculate-gtk", NULL, NULL, 'q', 0, 1, 0, 0, .5, .5, 722, 512, -1 },
// { NULL, "spterm", NULL, 't', 0, 1, 1, 0, .5, .5, 1, 1, -1 },
{ NULL, "splf", NULL, 'l', 0, 1, 0, 0, .5, .5, .8, .8, -1 },
{ NULL, "sphtop", NULL, 'h', 0, 1, 0, 0, .5, .5, .8, .8, -1 },
{ NULL, "spmix", NULL, 'm', 0, 1, 0, 0, -4, -4, 900, 600, -1 },
}; };
/* layout(s) */ /* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */ static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */
{ "[]=", tile }, /* first entry is default */ { "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle },
{ "[M]", monocle }, { "TTT", bstack },
{ "TTT", bstack }, { ":::", gaplessgrid },
{ "===", bstackhoriz }, { "===", bstackhoriz },
{ "|M|", centeredmaster }, { "|M|", centeredmaster },
{ ">M>", centeredfloatingmaster }, { ">M>", centeredfloatingmaster },
{ "><>", NULL }, /* Floating */
}; };
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \ #define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
#define STACKKEYS(MOD,ACTION) \
{MOD, XK_j, ACTION##stack, {.i = INC(+1)}}, \
{MOD, XK_k, ACTION##stack, {.i = INC(-1)}}, \
{MOD, XK_tab, ACTION##stack, {.i = 0}}, \
{MOD, XK_v, ACTION##stack, {.i = PREVSEL}}, \
// {MOD, XK_a, ACTION##stack, {.i = 1}}, \
// {MOD, XK_z, ACTION##stack, {.i = 2}}, \
// {MOD, XK_x, ACTION##stack, {.i = -1}},
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char *[]) { "/bin/sh", "-c", cmd, NULL } }
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ // static const char *spterm[] = { "t", "/bin/sh", "-c", "$TERMINAL --name spterm --config ~/.config/kitty/kitty.conf --config ~/.config/kitty/kittyfullscreen.conf" };
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *spqalc[] = { "q", "qalculate-gtk", NULL };
static const char *termcmd[] = { "st", NULL }; static const char *splf[] = { "l", TERMINAL, "--name", "splf", "-d", "~", "-e", "lf", NULL };
static const char *sphtop[] = { "h", TERMINAL, "--name", "sphtop", "-e", "htop", NULL };
static const char *spmix[] = { "m", "/bin/sh", "-c", "$TERMINAL --name spmix -e pulsemixer; pkill -RTMIN+10 dwmblocks" };
/* Xresources preferences to load at startup */
ResourcePref resources[] = {
{ "color0", STRING, &colors[0] },
{ "color1", STRING, &colors[1] },
{ "color2", STRING, &colors[2] },
{ "color3", STRING, &colors[3] },
{ "color4", STRING, &colors[4] },
{ "color5", STRING, &colors[5] },
{ "color6", STRING, &colors[6] },
{ "color7", STRING, &colors[7] },
{ "color8", STRING, &colors[8] },
{ "color9", STRING, &colors[9] },
{ "color10", STRING, &colors[10] },
{ "color11", STRING, &colors[11] },
{ "color12", STRING, &colors[12] },
{ "color13", STRING, &colors[13] },
{ "color14", STRING, &colors[14] },
{ "color15", STRING, &colors[15] },
{ "bordernorm", STRING, &colors[16] },
{ "bordersel", STRING, &colors[17] },
};
#include <X11/XF86keysym.h>
static const Key keys[] = { static const Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/keybinds.mom -Tpdf | zathura -") },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, // { MODKEY, XK_F2, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_F3, togglescratch, {.v = spmix} },
{ MODKEY, XK_j, focusstack, {.i = +1 } }, // { MODKEY, XK_F4, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_k, focusstack, {.i = -1 } }, // { MODKEY, XK_F5, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_i, incnmaster, {.i = +1 } }, // { MODKEY, XK_F6, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_d, incnmaster, {.i = -1 } }, // { MODKEY, XK_F7, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_h, setmfact, {.f = -0.05} }, // { MODKEY, XK_F8, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY, XK_F9, spawn, {.v = (const char *[]){"dmenumount", NULL}} },
{ MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_F10, spawn, {.v = (const char *[]){"dmenuumount", NULL}} },
{ MODKEY, XK_Tab, view, {0} }, { MODKEY, XK_F11, spawn, {.v = (const char *[]){"displayselect", NULL}} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY, XK_F12, spawn, {.v = (const char *[]){"remaps", NULL}} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_grave, spawn, {.v = (const char *[]){"dmenuunicode", NULL}} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, // { MODKEY | ShiftMask, XK_grave, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, TAGKEYS( XK_1, 0)
{ MODKEY, XK_space, setlayout, {0} }, TAGKEYS( XK_2, 1)
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, TAGKEYS( XK_3, 2)
{ MODKEY, XK_0, view, {.ui = ~0 } }, TAGKEYS( XK_4, 3)
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, TAGKEYS( XK_5, 4)
{ MODKEY, XK_comma, focusmon, {.i = -1 } }, TAGKEYS( XK_6, 5)
{ MODKEY, XK_period, focusmon, {.i = +1 } }, TAGKEYS( XK_7, 6)
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, TAGKEYS( XK_8, 7)
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, TAGKEYS( XK_9, 8)
TAGKEYS( XK_1, 0) { MODKEY, XK_0, view, {.ui = ~0} },
TAGKEYS( XK_2, 1) { MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
TAGKEYS( XK_3, 2) // { MODKEY, XK_ssharp, spawn, {.v = (const char *[]){NULL}} },
TAGKEYS( XK_4, 3) // { MODKEY | ShiftMask, XK_ssharp, spawn, {.v = (const char *[]){NULL}} },
TAGKEYS( XK_5, 4) // { MODKEY, XK_acute, spawn, {.v = (const char *[]){NULL}} },
TAGKEYS( XK_6, 5) // { MODKEY | ShiftMask, XK_acute, spawn, {.v = (const char *[]){NULL}} },
TAGKEYS( XK_7, 6) { MODKEY, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
TAGKEYS( XK_8, 7) { MODKEY | ShiftMask, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
TAGKEYS( XK_9, 8) /* XK_Tab is bound in STACKKEYS*/
{ MODKEY|ShiftMask, XK_q, quit, {0} }, { MODKEY|ShiftMask, XK_Tab, view, {0} },
{ MODKEY, XK_q, killclient, {0} },
// { MODKEY | ShiftMask, XK_q, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_w, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_w, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_e, togglescratch, {.v = splf} },
// { MODKEY | ShiftMask, XK_e, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_r, incnmaster, {.i = +1} },
{ MODKEY | ShiftMask, XK_r, incnmaster, {.i = -1} },
// { MODKEY, XK_t, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_t, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_z, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_z, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_u, spawn, {.v = (const char *[]){BROWSER, NULL}} },
{ MODKEY | ShiftMask, XK_u, spawn, {.v = (const char *[]){TERMINAL, "-e", "sudo", "nmtui", NULL}} },
// { MODKEY, XK_i, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_i, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_o, togglescratch, {.v = sphtop} },
{ MODKEY | ShiftMask, XK_o, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
// { MODKEY, XK_p, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_p, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_udiaeresis, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_udiaeresis, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_plus, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_plus, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_a, togglegaps, {0} },
{ MODKEY | ShiftMask, XK_a, defaultgaps, {0} },
// { MODKEY, XK_s, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_s, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_d, spawn, {.v = (const char *[]){"dmenu_run", NULL}} },
{ MODKEY | ShiftMask, XK_d, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_f, togglefullscr, {0} },
// { MODKEY | ShiftMask, XK_f, setlayout, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_g, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_g, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
// { MODKEY | ShiftMask, XK_h, spawn, {.v = (const char *[]){NULL}} },
/* XK_j and XK_k are bound in STACKKEYS */
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
// { MODKEY | ShiftMask, XK_l, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_numbersign, togglescratch, {.v = spqalc} },
// { MODKEY | ShiftMask, XK_numbersign, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_backslash, togglescratch, {.v = spqalc} },
// { MODKEY | ShiftMask, XK_backslash, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_Return, spawn, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
{ MODKEY | ShiftMask, XK_Return, spawn, {.v = (const char *[]){"samedir", NULL}} },
// { MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_x, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_x, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_c, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_c, spawn, {.v = (const char *[]){NULL}} },
/* XK_v is bound in STACKKEYS */
{ MODKEY, XK_b, togglebar, {0} },
// { MODKEY | ShiftMask, XK_b, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_n, spawn, {.v = (const char *[]){TERMINAL, "-e", "nvim", "-c", "VimwikiIndex", NULL}} },
// { MODKEY | ShiftMask, XK_n, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_m, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY | ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") },
{ MODKEY, XK_comma, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "previous", NULL}} },
{ MODKEY | ShiftMask, XK_comma, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "position", "0", NULL}} },
{ MODKEY, XK_period, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "previous", NULL}} },
// { MODKEY | ShiftMask, XK_period, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_minus, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_minus, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_space, zoom, {0} },
{ MODKEY | ShiftMask, XK_space, togglefloating, {0} },
{ 0, XK_Print, spawn, SHCMD("maim ~/Photos/Screenshots/pic-full-$(date '+%y%m%d-%H%M-%S').png") },
{ ShiftMask, XK_Print, spawn, {.v = (const char *[]){"maimpick", NULL}} },
{ MODKEY, XK_Print, spawn, {.v = (const char *[]){"dmenurecord", NULL}} },
{ MODKEY | ShiftMask, XK_Print, spawn, {.v = (const char *[]){"dmenurecord", "kill", NULL}} },
// { MODKEY, XK_Scroll_Lock, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Scroll_Lock, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_Pause, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Pause, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_Insert, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Insert, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_Home, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Home, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_Delete, spawn, {.v = (const char *[]){"dmenurecord", "kill", NULL}} },
// { MODKEY | ShiftMask, XK_Delete, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_End, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY | ShiftMask, XK_End, quit, {0} },
// { MODKEY, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },
{ MODKEY, XK_Left, focusmon, {.i = -1} },
{ MODKEY | ShiftMask, XK_Left, tagmon, {.i = -1} },
{ MODKEY, XK_Right, focusmon, {.i = +1} },
{ MODKEY | ShiftMask, XK_Right, tagmon, {.i = +1} },
// { MODKEY, XK_Up, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Up, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY, XK_Down, spawn, {.v = (const char *[]){NULL}} },
// { MODKEY | ShiftMask, XK_Down, spawn, {.v = (const char *[]){NULL}} },
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 5; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "previous", NULL}} },
{ 0, XF86XK_AudioNext, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "next", NULL}} },
{ 0, XF86XK_AudioPause, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "pause", NULL}} },
{ 0, XF86XK_AudioPlay, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "play", NULL}} },
{ 0, XF86XK_AudioStop, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "stop", NULL}} },
{ 0, XF86XK_AudioRewind, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "position", "10-", NULL}} },
{ 0, XF86XK_AudioForward, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "position", "10+", NULL}} },
// { 0, XF86XK_AudioMedia, spawn, {.v = (const char *[]){NULL}} },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") },
{ 0, XF86XK_PowerOff, spawn, {.v = (const char *[]){"sysact", NULL}} },
{ 0, XF86XK_Calculator, spawn, {.v = (const char *[]){TERMINAL, "-e", "bc", "-l", NULL}} },
{ 0, XF86XK_Sleep, spawn, {.v = (const char *[]){"sudo", "-A", "zzz", NULL}} },
{ 0, XF86XK_WWW, spawn, {.v = (const char *[]){BROWSER, NULL}} },
{ 0, XF86XK_WLAN, spawn, SHCMD("sleep 0.1; pkill -RTMIN+4 dwmblocks") },
{ 0, XF86XK_DOS, spawn, {.v = (const char *[]){TERMINAL, NULL}} },
{ 0, XF86XK_ScreenSaver, spawn, SHCMD("xset s activate & mpc pause & pauseallmpv") },
{ 0, XF86XK_TaskPane, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
{ 0, XF86XK_Mail, spawn, SHCMD("$TERMINAL -e neomutt; pkill -RTMIN+12 dwmblocks") },
{ 0, XF86XK_MyComputer, spawn, {.v = (const char *[]){TERMINAL, "-e", "lfub", "/", NULL}} },
// { 0, XF86XK_Battery, spawn, {.v = (const char *[]){NULL}} },
{ 0, XF86XK_Launch1, spawn, {.v = (const char *[]){"xset", "dpms", "force", "off", NULL}} },
{ 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || " "synclient TouchpadOff=1") },
{ 0, XF86XK_TouchpadOff, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=1", NULL}} },
{ 0, XF86XK_TouchpadOn, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=0", NULL}} },
/* WARN: If you have multiple backlight controllers this will fail */
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("echo $(($(cat /sys/class/backlight/*/brightness) + 5)) | tee /sys/class/backlight/*/brightness") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("echo $(($(cat /sys/class/backlight/*/brightness) - 5)) | tee /sys/class/backlight/*/brightness") },
}; };
/* button definitions */ /* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = {
static const Button buttons[] = { /* click event mask button function argument */
/* click event mask button function argument */ // { ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button1, setlayout, {0} }, // { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, // { ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkWinTitle, 0, Button2, zoom, {0} }, { ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkTagBar, 0, Button1, view, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, // { ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, 0, Button1, view, {0} }, // { ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} }, // { ClkTagBar, MODKEY, Button3, toggletag, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
}; };
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */

12
dwm.c
View File

@ -2271,13 +2271,13 @@ void setup(void) {
cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur); cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */ /* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); scheme = ecalloc(LENGTH(barschemes), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++) for (i = 0; i < LENGTH(barschemes); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3); scheme[i] = drw_scm_create(drw, barschemes[i], 3);
barclrs = ecalloc(LENGTH(barcolors), sizeof(Clr)); barclrs = ecalloc(LENGTH(colors), sizeof(Clr));
for (i = 0; i < LENGTH(barcolors); i++) for (i = 0; i < LENGTH(colors); i++)
drw_clr_create(drw, &barclrs[i], barcolors[i]); drw_clr_create(drw, &barclrs[i], colors[i]);
/* init system tray */ /* init system tray */
updatesystray(); updatesystray();