1755d17558
- Disable fingerprint auth (GDM holds the device; hyprlock can't claim it, blocking the auth thread). - Fix date format escaping (single quotes). - Add battery, weather, and latest mako notification labels. - Add hyprlock wrapper (crash guard), battery script, notifications script, and weather script.
40 lines
909 B
Bash
Executable File
40 lines
909 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Battery status for the hyprlock screen, e.g. " 18%".
|
|
# Uses the first battery found under /sys/class/power_supply (BAT0/BAT1, ...);
|
|
# prints nothing on desktops without a battery.
|
|
set -u
|
|
|
|
bat=""
|
|
for b in /sys/class/power_supply/BAT*; do
|
|
if [ -r "${b}/capacity" ]; then
|
|
bat="${b}"
|
|
break
|
|
fi
|
|
done
|
|
|
|
[ -z "${bat}" ] && exit 0
|
|
|
|
cap="$(cat "${bat}/capacity" 2>/dev/null || echo 0)"
|
|
status="$(cat "${bat}/status" 2>/dev/null || echo Unknown)"
|
|
|
|
case "${status}" in
|
|
Charging|Full)
|
|
icon=""
|
|
;;
|
|
*)
|
|
if [ "${cap}" -ge 80 ]; then
|
|
icon=""
|
|
elif [ "${cap}" -ge 60 ]; then
|
|
icon=""
|
|
elif [ "${cap}" -ge 40 ]; then
|
|
icon=""
|
|
elif [ "${cap}" -ge 20 ]; then
|
|
icon=""
|
|
else
|
|
icon=""
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
printf '%s %s%%' "${icon}" "${cap}"
|