From 3a5ddaa025fceb37aeeebd27cd1da5f7a6bd1657 Mon Sep 17 00:00:00 2001 From: ooks-io Date: Mon, 31 Jul 2023 20:18:42 +1200 Subject: [PATCH] added fix for systemd hyprland cred to alebastr/misterio77 --- .../ooks/opt/desktop/hyprland/systemd-fix.nix | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 home/ooks/opt/desktop/hyprland/systemd-fix.nix diff --git a/home/ooks/opt/desktop/hyprland/systemd-fix.nix b/home/ooks/opt/desktop/hyprland/systemd-fix.nix new file mode 100644 index 0000000..f2b5e9b --- /dev/null +++ b/home/ooks/opt/desktop/hyprland/systemd-fix.nix @@ -0,0 +1,30 @@ +{ lib, config, ... }: +let + cfg = config.wayland.windowManager.hyprland; +in +{ + config = lib.mkIf (cfg.enable && cfg.systemdIntegration) { + # Stolen from https://github.com/alebastr/sway-systemd/commit/0fdb2c4b10beb6079acd6073c5b3014bd58d3b74 + systemd.user.targets.hyprland-session-shutdown = { + Unit = { + Description = "Shutdown running Hyprland session"; + DefaultDependencies = "no"; + StopWhenUnneeded = "true"; + + Conflicts = [ + "graphical-session.target" + "graphical-session-pre.target" + "hyprland-session.target" + ]; + After = [ + "graphical-session.target" + "graphical-session-pre.target" + "hyprland-session.target" + ]; + }; + }; + wayland.windowManager.hyprland.settings.bind = lib.mkAfter [ + "SUPERSHIFT,e,exec,systemctl --user start hyprland-session-shutdown.target; hyprctl dispatch exit" + ]; + }; +}