Fix icons / yaml loader

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-05-07 16:26:39 +02:00
parent 46c5812910
commit c7912aa7dc
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5
2 changed files with 9 additions and 9 deletions

View file

@ -1,27 +1,27 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
SYM_ADAPTER="$(printf '\ufba3')" SYM_ADAPTER="$(printf '\U000f06a5')" # nf-md-power_plug
SYM_BATTERY="$(printf '\uf58d')" SYM_BATTERY="$(printf '\U000f008e')" # nf-md-battery_outline
BATTERY=/sys/class/power_supply/BAT0 BATTERY=/sys/class/power_supply/BAT0
AC=/sys/class/power_supply/AC AC=/sys/class/power_supply/AC
[ -e ${BATTERY} ] || { [ -e ${BATTERY} ] || {
echo "No battery" >&2 echo "No battery" >&2
exit 0 exit 0
} }
[ -e ${AC} ] || { [ -e ${AC} ] || {
echo "No ac" >&2 echo "No ac" >&2
exit 0 exit 0
} }
CAPACITY=$(cat ${BATTERY}/capacity) CAPACITY=$(cat ${BATTERY}/capacity)
AC_CONNECT=$(cat ${AC}/online) AC_CONNECT=$(cat ${AC}/online)
if [ ${AC_CONNECT} -eq 0 ]; then if [ ${AC_CONNECT} -eq 0 ]; then
SYM=${SYM_BATTERY} SYM=${SYM_BATTERY}
else else
SYM=${SYM_ADAPTER} SYM=${SYM_ADAPTER}
fi fi
echo "${SYM} ${CAPACITY}%" echo "${SYM} ${CAPACITY}%"

View file

@ -17,7 +17,7 @@ def check_ping_reachable(ip):
def main(): def main():
config = yaml.load(open(Path('~/.config/i3-vpn.json').expanduser())) config = yaml.safe_load(open(Path('~/.config/i3-vpn.json').expanduser()))
results = [] results = []
for check in config['checks']: for check in config['checks']: