From 089a362d7397bd52536cae90d1eb09cb1d06c86e Mon Sep 17 00:00:00 2001 From: Tobias Bengfort Date: Sat, 6 Sep 2025 12:46:52 +0200 Subject: [PATCH] add autostart with permissions --- include/config/rcxml.h | 2 ++ src/config/rcxml.c | 3 +++ src/config/session.c | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/include/config/rcxml.h b/include/config/rcxml.h index 50874571..8243f2cb 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -187,6 +187,8 @@ struct rcxml { struct wl_list window_rules; /* struct window_rule.link */ + struct wl_list autostart; /* struct action.link */ + /* Menu */ unsigned int menu_ignore_button_release_period; bool menu_show_icons; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 6ed1522b..ef092dbf 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1042,6 +1042,8 @@ entry(xmlNode *node, char *nodename, char *content) /* handle nested nodes */ if (!strcasecmp(nodename, "margin")) { fill_usable_area_override(node); + } else if (!strcasecmp(nodename, "autostart")) { + append_parsed_actions(node, &rc.autostart); } else if (!strcasecmp(nodename, "keybind.keyboard")) { fill_keybind(node); } else if (!strcasecmp(nodename, "context.mouse")) { @@ -1358,6 +1360,7 @@ rcxml_init(void) if (!has_run) { wl_list_init(&rc.usable_area_overrides); + wl_list_init(&rc.autostart); wl_list_init(&rc.keybinds); wl_list_init(&rc.mousebinds); wl_list_init(&rc.libinput_categories); diff --git a/src/config/session.c b/src/config/session.c index d0885c6e..5113156f 100644 --- a/src/config/session.c +++ b/src/config/session.c @@ -11,6 +11,7 @@ #include #include #include +#include "action.h" #include "common/buf.h" #include "common/dir.h" #include "common/file-helpers.h" @@ -286,6 +287,13 @@ session_environment_init(void) paths_destroy(&paths); } +static void +session_run_rc_autostart(struct server *server) +{ + wlr_log(WLR_INFO, "run autostart actions"); + actions_run(NULL, server, &rc.autostart, NULL); +} + void session_run_script(const char *script) { @@ -318,6 +326,7 @@ session_autostart_init(struct server *server) { /* Update dbus and systemd user environment, each may fail gracefully */ update_activation_env(server, /* initialize */ true); + session_run_rc_autostart(server); session_run_script("autostart"); }