From fd953c5191677355b789ea636f61de5a83fbf38c Mon Sep 17 00:00:00 2001 From: awy Date: Tue, 27 Aug 2024 17:36:26 +0300 Subject: stuff --- .local/bin/statusbar/sb-clock | 12 ++++++++++- .local/bin/statusbar/sb-doppler | 7 ++----- .local/bin/statusbar/sb-microphone | 38 ++++++++++++++++++++++------------ .local/bin/statusbar/sb-nettraf | 16 +++++++++++---- .local/bin/statusbar/sb-volume | 42 ++++++++++++++++++++++++-------------- 5 files changed, 77 insertions(+), 38 deletions(-) (limited to '.local/bin/statusbar') diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index bdf3590..67ad409 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -18,4 +18,14 @@ case "$clock" in "12") icon="πŸ•›" ;; esac -date "+%b %d (%a) $icon %H:%M" +if [ ! -n "$1" ]; then + date "+%b %d (%a) $icon %H:%M" +else + if [ "$1" -eq 1 ]; then + notify-send "This Month" "$(cal | sed "s/\<$(date +'%e'|tr -d ' ')\>/&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" + elif [ "$1" -eq 3 ]; then + 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" + fi +fi + diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index f9bb8fe..aad82c4 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -4,17 +4,14 @@ showdoppler() { hyprctl dispatch exec "[float; size 800 800;]" 'curl -s https://meteoinfo.ru/hmc-output/rmap/phenomena.gif | imv - -H 1200 -W 1200' } -sendnotif() { - notify-send "πŸ—ΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR. -- Middle click to update RADAR location." -} if [ ! -n "$1" ]; then echo πŸŒ… else if [ "$1" -eq 1 ]; then showdoppler elif [ "$1" -eq 3 ]; then - sendnotif + notify-send "πŸ—ΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR. +- You need to manually edit the url in the script to change location." fi fi diff --git a/.local/bin/statusbar/sb-microphone b/.local/bin/statusbar/sb-microphone index e07e0de..01a44cf 100755 --- a/.local/bin/statusbar/sb-microphone +++ b/.local/bin/statusbar/sb-microphone @@ -1,12 +1,7 @@ #!/bin/sh - +var=$1 mic="$(wpctl get-volume @DEFAULT_SOURCE@)" -# If muted, print πŸ”‡ and exit. -[ "$mic" != "${mic%\[MUTED\]}" ] && echo ο„± && exit - -mic="${mic#Volume: }" - split() { # For ommiting the . without calling and external program. IFS=$2 @@ -14,11 +9,28 @@ split() { printf '%s' "$@" } -mic="$(printf "%.0f" "$(split "$mic" ".")")" - -case 1 in - $((mic >= 1)) ) icon="πŸŽ™οΈ" ;; - * ) echo ο„± && exit ;; -esac +sig() { + if [ ! -n "$var" ]; then + if [ -n "$flag" ] ; then + echo "$icon" + else + case 1 in + $((mic >= 1)) ) icon="πŸŽ™οΈ" ;; + * ) echo ο„± && exit ;; + esac + echo "$icon $mic%" + fi + else + if [ "$var" -eq 3 ]; then + notify-send "🎀 Microphone module" "\- Shows volume πŸŽ™οΈ, ο„± if muted. +- Middle click to mute. +- Scroll to change." + fi + fi + exit +} -echo "$icon $mic%" +[ "$mic" != "${mic%\[MUTED\]}" ] && icon="ο„±" && flag=1 && sig +mic="${mic#Volume: }" +mic="$(printf "%.0f" "$(split "$mic" ".")")" +sig diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf index 88df9bd..c9aa417 100755 --- a/.local/bin/statusbar/sb-nettraf +++ b/.local/bin/statusbar/sb-nettraf @@ -16,7 +16,15 @@ update() { printf %d\\n $(( sum - old )) } -rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) -tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) - -printf "πŸ”»%4sB πŸ”Ί%4sB\\n" $(numfmt --to=iec $rx $tx) +if [ ! -n "$1" ]; then + rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) + tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) + printf "πŸ”»%4sB πŸ”Ί%4sB\\n" $(numfmt --to=iec $rx $tx) +else + if [ "$1" -eq 1 ]; then + hyprctl dispatch exec "[float; size 1800 1300;]" 'kitty -e sh -c "bmon"' + elif [ "$1" -eq 3 ]; then + notify-send "🌐 Network traffic module" "πŸ”»: Traffic received +πŸ”Ί: Traffic transmitted" + fi +fi diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index e3501d1..06dd23a 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -1,12 +1,7 @@ #!/bin/sh - +var=$1 vol="$(wpctl get-volume @DEFAULT_SINK@)" -# If muted, print πŸ”‡ and exit. -[ "$vol" != "${vol%\[MUTED\]}" ] && echo πŸ”‡ && exit - -vol="${vol#Volume: }" - split() { # For ommiting the . without calling and external program. IFS=$2 @@ -14,13 +9,30 @@ split() { printf '%s' "$@" } -vol="$(printf "%.0f" "$(split "$vol" ".")")" - -case 1 in - $((vol >= 70)) ) icon="πŸ”Š" ;; - $((vol >= 30)) ) icon="πŸ”‰" ;; - $((vol >= 1)) ) icon="πŸ”ˆ" ;; - * ) echo πŸ”‡ && exit ;; -esac +sig() { + if [ ! -n "$var" ]; then + if [ -n "$flag" ] ; then + echo "$icon" + else + case 1 in + $((vol >= 70)) ) icon="πŸ”Š" ;; + $((vol >= 30)) ) icon="πŸ”‰" ;; + $((vol >= 1)) ) icon="πŸ”ˆ" ;; + * ) echo πŸ”‡ && exit ;; + esac + echo "$icon $vol%" + fi + else + if [ "$var" -eq 3 ]; then + notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted. +- Middle click to mute. +- Scroll to change." + fi + fi + exit +} -echo "$icon $vol%" +[ "$vol" != "${vol%\[MUTED\]}" ] && icon="πŸ”‡" && flag=1 && sig +vol="${vol#Volume: }" +vol="$(printf "%.0f" "$(split "$vol" ".")")" +sig -- cgit v1.2.3