Skip to content

Commit

Permalink
nixos/hypridle: only run the service on Hyprland
Browse files Browse the repository at this point in the history
`/run/user/1000/hypr` directory is only created if a Hyprland session is active.

`%U` gets the UID of the current user.
Link: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html

Finally closes NixOS#347651
  • Loading branch information
JohnRTitor committed Nov 12, 2024
1 parent ae8c3f2 commit 7bcef72
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nixos/modules/services/wayland/hypridle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ in
systemd = {
packages = [ cfg.package ];
user.services.hypridle.wantedBy = [ "graphical-session.target" ];
# Essential package needed for the service to run properly
user.services.hypridle.path = [
config.programs.hyprland.package
config.programs.hyprlock.package
pkgs.procps
];
# Should only be started if a Hyprland session is active
user.services.hypridle.unitConfig.ConditionPathIsDirectory = "/run/user/%U/hypr";
};
};

Expand Down

0 comments on commit 7bcef72

Please sign in to comment.