updated dwm scripts

This commit is contained in:
Solomon Laing 2022-05-09 10:37:16 +09:30
parent ff318eb66f
commit 47377fd30e
2 changed files with 105 additions and 0 deletions

67
scripts/status-net Executable file
View File

@ -0,0 +1,67 @@
#!/bin/sh
dev_wifi=wlp3s0
dev_eth=enp0s25
dev_vpn=proton0
base03=#002b36
base02=#073642
base01=#586e75
base00=#657b83
base0=#839496
base1=#93a1a1
base2=#eee8d5
base3=#fdf6e3
yellow=#b58900
orange=#cb4b16
red=#dc322f
magenta=#d33682
violet=#6c71c4
blue=#268bd2
cyan=#2aa198
green=#859900
std_color=$magenta
wifi_icon=""
color=$std_color;
eth="$(ip -o address | grep -i "$dev_eth *inet ")"
if [ -n "$eth" ]
then
speed="$(cat /sys/class/net/$dev_eth/speed)"
case $speed in
10) speed="10Base-T" ;;
100) speed="100Base-T" ;;
1000) speed="Gigabit" ;;
*) speed="UNKNOWN $speed" ;;
esac
eth_status="  $speed"
fi
ssid="$(iw dev $dev_wifi link | grep -i SSID)"
if [ -n "$ssid" ]
then
signal="$(iw dev wlp3s0 station dump | egrep '[^ ]signal avg')"
signal="${signal#*-}"
signal="${signal%% *}"
signal="$((2*(100-signal)))"
signal=$((signal/5*5)) # get rid of some jitter
((signal > 100)) && signal=100
wifi_status="$wifi_icon ${signal}% ${ssid##*SSID: }"
fi
vpn="$(ip -o address | grep -i "$dev_vpn *inet ")"
if [ -n "$vpn" ]
then
vpn_status=""
color=$green
else
vpn_status=""
fi
echo "${vpn_status} $wifi_status$eth_status"
# vim: ft=sh:expandtab:ts=4:shiftwidth=4

38
scripts/status-vol Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
base03=#002b36
base02=#073642
base01=#586e75
base00=#657b83
base0=#839496
base1=#93a1a1
base2=#eee8d5
base3=#fdf6e3
yellow=#b58900
orange=#cb4b16
red=#dc322f
magenta=#d33682
violet=#6c71c4
blue=#268bd2
cyan=#2aa198
green=#859900
color=$cyan
volume="$(amixer sget Master | grep 'Front Left')"
if [ "${volume}" = "${volume%\[off\]*}" ]
then
volume="${volume#*\[}"
status="${volume%%\%\]*}"
case $((status/50)) in
0) icon="" ;; # fa-volume-down f027
1) icon="" ;; # fa-volume-up f028
*) icon=""; color=$orange ;; # fa-volume-up f028
esac
else
status=MUTE
color=$red
icon="" # fa-volume-off f026
fi
echo "$icon $status"