diff --git a/.local/bin/status-bat b/.local/bin/status-bat index fede8f3..9a364e5 100755 --- a/.local/bin/status-bat +++ b/.local/bin/status-bat @@ -1,5 +1,12 @@ #!/bin/bash +case $BUTTON in + 3) notify-send "Scroll to change adjust backlight." ;; + 4) mod_backlight up ;; + 5) mod_backlight down ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + icon="" IFS=" " read -ra parts <<< "$(bash-status-bat)" diff --git a/.local/bin/status-clock b/.local/bin/status-clock new file mode 100755 index 0000000..4a938f8 --- /dev/null +++ b/.local/bin/status-clock @@ -0,0 +1,11 @@ +#!/bin/bash + +case $BUTTON in + 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s|..27m||")" && 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\` +- Middle click opens calcurse if installed" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +echo " $(date '+%a %Y-%m-%d %H:%M')" diff --git a/.local/bin/status-disk b/.local/bin/status-disk index e74aea2..5096d8c 100755 --- a/.local/bin/status-disk +++ b/.local/bin/status-disk @@ -2,7 +2,13 @@ homeval=$(df -h -B 1048576 | grep "/home") -if [[ ! -z $homeval ]]; then +case $BUTTON in + 1) notify-send "Disk space" "$(df -h --output=target,used,size)" ;; + 3) notify-send "Disk module" "Click to show all disk info." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +if [[ -n $homeval ]]; then homefreemb=$(echo "$homeval" | awk -F ' ' '{ print $4 }') homefreegb=$(echo "$homeval" | awk -F ' ' '{ print $4/1024 }') fi @@ -18,7 +24,7 @@ else out="$out / $(printf "%0.2fGb" "$rootfreegb")" fi -if [[ ! -z $homeval ]]; then +if [[ -n $homeval ]]; then if [ "$homefreemb" -lt 1024 ]; then out="$out ~ $(printf "%0.2fMb" "$homefreemb")" else diff --git a/.local/bin/status-mem b/.local/bin/status-mem new file mode 100755 index 0000000..a886150 --- /dev/null +++ b/.local/bin/status-mem @@ -0,0 +1,13 @@ +#!/bin/bash + +case $BUTTON in + 1) notify-send "Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 2) setsid -f "$TERMINAL" -e htop ;; + 3) notify-send "Memory module" "\- Shows Memory Used/Total. +- Click to show memory hogs. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +free --mebi | sed -n '2{p;q}' | awk '{printf (" %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}' + diff --git a/.local/bin/status-net b/.local/bin/status-net index 6605aba..12c6912 100755 --- a/.local/bin/status-net +++ b/.local/bin/status-net @@ -1,37 +1,27 @@ #!/bin/bash -dev_wifi=$(<"$HOME"/.config/net-cfg/dev_wifi) -dev_eth=$(<"$HOME"/.config/net-cfg/dev_eth) -dev_vpn=$(<"$HOME"/.config/net-cfg/dev_vpn) +# Show wifi  and percent strength or 󰖪 if none. +# Show  if connected to ethernet or ❎ if none. +# Show 🔒 if a vpn connection is active -wifi_icon=" " +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e nmtui; pkill -RTMIN+15 dwmblocks ;; + 3) notify-send "Internet module" "\- Click to connect +❌: wifi disabled +󰖪 : no wifi connection + : wifi connection with quality +❎: no ethernet + : ethernet working +🔒: vpn is active +" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac -eth="$(ip -o address | grep -i "$dev_eth *inet ")" -if [ -n "$eth" ] -then - speed="$(cat "/sys/class/net/$dev_eth/speed")" - case $speed in - 10) speed="10Base-T" ;; - 100) speed="100Base-T" ;; - 1000) speed="Gigabit" ;; - *) speed="UNKNOWN $speed" ;; - esac - eth_status="  $speed" +if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then + ssid="$(iw dev $(cat /proc/net/wireless | grep '^.*:' | sed 's/:.*//') link | grep -i SSID)" + wifiicon="$(awk '/^\s*w/ { print " ", int($3 * 100 / 70) "%" }' /proc/net/wireless) ${ssid##*SSID: } " +elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then + grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="󰖪 " || wifiicon="❌ " fi -ssid="$(iw dev "$dev_wifi" link | grep -i SSID)" -if [ -n "$ssid" ] -then - signal="$(awk '/^\s*w/ { print int($3 * 100 / 70) "%" }' /proc/net/wireless)" - wifi_status="$wifi_icon ${signal} ${ssid##*SSID: }" -fi - -vpn="$(ip -o address | grep -i "$dev_vpn *inet ")" -if [ -n "$vpn" ] -then - vpn_status="" -else - vpn_status="" -fi - -echo "${vpn_status} $wifi_status$eth_status" +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/.local/bin/status-packages b/.local/bin/status-packages index e9eb284..c238ac3 100755 --- a/.local/bin/status-packages +++ b/.local/bin/status-packages @@ -1,3 +1,12 @@ #!/bin/bash +case $BUTTON in + 1) setsid -f "$TERMINAL" -e status-popupgrade ;; + 2) notify-send "$(/usr/bin/pacman -Qu)" ;; + 3) notify-send "Upgrade module" "Number of upgradable packages +- Left click to upgrade packages +- Middle click to show upgradable packages" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/ /;s/^ 0$//g" diff --git a/.local/bin/status-popupgrade b/.local/bin/status-popupgrade new file mode 100755 index 0000000..29d6230 --- /dev/null +++ b/.local/bin/status-popupgrade @@ -0,0 +1,9 @@ +#!/bin/sh + +printf "Beginning upgrade.\\n" + +yay -Syu +pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" + +printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" +read -r _ diff --git a/.local/bin/status-vol b/.local/bin/status-vol index b496d5b..a80e3ea 100755 --- a/.local/bin/status-vol +++ b/.local/bin/status-vol @@ -2,6 +2,17 @@ # Prints the current volume or  if muted. +case $BUTTON in + 1) setsid -f "$TERMINAL" -e pulsemixer ;; + 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; + 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;; + 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;; + 3) notify-send "Volume module" "\- Shows volume,  if muted. +- Middle click to mute. +- Scroll to change." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" # If muted, print 🔇 and exit.