add scripts
This commit is contained in:
parent
b91bb6b7c8
commit
bc7920537e
4 changed files with 26 additions and 1 deletions
13
scripts/kb_battery.py
Executable file
13
scripts/kb_battery.py
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/env python3
|
||||
import subprocess
|
||||
|
||||
all_statuses = subprocess.run(["upower", "-d"], capture_output=True).stdout.decode("utf-8").split("\n\n")
|
||||
|
||||
for s in all_statuses:
|
||||
if "leko pona 1" in s:
|
||||
for line in s.split("\n"):
|
||||
if "percentage:" in line:
|
||||
print(line.split(":")[1].strip())
|
||||
exit(0)
|
||||
|
||||
print("no kb found")
|
Loading…
Add table
Add a link
Reference in a new issue