nix-config/home/gburd/features/desktop/hyprland/systemd-fixes.nix
Greg Burd f3fd89af54
A fork of Misterio77 and his standard template.
Many thangs to the hard work and generous availability of:
git@github.com:Misterio77/nix-config.git
2023-09-15 10:53:38 -04:00

30 lines
937 B
Nix

{ 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"
];
};
}