- Add configs for goose, herdr, ostt, fabric, zero, gnupg - Restructure pi models.json (dupont, obelix, bianca, cloudflare) - Update pi settings with new provider lineup, subagent overrides - Add pi permission system, search config - Add desktop entries (RampClient, terminal, tmux) - Add tmux-open script, rename battery.sh -> battery - Refactor fish config (simplify conditionals, fix nvim aliases) - Switch worktrunk commit command from opencode to pi - Update mise.toml with new tool symlinks - Fix mise auth.json path reference
30 lines
780 B
Bash
Executable File
30 lines
780 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
# macOS
|
|
BATTERY=$(pmset -g batt | grep -Eo '[0-9]+%' | head -1 | tr -d '%')
|
|
CHARGING=$(pmset -g batt | grep -c 'AC Power')
|
|
else
|
|
BATTERY=$(cat /sys/class/power_supply/BAT0/capacity 2>/dev/null || upower -i $(upower -e | grep BAT) | grep percentage | awk '{print $2}' | tr -d '%')
|
|
CHARGING=$(cat /sys/class/power_supply/BAT0/status 2>/dev/null | grep -c 'Charging')
|
|
fi
|
|
|
|
if [[ -z "$BATTERY" ]]; then
|
|
echo "🔋 N/A"
|
|
exit 0
|
|
fi
|
|
|
|
# Choose icon based on level
|
|
if [[ "$CHARGING" -gt 0 ]]; then
|
|
ICON="⚡"
|
|
elif [[ "$BATTERY" -ge 80 ]]; then
|
|
ICON="🔋"
|
|
elif [[ "$BATTERY" -ge 40 ]]; then
|
|
ICON="🔋"
|
|
elif [[ "$BATTERY" -ge 20 ]]; then
|
|
ICON="🪫"
|
|
else
|
|
ICON="🪫"
|
|
fi
|
|
|
|
echo "$ICON ${BATTERY}%" |