myvxwm

[fork] my vxwm config (optimised for my T480)
git clone https://git.lukeonline.net/repos/myvxwm
Log | Files | Refs | README | LICENSE

commit ef143d48e51064116539bf4ef2427b07247bfe60
parent 620f2471438412208f51b283b8ce08681589f23c
Author: wh1tepearl <wh1tepearl@gmail.com>
Date:   Sun,  8 Mar 2026 17:49:20 +0000

Support for autostart, thanks d8dr for runautostart function implementation

Diffstat:
Mconfig.def.h | 9+++++++++
Mmodules.def.h | 1+
Amodules/autostart/autostart.c | 18++++++++++++++++++
Amodules/autostart/autostart.h | 1+
Mmodules/vxwm_includes.c | 4++++
Mmodules/vxwm_includes.h | 4++++
Mrvx | 4++--
Mvxwm.c | 12+++++++++++-
8 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -72,6 +72,15 @@ static const char *occupiedtags[] = { "1+", "2+", "3+", "4+", "5+", "6+", "7+", #define RESIZE_WITH_KEYBOARD_STEP 50 /* Defines by how many pixels windows will be resized with keyboard */ #endif +#if AUTOSTART +/* vxwm will execute this on startup (can be skipped with -ignoreautostart vxwm flag). */ + +static const char *const autostart[] = { + "st", + NULL /* must end with NULL */ +}; +#endif + static const Rule rules[] = { /* xprop(1): * WM_CLASS(STRING) = instance, class diff --git a/modules.def.h b/modules.def.h @@ -75,6 +75,7 @@ Even though this sounds complex, it is actually pretty lightweight ~250 l.o.c, a /* Misc */ +#define AUTOSTART 0 // Support for vxwm being able to start apps defined in config.h in startup. #define FULLSCREEN 0 // Support for toggling fullscreen. #define MOVE_IN_TILED 0 // Support for moving windows in tiled mode. #define EWMH_TAGS 0 // Support for EWMH tags, recommended if you want to use external bars with less pain diff --git a/modules/autostart/autostart.c b/modules/autostart/autostart.c @@ -0,0 +1,18 @@ +void +runautostart(void) +{ + const char *const *cmd = autostart; + + if (fork() == 0) { + setsid(); + + while (*cmd != NULL) { + if (fork() == 0) { + execl("/bin/sh", "sh", "-c", *cmd, NULL); + exit(1); + } + cmd++; + } + exit(0); + } +} diff --git a/modules/autostart/autostart.h b/modules/autostart/autostart.h @@ -0,0 +1 @@ +static void runautostart(void); diff --git a/modules/vxwm_includes.c b/modules/vxwm_includes.c @@ -47,3 +47,7 @@ #if DIRECTIONAL_MOVE #include "directionalmove/directionalmove.c" #endif + +#if AUTOSTART +#include "autostart/autostart.c" +#endif diff --git a/modules/vxwm_includes.h b/modules/vxwm_includes.h @@ -43,3 +43,7 @@ #if DIRECTIONAL_MOVE #include "directionalmove/directionalmove.h" #endif + +#if AUTOSTART +#include "autostart/autostart.h" +#endif diff --git a/rvx b/rvx @@ -7,12 +7,12 @@ fi if [ $arg = "-d" ]; then killall vxwm 2>/dev/null - dbus-run-session vxwm + dbus-run-session vxwm -ignoreautostart elif [ $arg = "-h" ]; then echo "rvx: A tool designed for quickly restarting vxwm" echo "rvx -d: Restarts vxwm with dbus-run-session" echo "rvx -h: Show this message" else killall vxwm 2>/dev/null - vxwm + vxwm -ignoreautostart fi diff --git a/vxwm.c b/vxwm.c @@ -2730,8 +2730,14 @@ main(int argc, char *argv[]) die("vxwm - "VERSION); if (argc == 2 && !strcmp("-srcdir", argv[1])) die(SRCDIR); + if (argc == 2 && !strcmp("-ignoreautostart", argv[1])) + printf("Ignoring autostart"); else if (argc != 1) - die("usage: vxwm [-v] [-srcdir]"); + die("usage: vxwm [-v] [-srcdir]" +#if AUTOSTART + " [-ignoreautostart]" +#endif + ); if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fputs("warning: no locale support\n", stderr); if (!(dpy = XOpenDisplay(NULL))) @@ -2747,6 +2753,10 @@ main(int argc, char *argv[]) die("pledge"); #endif /* __OpenBSD__ */ scan(); +#if AUTOSTART + if (!(argc == 2 && !strcmp("-ignoreautostart", argv[1]))) + runautostart(); +#endif run(); cleanup(); XCloseDisplay(dpy);