Extract omarchy-battery-remaining command

This commit is contained in:
David Heinemeier Hansson
2025-10-23 13:40:18 -07:00
parent 260d586343
commit 9f00d5a3a0
2 changed files with 18 additions and 22 deletions

11
bin/omarchy-battery-remaining Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Returns the battery percentage remaining as an integer.
upower -i $(upower -e | grep BAT) \
| awk -F: '/percentage/ {
gsub(/[%[:space:]]/, "", $2);
val=$2;
printf("%d\n", (val+0.5))
exit
}'