All checks were successful
Update PKGBUILD version / update-pkgver (push) Successful in 2s
Laptops with charge_control_end_threshold support get a click-to-toggle on the battery module (80% ↔ 100%). A ♥ icon appears when conservation is active, hidden when inactive. State persists across reboots via systemd oneshot service. udev rule grants wheel group write access so no sudo is needed for toggling.
20 lines
692 B
Bash
Executable File
20 lines
692 B
Bash
Executable File
#!/usr/bin/bash
|
|
# ABOUTME: Waybar module showing battery conservation mode status.
|
|
# ABOUTME: Outputs heart icon when active (threshold ≤80), empty when inactive.
|
|
|
|
THRESHOLD_FILE="/sys/class/power_supply/BAT0/charge_control_end_threshold"
|
|
|
|
# No battery threshold support → no output → Waybar hides module
|
|
[[ -f "$THRESHOLD_FILE" ]] || exit 0
|
|
|
|
THRESHOLD=$(cat "$THRESHOLD_FILE")
|
|
|
|
if [[ "$THRESHOLD" -le 80 ]]; then
|
|
jq --compact-output -n \
|
|
--arg text "♥" \
|
|
--arg tooltip "Battery Conservation: ON (limit ${THRESHOLD}%)" \
|
|
--arg class "on" \
|
|
'{text: $text, tooltip: $tooltip, class: $class}'
|
|
fi
|
|
# Threshold > 80 → no output → Waybar hides module
|