From 130e628ab35de45226fb5b88f103c1938dacfc63 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sun, 24 Aug 2025 14:02:11 +0900 Subject: modified .gnupg/gpg-agent.conf, created sketchybar/ --- mac/.config/sketchybar/plugins/battery.sh | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 mac/.config/sketchybar/plugins/battery.sh (limited to 'mac/.config/sketchybar/plugins/battery.sh') diff --git a/mac/.config/sketchybar/plugins/battery.sh b/mac/.config/sketchybar/plugins/battery.sh new file mode 100755 index 0000000..72535e2 --- /dev/null +++ b/mac/.config/sketchybar/plugins/battery.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# Source colors for consistent theming +source "$CONFIG_DIR/colors.sh" + +# Get battery information +BATTERY_INFO=$(pmset -g batt | grep -Eo "[0-9]+%" | cut -d% -f1) +POWER_SOURCE=$(pmset -g ps | head -1) + +# Check if charging +if [[ $POWER_SOURCE == *"AC Power"* ]]; then + CHARGING=true +else + CHARGING=false +fi + +# Set battery level +BATTERY_LEVEL=$BATTERY_INFO + +# Determine icon and color based on battery level and charging status +if [[ $CHARGING == true ]]; then + ICON="󰂄" # Charging icon + COLOR=$ACCENT_SECONDARY +else + if [[ $BATTERY_LEVEL -gt 75 ]]; then + ICON="󰁹" # Full battery + COLOR=$BATTERY_1 + elif [[ $BATTERY_LEVEL -gt 50 ]]; then + ICON="󰁾" # Three quarters + COLOR=$BATTERY_2 + elif [[ $BATTERY_LEVEL -gt 25 ]]; then + ICON="󰁼" # Half battery + COLOR=$BATTERY_3 + elif [[ $BATTERY_LEVEL -gt 10 ]]; then + ICON="󰁻" # Quarter battery + COLOR=$BATTERY_4 + else + ICON="󰁺" # Empty battery + COLOR=$BATTERY_5 + fi +fi + +# Update the battery item +sketchybar --set "$NAME" icon="$ICON" \ + icon.color="$COLOR" \ + label="$BATTERY_LEVEL%" \ + label.color=$WHITE \ + label.font="SF Pro:Medium:13.0" -- cgit v1.2.3