dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0baf312a0afa1a1b2dec3be1164ccd480b64737a
parent 7505f32ebe34b30fcb56ad8d5a2f14da2935e595
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Wed,  1 Aug 2018 20:38:48 -0400

i3wifi added

Diffstat:
M.config/i3blocks/config | 13++++++-------
A.scripts/i3wifi | 25+++++++++++++++++++++++++
2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/.config/i3blocks/config b/.config/i3blocks/config @@ -42,12 +42,6 @@ signal=10 [iface] label=🌐 #instance=wlan0 -color=#00FF00 -interval=10 - -[wifi] -label=📶 -instance=wlp2s0 interval=10 [battery] @@ -56,5 +50,10 @@ interval=5 [time] label=📅 -command=echo $(date '+%Y %b %d %I:%M%p') 🕓 +command=echo $(date '+%Y %b %d (%a) %I:%M%p') 🕓 interval=30 + +[wifi] +command=i3wifi +instance=wlp2s0 +interval=10 diff --git a/.scripts/i3wifi b/.scripts/i3wifi @@ -0,0 +1,25 @@ +#!/bin/bash + +case $BLOCK_BUTTON in + 1) $TERMINAL -e sudo -A wifi-menu ;; +esac + +INTERFACE="${BLOCK_INSTANCE:-wlan0}" + +[[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && echo 📡 && exit + +QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }') + +echo 📶 $QUALITY% +echo 📶 $QUALITY% + +# color +if [[ $QUALITY -ge 80 ]]; then + echo "#00FF00" +elif [[ $QUALITY -lt 80 ]]; then + echo "#FFF600" +elif [[ $QUALITY -lt 60 ]]; then + echo "#FFAE00" +elif [[ $QUALITY -lt 40 ]]; then + echo "#FF0000" +fi