From b893bee74dcbdc1e11daa98da39c49e6afecc9e6 Mon Sep 17 00:00:00 2001 From: awy Date: Sat, 30 Nov 2024 16:55:21 +0300 Subject: small fixes + sb-disk module --- .local/bin/statusbar/sb-clock | 2 +- .local/bin/statusbar/sb-disk | 17 +++++++++++++++++ .local/bin/statusbar/sb-doppler | 2 +- .local/bin/statusbar/sb-forecast | 8 ++++---- .local/bin/statusbar/sb-internet | 28 ++++++++++++++-------------- .local/bin/statusbar/sb-memory | 4 ++-- .local/bin/statusbar/sb-microphone | 2 +- .local/bin/statusbar/sb-nettraf | 4 ++-- .local/bin/statusbar/sb-volume | 4 ++-- 9 files changed, 44 insertions(+), 27 deletions(-) create mode 100755 .local/bin/statusbar/sb-disk (limited to '.local/bin') diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index 2229164..fb62665 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -21,7 +21,7 @@ esac case $BLOCK_BUTTON in 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e'|tr -d ' ')\>/&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; 2) setsid -f "$TERMINAL" -e calcurse ;; - 3) notify-send "  Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` + 3) notify-send " Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;; 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/statusbar/sb-disk b/.local/bin/statusbar/sb-disk new file mode 100755 index 0000000..efc1f5e --- /dev/null +++ b/.local/bin/statusbar/sb-disk @@ -0,0 +1,17 @@ +#!/bin/sh + +# Status bar module for disk space +# $1 should be drive mountpoint, otherwise assumed /. + +location=${1:-/} + +[ -d "$location" ] || exit + +case $BLOCK_BUTTON in + 1) notify-send " Disk space" "$(df -h --output=target,used,size)" ;; + 3) notify-send " Disk module" "\- Shows used hard drive space. +- Click to show all disk info." ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +printf "%s: %s\n" "root" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index 75092f3..b3967ce 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -19,4 +19,4 @@ After $secs seconds, new clicks will also automatically update the doppler RADAR 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac -echo 🌅 +echo 󰞍 diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index f7df265..350f2c9 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -40,11 +40,11 @@ showweather() { case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e less -Sfr "$weatherreport" ;; 2) getforecast && showweather ;; - 3) notify-send "  Weather module" "\- Left click for full forecast. + 3) notify-send " Weather module" "\- Left click for full forecast. - Middle click to update forecast. -  : Chance of rain/snow -  : Daily low -  : Daily high" ;; + : Chance of rain/snow + : Daily low + : Daily high" ;; 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet index 07774e0..e138115 100755 --- a/.local/bin/statusbar/sb-internet +++ b/.local/bin/statusbar/sb-internet @@ -1,8 +1,8 @@ #!/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 +# Show wifi 󰤨 and percent strength or 󰤮 if none. +# Show  if connected to ethernet or 󱘖 if none. +# Show  if a vpn connection is active togglevpn() { if [ ! -n "$(cat /sys/class/net/libre/operstate 2>/dev/null)" ];then @@ -16,28 +16,28 @@ togglevpn() { case $BLOCK_BUTTON in 1) togglevpn 2>/dev/null ;; - 3) notify-send "🌐 Internet module" "\- Click to enable/disable VPN - ❌: wifi disabled - 📡: no wifi connection - 📶: wifi connection with quality - ❎: no ethernet - 🌐: ethernet working - 🔒: vpn is active + 3) notify-send " Internet module" "\- Click to enable/disable VPN + : wifi disabled +󰤮 : no wifi connection +󰤨 : wifi connection with quality +󱘖 : no ethernet + : ethernet working + : vpn is active " ;; 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac # Wifi if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then - wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" + wifiicon="$(awk '/^\s*w/ { print "󰤨 ", int($3 * 100 / 70) "% " }' /proc/net/wireless)" elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then - [ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="📡 " || wifiicon="❌ " + [ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="󰤮 " || wifiicon=" " fi # Ethernet -[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon=" " || ethericon="❎" +[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon=" " || ethericon="󱘖 " -# Wireguard +# VPN (change libre to your tun interface name) [ -n "$(cat /sys/class/net/libre/operstate 2>/dev/null)" ] && tunicon="  " printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon" diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory index fffee63..98c3da9 100755 --- a/.local/bin/statusbar/sb-memory +++ b/.local/bin/statusbar/sb-memory @@ -1,9 +1,9 @@ #!/bin/sh case $BLOCK_BUTTON in - 1) notify-send "  Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 1) notify-send " Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; 2) setsid -f "$TERMINAL" -e btop ;; - 3) notify-send "  Memory module" "\- Shows Memory Used/Total. + 3) notify-send " Memory module" "\- Shows Memory Used/Total. - Click to show memory hogs. - Middle click to open htop." ;; 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone index 397d04b..45754c2 100755 --- a/.local/bin/statusbar/sb-microphone +++ b/.local/bin/statusbar/sb-microphone @@ -7,7 +7,7 @@ case $BLOCK_BUTTON in 2) wpctl set-mute @DEFAULT_SOURCE@ toggle ;; 4) wpctl set-volume @DEFAULT_SOURCE@ 1%+ ;; 5) wpctl set-volume @DEFAULT_SOURCE@ 1%- ;; - 3) notify-send "  Microphone volume module" "\- Shows volume ,  if muted. + 3) notify-send " Microphone volume module" "\- Shows volume ,  if muted. - Middle click to mute. - Scroll to change." ;; 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf index ce001b0..7644468 100755 --- a/.local/bin/statusbar/sb-nettraf +++ b/.local/bin/statusbar/sb-nettraf @@ -6,8 +6,8 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e bmon ;; - 3) notify-send "  Network traffic module" "  : Traffic received -  : Traffic transmitted" ;; + 3) notify-send " Network traffic module" " : Traffic received + : Traffic transmitted" ;; 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index a7253f1..1aeceba 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -1,6 +1,6 @@ #!/bin/sh -# Prints the current volume or 🔇 if muted. +# Prints the current volume or  if muted. case $BLOCK_BUTTON in 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+10 "${STATUSBAR:-i3blocks}" ;; @@ -15,7 +15,7 @@ esac vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" -# If muted, print 🔇 and exit. +# If muted, print  and exit. [ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit vol="${vol#Volume: }" -- cgit v1.2.3