portable/check-battery: add DBUS env to fix notifications

feat/authelia
Benjamin Yule Bädorf 2024-03-29 14:12:52 +01:00
parent cb4c54ce38
commit b3ff15b0a4
Signed by: b12f
GPG Key ID: 729956E1124F8F26
2 changed files with 2 additions and 1 deletions

View File

@ -3,7 +3,7 @@
services.cron = {
enable = true;
systemCronJobs = [
"*/5 * * * * root ${pkgs.check-battery}/bin/check-battery"
"*/5 * * * * b12f ${pkgs.check-battery}/bin/check-battery"
];
};
}

View File

@ -7,6 +7,7 @@ fi
capacity=$(cat /sys/class/power_supply/BAT0/capacity)
if [ $capacity -lt 20 ]; then
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
${libnotify}/bin/notify-send -u critical "Battery ''${capacity}%"
fi
''