From 0a9742429d80b0b9faacdebf306df377733f0a41 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sun, 14 Apr 2024 01:12:48 +0200 Subject: [PATCH] Fix power-profile auto-switch --- .../laptop/power/auto-cpufreq/power-profiles-daemon/default.nix | 1 + .../auto-cpufreq/power-profiles-daemon/scripts/power_monitor.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/default.nix b/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/default.nix index 6ab2ece..de4ac73 100644 --- a/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/default.nix +++ b/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/default.nix @@ -19,6 +19,7 @@ in { systemd.services."power-monitor" = let dependencies = with pkgs; [ coreutils + gnugrep power-profiles-daemon inotify-tools jaq diff --git a/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/scripts/power_monitor.sh b/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/scripts/power_monitor.sh index 7ecae89..2953d46 100644 --- a/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/scripts/power_monitor.sh +++ b/system/roles/laptop/power/auto-cpufreq/power-profiles-daemon/scripts/power_monitor.sh @@ -6,7 +6,7 @@ BAT_CAP="$BAT/capacity" POWER_SAVE_PERCENT=50 # Enter power-save mode if on bat and below this capacity -HAS_PERFORMANCE="$(powerprofilesctl list | grep performance)" +HAS_PERFORMANCE="$(powerprofilesctl list | grep "performance" || true)" # the || true ignores grep failing with non-zero code # monitor loop prev=0