Skip to content

Commit

Permalink
nixos/hyprland: only run the service on Hyprland
Browse files Browse the repository at this point in the history
This needs uwsm enabled. You can do so by setting `programs.hyprland.withUWSM = true`
  • Loading branch information
JohnRTitor committed Nov 17, 2024
1 parent ebada93 commit a58ba43
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions nixos/modules/services/wayland/hypridle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,31 @@ let
in
{
options.services.hypridle = {
enable = lib.mkEnableOption "hypridle, Hyprland's idle daemon";
enable = lib.mkEnableOption null // {
description = ''
Whether to enable Hypridle, Hyprland's idle daemon.
::: {.note}
For this service to work properly on Hyprland, you
need to have `programs.hyprland.withUWSM` enabled.
:::
'';
};
package = lib.mkPackageOption pkgs "hypridle" { };
};

config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];

systemd = {
packages = [ cfg.package ];
user.services.hypridle.wantedBy = [ "graphical-session.target" ];
user.services.hypridle.path = [
systemd.packages = [ cfg.package ];

systemd.user.services.hypridle = {
# Service should be only be started on Hyprland
# this target is started by UWSM
wantedBy = [ "[email protected]" ];

# Essential package needed for the service to run properly
path = [
config.programs.hyprland.package
config.programs.hyprlock.package
pkgs.procps
Expand Down

0 comments on commit a58ba43

Please sign in to comment.