fix(hyprland): custom battery to avoid battery spam
This commit is contained in:
parent
0fff8294a7
commit
c548501d52
2 changed files with 28 additions and 1 deletions
21
scripts/battery.sh
Normal file
21
scripts/battery.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
capacity="$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
status="$(cat /sys/class/power_supply/BAT0/status)"
|
||||
|
||||
if [ "${status}" = "Charging" ]; then
|
||||
icon="\ue55b"
|
||||
elif [ "${capacity}" -ge 90 ]; then
|
||||
icon="\uf240"
|
||||
elif [ "${capacity}" -ge 75 ]; then
|
||||
icon="\uf241"
|
||||
elif [ "${capacity}" -ge 50 ]; then
|
||||
icon="\uf242"
|
||||
elif [ "${capacity}" -ge 25 ]; then
|
||||
icon="\uf243"
|
||||
else
|
||||
icon="\uf244"
|
||||
fi
|
||||
|
||||
printf '{"text": "%s%% %s", "tooltip": "Status: %s", "class": "%s"}\n' \
|
||||
"${capacity}" "${icon}" "${status}" "${status}"
|
||||
|
|
@ -77,6 +77,12 @@
|
|||
}
|
||||
},
|
||||
|
||||
"custom/battery": {
|
||||
"exec": "bash ${SCRIPT_DIR}/battery.sh",
|
||||
"return-type": "json",
|
||||
"interval": 60
|
||||
},
|
||||
|
||||
"custom/control-center": {
|
||||
"format": "\uf085", /* */
|
||||
"tooltip": false
|
||||
|
|
@ -263,7 +269,7 @@
|
|||
"orientation": "inherit",
|
||||
"modules": [
|
||||
/* Preview */
|
||||
"battery",
|
||||
/* "battery", */ "custom/battery",
|
||||
/* Most-left */
|
||||
"custom/system-shutdown",
|
||||
"custom/system-reboot",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue