dwm

git clone git://mattcarlson.org/repos/dwm.git
Log | Files | Refs

commit 81932973deb2037e770e979f06eaf147b6a1a854
parent ec3bf10e0367796327307205def64f8dd46e25b0
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Mon, 12 Jul 2021 02:24:20 +0000

moved dwmc functions to separate file; added xrdb reload function for dwmc

Diffstat:
Mconfig.h | 47+++--------------------------------------------
Mdwm.c | 12++++++++++++
Mdwmc | 2+-
Adwmc.c | 41+++++++++++++++++++++++++++++++++++++++++
4 files changed, 57 insertions(+), 45 deletions(-)

diff --git a/config.h b/config.h @@ -197,51 +197,9 @@ static Button buttons[] = { { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; -void -setlayoutex(const Arg *arg) -{ - setlayout(&((Arg) { .v = &layouts[arg->i] })); -} +#include "dwmc.c" -void -viewex(const Arg *arg) -{ - view(&((Arg) { .ui = 1 << arg->ui })); -} - -void -viewall(const Arg *arg) -{ - view(&((Arg){.ui = ~0})); -} - -void -toggleviewex(const Arg *arg) -{ - toggleview(&((Arg) { .ui = 1 << arg->ui })); -} - -void -tagex(const Arg *arg) -{ - tag(&((Arg) { .ui = 1 << arg->ui })); -} - -void -toggletagex(const Arg *arg) -{ - toggletag(&((Arg) { .ui = 1 << arg->ui })); -} - -void -tagall(const Arg *arg) -{ - tag(&((Arg){.ui = ~0})); -} - -/* signal definitions */ -/* signum must be greater than 0 */ -/* trigger signals using `xsetroot -name "fsignal:<signame> [<type> <value>]"` */ +// signals static Signal signals[] = { /* signum function */ { "focusstack", focusstack }, @@ -266,4 +224,5 @@ static Signal signals[] = { { "quit", quit }, { "setlayout", setlayout }, { "setlayoutex", setlayoutex }, + { "reload", reload }, }; diff --git a/dwm.c b/dwm.c @@ -275,6 +275,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); static void xinitvisual(); static void zoom(const Arg *arg); static void load_xresources(void); +static void reload(const Arg *arg); static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst); static pid_t getparentprocess(pid_t p); @@ -2616,6 +2617,17 @@ load_xresources(void) XCloseDisplay(display); } +void +reload(const Arg *arg) +{ + load_xresources(); + int i; + for (i = 0; i < LENGTH(colors); i++) + scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3); + focus(NULL); + arrange(NULL); +} + int main(int argc, char *argv[]) { diff --git a/dwmc b/dwmc @@ -7,7 +7,7 @@ signal() { case $# in 1) case $1 in - setlayout | view | viewall | togglebar | togglefloating | zoom | killclient | quit) + setlayout | view | viewall | togglebar | togglefloating | zoom | killclient | quit | reload) signal $1 ;; *) diff --git a/dwmc.c b/dwmc.c @@ -0,0 +1,41 @@ +void +setlayoutex(const Arg *arg) +{ + setlayout(&((Arg) { .v = &layouts[arg->i] })); +} + +void +viewex(const Arg *arg) +{ + view(&((Arg) { .ui = 1 << arg->ui })); +} + +void +viewall(const Arg *arg) +{ + view(&((Arg){.ui = ~0})); +} + +void +toggleviewex(const Arg *arg) +{ + toggleview(&((Arg) { .ui = 1 << arg->ui })); +} + +void +tagex(const Arg *arg) +{ + tag(&((Arg) { .ui = 1 << arg->ui })); +} + +void +toggletagex(const Arg *arg) +{ + toggletag(&((Arg) { .ui = 1 << arg->ui })); +} + +void +tagall(const Arg *arg) +{ + tag(&((Arg){.ui = ~0})); +}