portable/check-battery: add DBUS env to fix notifications
This commit is contained in:
parent
cb4c54ce38
commit
b3ff15b0a4
|
@ -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"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
''
|
||||
|
|
Loading…
Reference in a new issue