This commit is contained in:
2026-08-21 05:08:30 +09:00
parent 717572ae24
commit 95f74aabcd
3 changed files with 10 additions and 1 deletions
+3 -1
View File
@@ -10,6 +10,8 @@ let
brightnessState = "$XDG_RUNTIME_DIR/swayidle-brightness";
onBattery = pkgs.writeShellScript "swayidle-on-battery" ''
[ "''${SWAYIDLE_ASSUME_AC:-0}" = 1 ] && exit 1
for supply in /sys/class/power_supply/*; do
[ -f "$supply/type" ] || continue
[ "$(< "$supply/type")" = "Battery" ] || continue
@@ -45,7 +47,7 @@ let
'';
suspend = pkgs.writeShellScript "swayidle-suspend" ''
if ${onBattery}; then
if ${onBattery} || ${isLocked}; then
exec ${systemctl} suspend
fi
'';