From 611460c6a6d72876d306e54bdba475d0e7f19676 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Fri, 6 Sep 2019 23:37:30 +0200 Subject: [PATCH] Adding autostart patch --- README.md | 5 ++++- dwm.c | 3 +++ patch/autostart.c | 10 ++++++++++ patch/autostart.h | 1 + patch/include.c | 4 ++++ patch/include.h | 4 ++++ patches.h | 14 +++++++++++--- 7 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 patch/autostart.c create mode 100644 patch/autostart.h diff --git a/README.md b/README.md index da7ede7..76a150b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-09-06 - Added attachabove, attachaside, attachbelow and attachbottom patches +2019-09-06 - Added attachabove, attachaside, attachbelow, attachbottom and autostart patches 2019-09-05 - Alpha, systray, togglefullscreen, tagallmon, tagmonfixfs, tagswapmon, pertag and zoomswap patches added @@ -32,6 +32,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [attachbottom](https://dwm.suckless.org/patches/attachbottom/) - new windows are placed at the bottom of the stack + - [autostart](https://dwm.suckless.org/patches/autostart/) + - makes dwm run `~/.dwm/autostart_blocking.sh` and `~/.dwm/autostart.sh &` on startup + - [pertag](https://dwm.suckless.org/patches/pertag/) - adds nmaster, mfact, layouts and more per tag rather than per monitor diff --git a/dwm.c b/dwm.c index 2c379c2..62f6274 100644 --- a/dwm.c +++ b/dwm.c @@ -2614,6 +2614,9 @@ main(int argc, char *argv[]) die("pledge"); #endif /* __OpenBSD__ */ scan(); + #if AUTOSTART_PATCH + runAutostart(); + #endif run(); cleanup(); XCloseDisplay(dpy); diff --git a/patch/autostart.c b/patch/autostart.c new file mode 100644 index 0000000..c61ea7f --- /dev/null +++ b/patch/autostart.c @@ -0,0 +1,10 @@ +void +runAutostart(void) { + + int ret; + + ret = system("cd ~/.config/dwm; ./autostart_blocking.sh"); + ret = system("cd ~/.config/dwm; ./autostart.sh &"); + + if (ret); // ignore, hide compilation warnings +} \ No newline at end of file diff --git a/patch/autostart.h b/patch/autostart.h new file mode 100644 index 0000000..6058a3d --- /dev/null +++ b/patch/autostart.h @@ -0,0 +1 @@ +static void runAutostart(void); \ No newline at end of file diff --git a/patch/include.c b/patch/include.c index ebf5e3c..fa6c20b 100644 --- a/patch/include.c +++ b/patch/include.c @@ -6,6 +6,10 @@ #include "attachx.c" #endif +#if AUTOSTART_PATCH +#include "autostart.c" +#endif + #if PERTAG_PATCH #include "pertag.c" #endif diff --git a/patch/include.h b/patch/include.h index 29785e1..295ee77 100644 --- a/patch/include.h +++ b/patch/include.h @@ -6,6 +6,10 @@ #include "attachx.h" #endif +#if AUTOSTART_PATCH +#include "autostart.h" +#endif + #if SYSTRAY_PATCH #include "systray.h" #endif diff --git a/patches.h b/patches.h index 60e3801..9ebacb1 100644 --- a/patches.h +++ b/patches.h @@ -36,10 +36,13 @@ */ #define ATTACHBOTTOM_PATCH 0 -/* The systray patch adds systray for the status bar. - * https://dwm.suckless.org/patches/systray/ +/* This patch will make dwm run "~/.config/dwm/autostart_blocking.sh" and + * "~/.config/dwm/autostart.sh &" before entering the handler loop. One or + * both of these files can be ommited. Note the path inside .config rather + * than the original ~/.dwm folder. + * https://dwm.suckless.org/patches/autostart/ */ -#define SYSTRAY_PATCH 0 +#define AUTOSTART_PATCH 0 /* The pertag patch adds nmaster, mfacts and layouts per tag rather * than per monitor (default). @@ -52,6 +55,11 @@ */ #define PERTAGBAR_PATCH 0 +/* The systray patch adds systray for the status bar. + * https://dwm.suckless.org/patches/systray/ + */ +#define SYSTRAY_PATCH 0 + /* This patch allows you to move all visible windows on a monitor to an adjacent monitor. * https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-tagallmon-6.2.diff */