status-linux (1211B)
1 #!/bin/sh 2 3 # Prints some status info to stdout. Includes: 4 # - date and time 5 # - battery 6 # - wifi (requires nmcli) 7 # - past notifications (requires notify) 8 9 # Usage: status [separator] 10 11 sep=${1:-" | "} 12 13 time=$(date +"%H:%M") 14 date=$(date +"%a %d %b") 15 16 if [ "$(pulsemixer --get-mute)" -eq 1 ]; then 17 volume="Muted" 18 else 19 volume="Vol: $(pulsemixer --get-volume | awk '{print $1}')%" 20 fi 21 22 bat="/sys/class/power_supply/BAT0" 23 if [ -d $bat ]; then 24 charge_status="$(cat $bat/status | awk '{print substr ($0, 0, 2)}')" 25 battery="Bat: $(cat $bat/capacity)% $charge_status" 26 else 27 battery="No battery" 28 fi 29 30 # NetworkManager has a dreadful command line interface 31 # It makes cry every time 32 # pls help 33 #nwline="$(nmcli device status | head -n 2 | tail -n 1)" 34 #nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" 35 #network="Network: $nwclean" 36 37 # Thank you iwctl for saving us from this dreadful existence 38 network="$(iwctl station wlan0 show | grep 'Connected network' | awk '{print $3}')" 39 40 noticount=$(notify show | wc -l) 41 42 printf '%s' "$network$sep$volume$sep$battery$sep$date$sep$time" 43 [ "$noticount" = "1" ] && printf '%s' "$sep$(notify show)" 44 [ "$noticount" -gt "1" ] && printf '%s' "${sep} [$noticount]" 45 printf '\n'