diff --git a/scripts/sb-clock b/scripts/sb-clock index ac5965d..267529c 100644 --- a/scripts/sb-clock +++ b/scripts/sb-clock @@ -1,29 +1,3 @@ -#!/bin/sh +#! /bin/sh -clock=$(date '+%I') - -case "$clock" in - "00") icon="🕛" ;; - "01") icon="🕐" ;; - "02") icon="🕑" ;; - "03") icon="🕒" ;; - "04") icon="🕓" ;; - "05") icon="🕔" ;; - "06") icon="🕕" ;; - "07") icon="🕖" ;; - "08") icon="🕗" ;; - "09") icon="🕘" ;; - "10") icon="🕙" ;; - "11") icon="🕚" ;; - "12") icon="🕛" ;; -esac - -case $BLOCK_BUTTON in - 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/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\` -- Middle click opens calcurse if installed" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -date "+📅%a %d %b %Y $icon%I:%M%p" +date "+%a %d %b | %I:%M:%S%p" diff --git a/scripts/sb-cpu b/scripts/sb-cpu index a20a378..3b0a961 100644 --- a/scripts/sb-cpu +++ b/scripts/sb-cpu @@ -1,12 +1,4 @@ #!/bin/sh -case $BLOCK_BUTTON in - 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; - 2) setsid -f "$TERMINAL" -e htop ;; - 3) notify-send "🖥 CPU module " "\- Shows CPU temperature. -- Click to show intensive processes. -- Middle click to open htop." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac +top -b -n2 -p 1 | fgrep "Cpu(s)" | tail -1 | awk -F'id,' -v prefix="CPU " '{ split($1, vs, ","); v=vs[length(vs)]; sub("%", "", v); printf "%s%.1f%%\n", prefix, 100 - v }' -sensors | awk '/temp1/ {print "🌡" $2}' diff --git a/scripts/sb-disk b/scripts/sb-disk index b3d9469..75f7383 100644 --- a/scripts/sb-disk +++ b/scripts/sb-disk @@ -1,23 +1,3 @@ #!/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." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -case "$location" in - "/mnt"* ) icon="💾" ;; - *) icon="🖥";; -esac - -printf "$icon""$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')" - +printf "DISK $(df -h "/" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/scripts/sb-memory b/scripts/sb-memory index f5f83ef..5ca61de 100644 --- a/scripts/sb-memory +++ b/scripts/sb-memory @@ -1,12 +1,3 @@ #!/bin/sh -case $BLOCK_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.1f/%2.1fGB\n", ( $3 / 1024), ($2 / 1024))}' +free --mebi | sed -n '2{p;q}' | awk '{printf ("MEM %2.2f/%2.2fGB\n", ( $3 / 1024), ($2 / 1024))}' diff --git a/scripts/sb-volume b/scripts/sb-volume index 61588c3..4f2fb6c 100644 --- a/scripts/sb-volume +++ b/scripts/sb-volume @@ -1,28 +1,4 @@ -#!/bin/sh +#! /bin/sh -# Prints the current volume or 🔇 if muted. - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e pulsemixer ;; - 2) pamixer -t ;; - 4) pamixer --allow-boost -i 1 ;; - 5) pamixer --allow-boost -d 1 ;; - 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. -- Middle click to mute. -- Scroll to change." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -[ $(pamixer --get-mute) = true ] && echo 🔇 && exit - -vol="$(pamixer --get-volume)" - -if [ "$vol" -gt "70" ]; then - icon="🔊" -elif [ "$vol" -lt "30" ]; then - icon="🔈" -else - icon="🔉" -fi - -echo "$icon$vol%" +[ $(pamixer --get-mute) = true ] && echo " MUTED" && exit +echo " VOL $(pamixer --get-volume)%"