add hyprland configs
This commit is contained in:
27
.config/hypr/hyprlock/scripts/battery.sh
Executable file
27
.config/hypr/hyprlock/scripts/battery.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the current battery percentage
|
||||
battery_percentage=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
|
||||
# Get the battery status (Charging or Discharging)
|
||||
battery_status=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
# Define the battery icons for each 10% segment
|
||||
battery_icons=("" "" "" "" "" "" "" "" "" "")
|
||||
|
||||
# Define the charging icon
|
||||
charging_icon=""
|
||||
|
||||
# Calculate the index for the icon array
|
||||
icon_index=$((battery_percentage / 10))
|
||||
|
||||
# Get the corresponding icon
|
||||
battery_icon=${battery_icons[icon_index]}
|
||||
|
||||
# Check if the battery is charging
|
||||
if [ "$battery_status" = "Charging" ]; then
|
||||
battery_icon="$charging_icon"
|
||||
fi
|
||||
|
||||
# Output the battery percentage and icon
|
||||
echo "$battery_percentage% $battery_icon"
|
Reference in New Issue
Block a user