From 9fd0e6575439747e179be8218b0f372fedf69dc4 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 11 Nov 2018 21:23:13 -0500 Subject: [PATCH] new internet, date and help modules --- .config/i3blocks/config | 15 +++++++-------- .scripts/statusbar/i3date | 12 ++++++++++++ .scripts/statusbar/i3help | 5 +++++ .scripts/statusbar/i3internet | 18 ++++++++++++++++++ .scripts/statusbar/i3wifi | 9 --------- 5 files changed, 42 insertions(+), 17 deletions(-) create mode 100755 .scripts/statusbar/i3date create mode 100755 .scripts/statusbar/i3help create mode 100755 .scripts/statusbar/i3internet delete mode 100755 .scripts/statusbar/i3wifi diff --git a/.config/i3blocks/config b/.config/i3blocks/config index c5de4ed..a4ff01b 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -44,11 +44,6 @@ interval=once command=i3volume signal=10 -[iface] -label=🌐 -#instance=wlan0 -interval=10 - [battery] command=i3battery BAT1 interval=5 @@ -59,9 +54,13 @@ interval=5 [time] label=📅 -command=echo $(date '+%Y %b %d (%a) %I:%M%p') 🕓 +command=i3date interval=30 -[wifi] -command=i3wifi +[internet] +command=i3internet interval=10 + +[help] +command=i3help +interval=once diff --git a/.scripts/statusbar/i3date b/.scripts/statusbar/i3date new file mode 100755 index 0000000..caed51a --- /dev/null +++ b/.scripts/statusbar/i3date @@ -0,0 +1,12 @@ +#!/bin/sh + +date '+%Y %b %d (%a) %I:%M%p' + +case $BLOCK_BUTTON in + 1) pgrep -x dunst >/dev/null && notify-send "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" ;; + 2) "$TERMINAL" -e calcurse ;; + 3) pgrep -x dunst >/dev/null && notify-send "📅 Time/date module: +- Left click to show month via \`cal\` +- Middle click opens calcurse if installed" ;; +esac + diff --git a/.scripts/statusbar/i3help b/.scripts/statusbar/i3help new file mode 100755 index 0000000..16eb97f --- /dev/null +++ b/.scripts/statusbar/i3help @@ -0,0 +1,5 @@ +#!/bin/sh + +[ "$BLOCK_BUTTON" = "1" ] && "$READER" ~/.config/i3/i3_guide.pdf + +echo "❓" diff --git a/.scripts/statusbar/i3internet b/.scripts/statusbar/i3internet new file mode 100755 index 0000000..dba6262 --- /dev/null +++ b/.scripts/statusbar/i3internet @@ -0,0 +1,18 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) $TERMINAL -e nmtui ;; + 3) pgrep -x dunst >/dev/null && notify-send "Internet module: +- Left click for \`nmtui\` for wifi access +📡: no wifi connection +📶: wifi connection with quality +❎: no ethernet +🌐: ethernet working +" ;; +esac + +[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡" + +[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep ^w /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }') + +printf "%s %s" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")" diff --git a/.scripts/statusbar/i3wifi b/.scripts/statusbar/i3wifi deleted file mode 100755 index 178c88e..0000000 --- a/.scripts/statusbar/i3wifi +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) $TERMINAL -e nmtui ;; -esac - -[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && echo 📡 && exit - -grep ^w /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }'