commit bd359c077858b6201ded9a37c38e61f690e01a6e
parent 5c5b9056c30c7eae7fbbf7af1043b01960e966cd
Author: Matthew Carlson <matt@mcarlson.xyz>
Date: Mon, 12 Jul 2021 02:26:59 +0000
Merge branch 'tweaks' into dwm
Diffstat:
M | config.h | | | 47 | +++-------------------------------------------- |
M | dwm.c | | | 12 | ++++++++++++ |
M | dwmc | | | 2 | +- |
A | dwmc.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}));
+}