From f55718aec361f6a5101f07e3203106f85d6cad20 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.enableXdgAutostart 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 --- modules/services/window-managers/hyprland.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 4f1c9e92..ff162fb3 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -102,6 +102,10 @@ in { ]; description = "Extra commands to be run after D-Bus activation."; }; + + enableXdgAutostart = lib.mkEnableOption '' + autostart of applications using + {manpage}`systemd-xdg-autostart-generator(8)`''; }; xwayland.enable = lib.mkEnableOption "XWayland" // { default = true; }; @@ -247,8 +251,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.enableXdgAutostart + "xdg-desktop-autostart.target"; After = [ "graphical-session-pre.target" ]; + Before = lib.mkIf cfg.systemd.enableXdgAutostart + [ "xdg-desktop-autostart.target" ]; }; };