feat: Add new battery display to lockscreen
This commit is contained in:
@@ -30,7 +30,6 @@ background {
|
|||||||
}
|
}
|
||||||
# TIME
|
# TIME
|
||||||
label {
|
label {
|
||||||
# monitor =
|
|
||||||
text = $TIME
|
text = $TIME
|
||||||
color = rgb(255, 255, 255)
|
color = rgb(255, 255, 255)
|
||||||
font_size = 90
|
font_size = 90
|
||||||
@@ -42,8 +41,7 @@ label {
|
|||||||
|
|
||||||
# Battery
|
# Battery
|
||||||
label {
|
label {
|
||||||
# monitor =
|
text = cmd[update:1000] /home/nathan/.config/hypr/scripts/battery.sh
|
||||||
text = cmd[update:1000] echo " $(cat /sys/class/power_supply/BAT0/capacity)%"
|
|
||||||
color = rgb(255, 255, 255)
|
color = rgb(255, 255, 255)
|
||||||
font_size = 20
|
font_size = 20
|
||||||
font_family = $font
|
font_family = $font
|
||||||
|
|||||||
34
.config/hypr/scripts/battery.sh
Executable file
34
.config/hypr/scripts/battery.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Get current battery level
|
||||||
|
battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||||
|
|
||||||
|
# Get current charging status
|
||||||
|
charging_status=$(cat /sys/class/power_supply/BAT0/status)
|
||||||
|
# Get current power supply type
|
||||||
|
power_supply_type=$(cat /sys/class/power_supply/ADP1/online)
|
||||||
|
|
||||||
|
# Create printable output
|
||||||
|
if [ "$charging_status" = "Charging" ]; then
|
||||||
|
status=""
|
||||||
|
else
|
||||||
|
# Get battery level in percentage
|
||||||
|
if [ "$battery_level" -ge 90 ]; then
|
||||||
|
status=""
|
||||||
|
elif [ "$battery_level" -ge 70 ]; then
|
||||||
|
status=""
|
||||||
|
elif [ "$battery_level" -ge 50 ]; then
|
||||||
|
status=""
|
||||||
|
elif [ "$battery_level" -ge 25 ]; then
|
||||||
|
status=""
|
||||||
|
else
|
||||||
|
status=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print the output
|
||||||
|
if [ "$power_supply_type" -eq 1 ]; then
|
||||||
|
echo "$status $battery_level%"
|
||||||
|
else
|
||||||
|
echo " $battery_level%"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user