Fix icons / yaml loader
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
46c5812910
commit
c7912aa7dc
2 changed files with 9 additions and 9 deletions
|
@ -1,27 +1,27 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
SYM_ADAPTER="$(printf '\ufba3')"
|
||||
SYM_BATTERY="$(printf '\uf58d')"
|
||||
SYM_ADAPTER="$(printf '\U000f06a5')" # nf-md-power_plug
|
||||
SYM_BATTERY="$(printf '\U000f008e')" # nf-md-battery_outline
|
||||
BATTERY=/sys/class/power_supply/BAT0
|
||||
AC=/sys/class/power_supply/AC
|
||||
|
||||
[ -e ${BATTERY} ] || {
|
||||
echo "No battery" >&2
|
||||
exit 0
|
||||
echo "No battery" >&2
|
||||
exit 0
|
||||
}
|
||||
[ -e ${AC} ] || {
|
||||
echo "No ac" >&2
|
||||
exit 0
|
||||
echo "No ac" >&2
|
||||
exit 0
|
||||
}
|
||||
|
||||
CAPACITY=$(cat ${BATTERY}/capacity)
|
||||
AC_CONNECT=$(cat ${AC}/online)
|
||||
|
||||
if [ ${AC_CONNECT} -eq 0 ]; then
|
||||
SYM=${SYM_BATTERY}
|
||||
SYM=${SYM_BATTERY}
|
||||
else
|
||||
SYM=${SYM_ADAPTER}
|
||||
SYM=${SYM_ADAPTER}
|
||||
fi
|
||||
|
||||
echo "${SYM} ${CAPACITY}%"
|
||||
|
|
|
@ -17,7 +17,7 @@ def check_ping_reachable(ip):
|
|||
|
||||
|
||||
def main():
|
||||
config = yaml.load(open(Path('~/.config/i3-vpn.json').expanduser()))
|
||||
config = yaml.safe_load(open(Path('~/.config/i3-vpn.json').expanduser()))
|
||||
results = []
|
||||
|
||||
for check in config['checks']:
|
||||
|
|
Loading…
Reference in a new issue