Add old dotfiles
This commit is contained in:
commit
1cace80e48
192 files changed
+13538
No files matched your search
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
BATTERY_PATH="/sys/class/power_supply/BAT0"
|
||||
|
||||
# Check if the battery is present
|
||||
if [ -d "$BATTERY_PATH" ]; then
|
||||
# Get battery status (Charging, Discharging, Full, etc.)
|
||||
status=$(cat "$BATTERY_PATH/status")
|
||||
|
||||
# Get battery percentage
|
||||
capacity=$(cat "$BATTERY_PATH/capacity")
|
||||
|
||||
# Set default icon and color
|
||||
icon=""
|
||||
color=""
|
||||
|
||||
# Determine icon based on battery status
|
||||
if [ "$status" == "Charging" ]; then
|
||||
icon="" # Charging icon
|
||||
else
|
||||
icon="" # Discharging icon
|
||||
fi
|
||||
|
||||
# Determine color based on battery percentage
|
||||
if [ "$capacity" -le 20 ]; then
|
||||
color="<fc=#f38ba8>" # Red
|
||||
elif [ "$capacity" -le 50 ]; then
|
||||
color="<fc=#fab387>" # Orange
|
||||
elif [ "$capacity" -le 79 ]; then
|
||||
color="<fc=#f9e2af>" # Yellow
|
||||
else
|
||||
color="<fc=#a6e3a1>" # Green
|
||||
fi
|
||||
|
||||
# Display battery information with icon and color
|
||||
echo "$color$icon $capacity%</fc>"
|
||||
else
|
||||
echo "Battery not found."
|
||||
fi
|
||||
Reference in new issue
Block a user