#!/bin/sh separator=" " get_vol() { vol=$(amixer | grep "Playback" | grep -o '[0-9]*[0-9]%' | head -n 1) vol="${vol%\%*}" # Remove percentage sign if amixer scontents | grep "Playback" | grep -q "\[off\]"; then echo "󰖁 ──────────" exit fi case 1 in $((vol >= 100)) ) bar="━━━━━━━━━━" ;; $((vol >= 90)) ) bar="━━━━━━━━━─" ;; $((vol >= 80)) ) bar="━━━━━━━━──" ;; $((vol >= 70)) ) bar="━━━━━━━───" ;; $((vol >= 60)) ) bar="━━━━━━────" ;; $((vol >= 50)) ) bar="━━━━━─────" ;; $((vol >= 40)) ) bar="━━━━──────" ;; $((vol >= 30)) ) bar="━━━───────" ;; $((vol >= 20)) ) bar="━━────────" ;; $((vol >= 10)) ) bar="━─────────" ;; $((vol >= 0)) ) bar="──────────" ;; esac echo "󰕾 $bar" } get_mic() { vol=$(amixer | grep "Capture" | grep -o '[0-9]*[0-9]%' | tail -n 1) vol="${vol%\%*}" # Remove percentage sign if amixer scontents | grep "Capture" | grep -q "\[off\]"; then echo " ──────────" exit fi case 1 in $((vol >= 100)) ) bar="━━━━━━━━━━" ;; $((vol >= 90)) ) bar="━━━━━━━━━─" ;; $((vol >= 80)) ) bar="━━━━━━━━──" ;; $((vol >= 70)) ) bar="━━━━━━━───" ;; $((vol >= 60)) ) bar="━━━━━━────" ;; $((vol >= 50)) ) bar="━━━━━─────" ;; $((vol >= 40)) ) bar="━━━━──────" ;; $((vol >= 30)) ) bar="━━━───────" ;; $((vol >= 20)) ) bar="━━────────" ;; $((vol >= 10)) ) bar="━─────────" ;; $((vol >= 0)) ) bar="──────────" ;; esac echo " $bar" } get_layout() { layout="$(swaymsg -t get_inputs | grep -m 1 'xkb_active_layout_name' | cut -d '"' -f 4)" [ "$layout" = "English (US)" ] && layout="us" [ "$layout" = "Spanish (Latin American)" ] && layout="la" echo "󰌌 $layout" } while true ; do status="" todo="$(cal todo count)" ! [ -z "$todo" ] && status="$status$separator$todo" apts="$(cal apts count)" ! [ -z "$apts" ] && status="$status$separator$apts" volume="$(get_vol)" ! [ -z "$volume" ] && status="$status$separator$volume" microphone="$(get_mic)" ! [ -z "$microphone" ] && status="$status$separator$microphone" network="$(netstat)" ! [ -z "$network" ] && status="$status$separator$network" battery="$(batstat)" ! [ -z "$battery" ] && status="$status$separator$battery" layout="$(get_layout)" ! [ -z "$layout" ] && status="$status$separator$layout" date_time="$(date "+%I:%M%p$separator󰃮 %a %Y-%m-%d")" ! [ -z "$date_time" ] && status="$status$separator󰥔 $date_time" printf "%s\n" "$status" # exit 0 # Testing sleep 0.4 done