feat: add i3-style session-specific autostart support and documentation

This commit is contained in:
Luxferre committed 2026-11-26 11:55:17 +02:00
1 parent f73040a0be
commit 8d6236a63f
13 files changed
+1156 -8

No files matched your search

+2 -1
View File
@@ -93,6 +93,7 @@ static const char *mednextcmd[] = { "anode-media-key", "next", NULL };
static const char *medstopcmd[] = { "anode-media-key", "stop", NULL };
static const char *airplanecmd[] = { "anode-media-key", "airplane", NULL };
static const char *suspendcmd[] = { "anode-media-key", "suspend", NULL };
static const char *autostartreloadcmd[] = { "anode-autostart", "reload", NULL };
static const Key keys[] = {
/* modifier key function argument */
@@ -168,7 +169,7 @@ static const Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1} },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1} },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1} },
{ MODKEY|ShiftMask, XK_r, reloadxres, {0} },
{ MODKEY|ShiftMask, XK_r, reloadxres, {.i = 1} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
+2 -1
View File
@@ -93,6 +93,7 @@ static const char *mednextcmd[] = { "anode-media-key", "next", NULL };
static const char *medstopcmd[] = { "anode-media-key", "stop", NULL };
static const char *airplanecmd[] = { "anode-media-key", "airplane", NULL };
static const char *suspendcmd[] = { "anode-media-key", "suspend", NULL };
static const char *autostartreloadcmd[] = { "anode-autostart", "reload", NULL };
static const Key keys[] = {
/* modifier key function argument */
@@ -168,7 +169,7 @@ static const Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1} },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1} },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1} },
{ MODKEY|ShiftMask, XK_r, reloadxres, {0} },
{ MODKEY|ShiftMask, XK_r, reloadxres, {.i = 1} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
+13
View File
@@ -1295,6 +1295,10 @@ static void reloadxres(const Arg *arg) {
arrange(NULL);
drawbars();
XSync(dpy, False);
if (arg && arg->i) {
Arg a = {.v = autostartreloadcmd};
spawn(&a);
}
}
static void manage(Window w, XWindowAttributes *wa) {
@@ -2750,10 +2754,19 @@ int main(int argc, char *argv[]) {
checkotherwm();
setup();
scan();
{
const char *rs = getenv("ANODE_DWM_RESTARTED");
if (rs && rs[0] == '1') {
unsetenv("ANODE_DWM_RESTARTED");
Arg a = {.v = autostartreloadcmd};
spawn(&a);
}
}
run();
cleanup();
XCloseDisplay(dpy);
if (restart_dwm) {
setenv("ANODE_DWM_RESTARTED", "1", 1);
execvp(argv[0], argv);
}
return EXIT_SUCCESS;