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
|
#!/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}%"
|
||||||
|
|
|
@ -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']:
|
||||||
|
|
Loading…
Reference in a new issue