my-scripts/status-update
Nicolás Ortega Froysa 6e60755a15 Change status-update to bash script.
Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
2023-11-22 16:21:59 +01:00

22 lines
627 B
Bash
Executable File

#!/bin/bash
for ifname in $(ls /sys/class/net/ | grep -v 'lo')
do
if ! [ -f "/sys/class/net/$ifname/operstate" ]
then
>&2 echo "$ifname has no operstate"
continue
fi
IF_STATUS=$(cat /sys/class/net/$ifname/operstate)
IF_STATE_LIST+=("$ifname: $IF_STATUS")
done
DATE="$(date +"%F %H:%M" )"
NETWORK="${IF_STATE_LIST[*]}"
SPACE="$(cat $HOME/.cache/free-space)"
vol_status="$(cat $HOME/.cache/audio-control/vol_status)"
vol_level="$(cat $HOME/.cache/audio-control/vol_level)%"
VOLUME="$vol_status $vol_level"
UPDATES="Upd: $(cat $HOME/.cache/update_count)"
xsetroot -name "$VOLUME | $NETWORK | $SPACE | $UPDATES | $DATE"