From 74d0331c5bbaa90f214eb0f4e882115313f5f914 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Fri, 9 Feb 2024 18:09:33 +0100 Subject: [PATCH] hyprland: add support for XDG autostart using systemd Using the option `wayland.windowManager.hyprland.systemd.xdgAutostart`, users can now choose to start applications present in `$XDG_CONFIG_HOME/autostart` when starting their sway session. See 0144ac418ef633bfc9dbd89b8c199ad3a617c59f and https://github.com/nix-community/home-manager/pull/3747 Signed-off-by: Sefa Eyeoglu --- modules/services/window-managers/hyprland.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 168bab659..2d52c7622 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -103,6 +103,11 @@ in { ]; description = "Extra commands to be run after D-Bus activation."; }; + + xdgAutostart = lib.mkEnableOption '' + autostart of applications using + {manpage}`systemd-xdg-autostart-generator(8)` + ''; }; xwayland.enable = lib.mkEnableOption "XWayland" // { default = true; }; @@ -262,8 +267,12 @@ in { Description = "Hyprland compositor session"; Documentation = [ "man:systemd.special(7)" ]; BindsTo = [ "graphical-session.target" ]; - Wants = [ "graphical-session-pre.target" ]; + Wants = [ "graphical-session-pre.target" ] + ++ lib.optional cfg.systemd.xdgAutostart + "xdg-desktop-autostart.target"; After = [ "graphical-session-pre.target" ]; + Before = + lib.mkIf cfg.systemd.xdgAutostart [ "xdg-desktop-autostart.target" ]; }; };