diff options
Diffstat (limited to 'bar')
-rwxr-xr-x | bar/batterynotification | 2 | ||||
-rwxr-xr-x | bar/calendarnotification | 2 | ||||
-rwxr-xr-x | bar/netnotification | 5 | ||||
-rwxr-xr-x | bar/netstat | 45 | ||||
-rwxr-xr-x | bar/sb-internet | 24 | ||||
-rwxr-xr-x | bar/volume | 27 |
6 files changed, 105 insertions, 0 deletions
diff --git a/bar/batterynotification b/bar/batterynotification new file mode 100755 index 0000000..5cdb2fb --- /dev/null +++ b/bar/batterynotification @@ -0,0 +1,2 @@ +#!/bin/sh +notify-send "Battery info:" "`blr -eElL`" diff --git a/bar/calendarnotification b/bar/calendarnotification new file mode 100755 index 0000000..39df717 --- /dev/null +++ b/bar/calendarnotification @@ -0,0 +1,2 @@ +#!/bin/sh +notify-send -u low -t 10000 "`date +'%m/%d/%Y %T'`" "`cal | tr '[:upper:]' '[:lower:]'`\n`date +'day %0j, week %0U, q%q'`" diff --git a/bar/netnotification b/bar/netnotification new file mode 100755 index 0000000..ee68238 --- /dev/null +++ b/bar/netnotification @@ -0,0 +1,5 @@ +#!/bin/sh +ip="`ip addr | sed -n '/\slo/d; s/\/.*//; s/\s*inet /IP Address:\t/p;'`" +ssid="`iw wlp3s0 link | sed -n 's/\s*SSID:\s*/SSID:\t\t/p'`" + +notify-send -u low "Network info:" "$ip\n$ssid" diff --git a/bar/netstat b/bar/netstat new file mode 100755 index 0000000..e7b23c3 --- /dev/null +++ b/bar/netstat @@ -0,0 +1,45 @@ +#!/usr/bin/awk -f + +BEGIN { +wifidev=ENVIRON["WIFIDEV"] +ethedev=ENVIRON["ETHEDEV"] +getline state < ("/sys/class/net/"ethedev"/operstate") +switch (state) { + case "up": + print "" + break + case "down": + getline state < ("/sys/class/net/"wifidev"/operstate") + switch (state) { + case "up": + # make this nicer, obviously + getline < "/proc/net/wireless" + getline < "/proc/net/wireless" + getline < "/proc/net/wireless" + sigstrength=int($3 * 100 / 70) + if (sigstrength > 70) { + print " " sigstrength "%" + } + else if (sigstrength > 40) { + print " " sigstrength "%" + } + else if (sigstrength > 10) { + print " " sigstrength "%" + } + else { + print " " sigstrength "%" + } + break + case "down": + print "" + break + default: + print "Device "wifidev" not found..." + break + } + break + default: + print "Device "ethedev" not found..." + break +} +} diff --git a/bar/sb-internet b/bar/sb-internet new file mode 100755 index 0000000..ee1a160 --- /dev/null +++ b/bar/sb-internet @@ -0,0 +1,24 @@ +#!/bin/sh + +# Show wifi 📶 and percent strength or 📡 if none. +# Show 🌐 if connected to ethernet or ❎ if none. +# Show 🔒 if a vpn connection is active + +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; + 3) notify-send "🌐 Internet module" "\- Click to connect +📡: no wifi connection +📶: wifi connection with quality +❎: no ethernet +🌐: ethernet working +🔒: vpn is active +" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in + down) wifiicon="📡 " ;; + up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; +esac + +printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)" diff --git a/bar/volume b/bar/volume new file mode 100755 index 0000000..2eb9250 --- /dev/null +++ b/bar/volume @@ -0,0 +1,27 @@ +#!/usr/bin/awk -f + +BEGIN { +cmd="amixer -M sget Master" +FS="[][]" +while (cmd | getline) { + if (NF > 1) { + vol=int($2) + if ($6 == "off") + icon="" + else if (vol > 70) + icon="" + else if (vol > 40) + icon="" + else if (vol > 10) + icon="" + else + icon="" + #printf "%s %s | %05.2fdB", icon, $2, $4 + print icon" "$2" | "$4 + } +} +} + +##!/bin/sh +##amixer sget Master | awk -F'[][]' '/%/{print $2" | "$4 " [" $6 "]"}' +#amixer -M sget Master | sed -n 's/.*Playback [0-9]* \[//; s/. ./ | /; s/\] .off\]/ \[mute\]/p; s/\] .on.//p' |