From 2f4c2a68a1cbebb0e06a5b3296e4bbb575c5fcb2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 5 Nov 2018 17:51:24 -0500 Subject: scripts sorted --- .scripts/cron/cronbat | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 .scripts/cron/cronbat (limited to '.scripts/cron/cronbat') diff --git a/.scripts/cron/cronbat b/.scripts/cron/cronbat new file mode 100755 index 0000000..c09ff42 --- /dev/null +++ b/.scripts/cron/cronbat @@ -0,0 +1,8 @@ +#!/bin/sh +# Notify me with notify-send if my battery is below 25%. +# You can set this to run via cron. + +[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit +[ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] && +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus && +notify-send -u critical "Battery critically low." -- cgit v1.3.1