From 934174c99d8c634b709cb1f983ee8051dd7cb2fe Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Fri, 4 Jun 2021 22:24:19 -0400 Subject: [PATCH] [dwm] Misc changes Change browser to qutebrowser, add passthrough and color changes --- suckless/dwm/config.def.h | 13 +++++++++++++ suckless/dwm/dwm.c | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/suckless/dwm/config.def.h b/suckless/dwm/config.def.h index 2c45f92..9a74ef4 100644 --- a/suckless/dwm/config.def.h +++ b/suckless/dwm/config.def.h @@ -9,6 +9,7 @@ static const unsigned int gappiv = 10; /* vert inner gap between window static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ static const unsigned int gappov = 30; /* vert outer gap between windows and screen edge */ static int smartgaps = 0; /* 1 means no outer gap when there is only one window */ +static int passthrough = 0; /* 1 means to ignore most shortcuts */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const char *fonts[] = { "monospace:size=10" }; @@ -68,9 +69,21 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-n", NULL }; static const char *termcmd[] = { "st", NULL }; static const char *suspendcmd[] = { "systemctl", "suspend", NULL }; +static const char *browsercmd[] = { "qutebrowser", NULL }; +static const char *scrotcmd[] = {".local/bin/screenshot.sh"}; +static const char *scrotscmd[] = {".local/bin/screenshot-save.sh"}; +static const char *lockcmd[] = { "slock" }; +static const char *upvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "+5%", NULL }; +static const char *downvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "-5%", NULL }; +static const char *mutevol[] = { "/usr/bin/pactl", "set-sink-mute", "0", "toggle", NULL }; +static const char *play[] = { "mpc", "toggle", NULL }; +static const char *next[] = { "mpc", "next", NULL }; +static const char *prev[] = { "mpc", "prev", NULL }; +static const char *stopcmd[] = { "mpc", "stop", NULL }; static const Key keys[] = { /* modifier key function argument */ + { Mod4Mask, XK_p, togglepass, {0} }, { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY|ShiftMask, XK_s, spawn, {.v = suspendcmd } }, diff --git a/suckless/dwm/dwm.c b/suckless/dwm/dwm.c index 9593de0..14d9d19 100644 --- a/suckless/dwm/dwm.c +++ b/suckless/dwm/dwm.c @@ -243,6 +243,7 @@ static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void togglepass(); static pid_t getparentprocess(pid_t p); static int isdescprocess(pid_t p, pid_t c); @@ -806,8 +807,8 @@ drawbar(Monitor *m) if ((w = m->ww - tw - x) > bh) { if (m->sel) { - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); + drw_setscheme(drw, scheme[m == selmon ? SchemeNorm : SchemeNorm]); + drw_text(drw, x, 0, m->ww/3, bh, lrpad / 2, m->sel->name, 0); if (m->sel->isfloating) drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); } else { @@ -1075,11 +1076,14 @@ keypress(XEvent *e) ev = &e->xkey; keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); - for (i = 0; i < LENGTH(keys); i++) + for (i = 0; i < LENGTH(keys); i++) { + if (passthrough && keys[i].func != togglepass) + break; if (keysym == keys[i].keysym && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && keys[i].func) keys[i].func(&(keys[i].arg)); + } } void @@ -2361,6 +2365,12 @@ zoom(const Arg *arg) pop(c); } +void +togglepass() +{ + passthrough = !passthrough; +} + int main(int argc, char *argv[]) {