From f094bef7d41114461003045d7491adb7fa0046bb Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Wed, 21 Feb 2024 22:31:58 -0600 Subject: [PATCH] hopefully this works --- scripts/cal | 24 --------------- scripts/sway/swaystatus | 65 ++++++++--------------------------------- shell/aliasrc | 1 + 3 files changed, 13 insertions(+), 77 deletions(-) delete mode 100755 scripts/cal diff --git a/scripts/cal b/scripts/cal deleted file mode 100755 index 2ce75e4..0000000 --- a/scripts/cal +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -FUNC="$1" -MODE="$2" - -all() { - printf "\033[1m\033[34m=== %s ===\033[0m\n%s\n" "$DATE" "$(calcurse -a -t)" -} - -apts() { - [ -z "$MODE" ] && apts="$(calcurse -a)" - [ "$MODE" = "count" ] && apts="$(calcurse -a | grep -c '\*')" - if [ "$apts" = "0" -o "$apts" = "" ] ; then return 0 ; fi - echo "󰃭 $apts" -} - -todo() { - [ -z "$MODE" ] && todo="$(calcurse -t)" - [ "$MODE" = "count" ] && todo="$(calcurse -t | wc -l)" - if [ "$todo" = "0" -o "$todo" = "" ] ; then return 0 ; fi - echo " $todo" -} - -[ -z "$FUNC" ] && all && exit 0 -$FUNC $MODE diff --git a/scripts/sway/swaystatus b/scripts/sway/swaystatus index 517e226..6dc6df0 100755 --- a/scripts/sway/swaystatus +++ b/scripts/sway/swaystatus @@ -1,56 +1,16 @@ #!/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_todo() { + todo="$(calcurse -t | wc -l)" + [ "$todo" = "0" ] && return 0 + echo " $todo" } -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_apts() { + apts="$(calcurse -a | grep -c '\*')" + [ "$apts" = "0" ] && return 0 + echo "󰃭 $apts" } get_layout() { @@ -60,20 +20,19 @@ get_layout() { echo "󰌌 $layout" } - while true ; do status="" - todo="$(cal todo count)" + todo="$(get_todo)" ! [ -z "$todo" ] && status="$status$separator$todo" - apts="$(cal apts count)" + apts="$(get_apts)" ! [ -z "$apts" ] && status="$status$separator$apts" - volume="$(get_vol)" + volume="$(volstat)" ! [ -z "$volume" ] && status="$status$separator$volume" - microphone="$(get_mic)" + microphone="$(micstat)" ! [ -z "$microphone" ] && status="$status$separator$microphone" network="$(netstat)" diff --git a/shell/aliasrc b/shell/aliasrc index d505cb0..9931c42 100644 --- a/shell/aliasrc +++ b/shell/aliasrc @@ -30,6 +30,7 @@ alias \ # Command shortcuts alias \ mgr-all="mgr pacman_upgrade apt_upgrade flatpak_update distrobox_update pip_update configs passmgr" \ + cal='printf "\033[1m\033[34m=== %s ===\033[0m\n%s\n" "$DATE" "$(calcurse -a -t)"' \ df-short="df -h | grep -v '\s/dev.*$\|\s/run.*$\|\s/boot.*$'" \ wacom-setup-menu="wacom-setup menu" \ swayimg="swayimg -s fit -w 000000 -m" \