diff --git a/nixos/homes/kylekrein/niri.nix b/nixos/homes/kylekrein/niri.nix index c51c5e4..6804dfb 100644 --- a/nixos/homes/kylekrein/niri.nix +++ b/nixos/homes/kylekrein/niri.nix @@ -232,14 +232,15 @@ niri = lib.getExe config.programs.niri.package; loginctl = "${pkgs.systemd}/bin/loginctl"; locking-script = "pidof hyprlock || ${lib.getExe pkgs.hyprlock}"; + systemctl = "${pkgs.systemd}/bin/systemctl"; #locking-script = "${pkgs.swaylock}/bin/swaylock --daemonize"; #unlocking-script = "pkill -SIGUSR1 swaylock"; - suspendScript = pkgs.writeShellScript "suspend-script" '' + suspendScript = cmd: pkgs.writeShellScript "suspend-script" '' # check if any player has status "Playing" ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q # only suspend if nothing is playing if [ $? == 1 ]; then - ${pkgs.systemd}/bin/systemctl suspend + ${cmd} fi ''; in{ @@ -247,11 +248,11 @@ in{ events = [ { event = "before-sleep"; - command = "pidof hyprlock || ${loginctl} lock-session;${niri} msg action power-off-monitors"; + command = "pidof hyprlock || ${loginctl} lock-session;#${niri} msg action power-off-monitors"; } { event = "after-resume"; - command = "${niri} msg action power-on-monitors"; + command = "#${niri} msg action power-on-monitors"; } { event = "lock"; @@ -263,19 +264,21 @@ in{ #} ]; timeouts = let - secondary = "${suspendScript}"; + secondary = "${systemctl} suspend"; in[ - { - timeout = 30; - command = "pidof hyprlock && ${secondary}"; - } + #{ + # timeout = 30; + # command = "pidof hyprlock && ${secondary}"; + #} { timeout = 300; - command = "${locking-script}"; + command = "${suspendScript ''${pkgs.libnotify}/bin/notify-send "You are idle. Going to sleep in 30 seconds"''}"; + #command = "${locking-script}"; } { timeout = 330; - command = "pidof hyprlock && ${secondary}"; + command = "${suspendScript "${systemctl} suspend"}"; + #command = "pidof hyprlock && ${secondary}"; } ]; }; diff --git a/nixos/modules/niri/default.nix b/nixos/modules/niri/default.nix index d1d126b..bfa4513 100644 --- a/nixos/modules/niri/default.nix +++ b/nixos/modules/niri/default.nix @@ -7,8 +7,6 @@ inputs.niri-flake.nixosModules.niri ]; security.pam.services.hyprlock = {}; - systemd.user.extraConfig = '' DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:$PATH" - ''; programs.niri = { enable = true; package = pkgs.niri-unstable;