Compare commits
4 commits
7c0ebf50b5
...
7cb3363539
Author | SHA1 | Date | |
---|---|---|---|
7cb3363539 | |||
5ff22f5b6a | |||
ae5103f1ce | |||
bf0a0ea914 |
2 changed files with 15 additions and 4 deletions
11
bin/batstat
Executable file
11
bin/batstat
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
battery_capacity=$(cat "/sys/class/power_supply/${1}/capacity")
|
||||||
|
|
||||||
|
if [ "$battery_capacity" -lt 25 ]; then echo critical
|
||||||
|
elif [ "$battery_capacity" -lt 50 ]; then echo low
|
||||||
|
elif [ "$battery_capacity" -lt 75 ]; then echo medium
|
||||||
|
elif [ "$battery_capacity" -lt 100 ]; then echo high
|
||||||
|
else echo full
|
||||||
|
fi
|
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/sh -e
|
#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
screen_is_on() {
|
screen_is_on() {
|
||||||
[ "$(brightnessctl g)" -ne 0 ]
|
[ "$(brightnessctl get)" -ne 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
turn_on_screen() {
|
turn_on_screen() {
|
||||||
|
@ -10,7 +11,7 @@ turn_on_screen() {
|
||||||
|
|
||||||
turn_off_screen() {
|
turn_off_screen() {
|
||||||
brightnessctl -s
|
brightnessctl -s
|
||||||
brightnessctl s 0
|
brightnessctl set 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if screen_is_on; then
|
if screen_is_on; then
|
||||||
|
@ -18,4 +19,3 @@ if screen_is_on; then
|
||||||
else
|
else
|
||||||
turn_on_screen
|
turn_on_screen
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue