feat(hyprlock): update

This commit is contained in:
2026-02-25 01:35:25 +01:00
parent 566513de78
commit 74dda82f24
10 changed files with 115 additions and 24 deletions

55
hypr/scripts/battery.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -euo pipefail
# Find battery + AC device (works on most laptops)
BAT="$(ls -1 /sys/class/power_supply 2>/dev/null | grep -E '^BAT|^CMB|^BATT' | head -n1 || true)"
AC="$(ls -1 /sys/class/power_supply 2>/dev/null | grep -E '^AC|^ADP|^ACAD' | head -n1 || true)"
if [[ -z "${BAT}" ]]; then
echo " --%" # unknown
exit 0
fi
BAT_PATH="/sys/class/power_supply/${BAT}"
STATUS="$(<"${BAT_PATH}/status")" # Charging|Discharging|Full|Not charging|Unknown
CAPACITY="$(<"${BAT_PATH}/capacity")" # 0-100
#  0-10,  11-35,  36-60,  61-85,  86-100
if ((CAPACITY <= 10)); then
if [[ "${STATUS}" == "Charging" ]]; then
ICON="󰢜 "
else
ICON="󰁺 "
fi
elif ((CAPACITY <= 30)); then
if [[ "${STATUS}" == "Charging" ]]; then
ICON="󰂇 "
else
ICON="󰁼 "
fi
elif ((CAPACITY <= 60)); then
if [[ "${STATUS}" == "Charging" ]]; then
ICON="󰂉 "
else
ICON="󰁿 "
fi
elif ((CAPACITY <= 80)); then
if [[ "${STATUS}" == "Charging" ]]; then
ICON="󰂊 "
else
ICON="󰂁 "
fi
else
if [[ "${STATUS}" == "Charging" ]]; then
ICON="󰂅 "
else
ICON="󰁹 "
fi
fi
# If full, show a nicer indicator
if [[ "${STATUS}" == "Full" ]]; then
CHG_IND=" " # nf-fa-check
fi
echo "${ICON} ${CAPACITY}%"