From 82df70eff06e7b44ee84283070d7f801f7fc1d92 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sat, 6 Nov 2021 20:25:45 -0400 Subject: initial commit --- .local/bin/statusbar/bar-calcurse | 15 +++++++++++++++ .local/bin/statusbar/bar-cmus | 25 +++++++++++++++++++++++++ .local/bin/statusbar/bar-cpu | 7 +++++++ .local/bin/statusbar/bar-gpu | 6 ++++++ .local/bin/statusbar/bar-ipv4 | 9 +++++++++ .local/bin/statusbar/bar-memory | 8 ++++++++ .local/bin/statusbar/bar-storage | 7 +++++++ .local/bin/statusbar/bar-time | 7 +++++++ .local/bin/statusbar/bar-volume | 13 +++++++++++++ 9 files changed, 97 insertions(+) create mode 100755 .local/bin/statusbar/bar-calcurse create mode 100755 .local/bin/statusbar/bar-cmus create mode 100755 .local/bin/statusbar/bar-cpu create mode 100755 .local/bin/statusbar/bar-gpu create mode 100755 .local/bin/statusbar/bar-ipv4 create mode 100755 .local/bin/statusbar/bar-memory create mode 100755 .local/bin/statusbar/bar-storage create mode 100755 .local/bin/statusbar/bar-time create mode 100755 .local/bin/statusbar/bar-volume (limited to '.local/bin/statusbar') diff --git a/.local/bin/statusbar/bar-calcurse b/.local/bin/statusbar/bar-calcurse new file mode 100755 index 0000000..dca82f3 --- /dev/null +++ b/.local/bin/statusbar/bar-calcurse @@ -0,0 +1,15 @@ +#!/bin/sh + +#i3blocks calcurse module + +case $BUTTON in + 3)notify-send -t 5000 "$(calcurse -D ~/.config/calcurse/ -c ~/.config/calcurse/apts -a)";; + 1)notify-send -t 20000 "$(calcurse -D ~/.config/calcurse/ -c ~/.config/calcurse/apts -r7)";; + 2)notify-send -t 5000 "$(calcurse -D ~/.config/calcurse/ -t)" +esac + +name="$(calcurse -D ~/.config/calcurse/ -c ~/.config/calcurse/apts -n | grep "\[" | sed "s/\s*\[/\[/" | cut -d ' ' -f 2-)" +[ "$name" = "" ] && echo "Nothing Scheduled" && exit 0 +time="$(grep "$name" ~/.config/calcurse/apts | head -1 | cut -d ' ' -f 3)" +[ ${time%%:*} -gt 12 ] && time="$((${time%%:*}-12)):${time##*:} PM" || time="$time AM" +echo "$name @ $time" diff --git a/.local/bin/statusbar/bar-cmus b/.local/bin/statusbar/bar-cmus new file mode 100755 index 0000000..947f950 --- /dev/null +++ b/.local/bin/statusbar/bar-cmus @@ -0,0 +1,25 @@ +#!/bin/sh + +case $BUTTON in + 1)notify-send "$(cmus-remote -Q | grep position | awk '{ printf "%02i:%02i", $2/60, $2%60}')/$(cmus-remote -Q | grep duration | awk '{ printf "%02i:%02i\n", $2/60, $2%60} ') ($(cmus-remote -Q | grep status | cut -d ' ' -f 2-)) +Artist: $(cmus-remote -Q | grep "tag artist " | cut -d ' ' -f 3-) +Album: $(cmus-remote -Q | grep "tag album " | cut -d ' ' -f 3-) +Track: $(cmus-remote -Q | grep "tag title " | cut -d ' ' -f 3-) +Genre: $(cmus-remote -Q | grep "tag genre " | cut -d ' ' -f 3-) +Mode: $(cmus-remote -Q | grep "aaa_mode" | cut -d ' ' -f 3) +Format: $(cmus-remote -Q | grep file | rev | cut -d '.' -f 1 | rev) +Shuffle: $(cmus-remote -Q | grep "set shuffle " | cut -d ' ' -f 3-) +Repeat: $(cmus-remote -Q | grep "set repeat_current " | cut -d ' ' -f 3-)";; + + 3)urxvt -e vim ~/.local/bin/statusbar/cmus;; + 4)cmus-remote --next;; + 5)cmus-remote --prev;; +esac + +pgrep -x cmus >/dev/null || exit 0 + +status="$(cmus-remote -Q | grep status | cut -d ' ' -f 2)" +artist="$(cmus-remote -Q | grep "tag artist" | cut -d ' ' -f 3- | tr -d "\n")" +track="$(cmus-remote -Q | grep "tag title" | cut -d ' ' -f 3- | tr -d "\n")" +echo -n "$artist - $track" +[ "$status" = "playing" ] || echo -n " [P]" diff --git a/.local/bin/statusbar/bar-cpu b/.local/bin/statusbar/bar-cpu new file mode 100755 index 0000000..c21fe20 --- /dev/null +++ b/.local/bin/statusbar/bar-cpu @@ -0,0 +1,7 @@ +#!/bin/sh +case $BUTTON in + 1) notify-send "$(ps axc -o cmd:15,%cpu --sort=-%cpu | head -6)";; + 3) urxvt -e vim ~/.local/bin/statusbar/cpu +esac +mpstat 1 1 | awk '/Average/ { printf "%.2f% ",100-$12 }' +temp="$(sensors | awk '/Tctl/ { print $2 } ')"; echo -n ${temp#+} diff --git a/.local/bin/statusbar/bar-gpu b/.local/bin/statusbar/bar-gpu new file mode 100755 index 0000000..5351a2f --- /dev/null +++ b/.local/bin/statusbar/bar-gpu @@ -0,0 +1,6 @@ +#!/bin/sh + +temp="$(sensors | awk '/edge/ { print $2 } ')" +fan="$(sensors | awk '/fan1/ { print $2 } ')" +power="$(sensors | awk '/power1/ { print $2 } ')" +echo -n "${temp#+} $fan RPM" diff --git a/.local/bin/statusbar/bar-ipv4 b/.local/bin/statusbar/bar-ipv4 new file mode 100755 index 0000000..4e51eca --- /dev/null +++ b/.local/bin/statusbar/bar-ipv4 @@ -0,0 +1,9 @@ +#!/bin/sh + +case $BUTTON in + 1)notify-send --expire-time=60000 "IP Addresses" "$(ip a | awk '/\/24|\/64/ {if($5=="temporary")print $2 " " $5;else print $2;}')";; + 3)urxvt -e ~/.local/bin/statusbar/ipv4 +esac +ip a | awk '/\/24/ { print $2 }' | cut -d '/' -f 1 + + diff --git a/.local/bin/statusbar/bar-memory b/.local/bin/statusbar/bar-memory new file mode 100755 index 0000000..1e98cca --- /dev/null +++ b/.local/bin/statusbar/bar-memory @@ -0,0 +1,8 @@ +#!/bin/sh + +case $BUTTON in + 1)notify-send "$(ps axc -o cmd:15,%mem --sort=-%mem | head -6)";; + 3)urxvt -e vim ~/.local/bin/statusbar/memory +esac +free --si -h | grep Mem | awk '{ print $3 "/" $2 }' + diff --git a/.local/bin/statusbar/bar-storage b/.local/bin/statusbar/bar-storage new file mode 100755 index 0000000..d7b5fcf --- /dev/null +++ b/.local/bin/statusbar/bar-storage @@ -0,0 +1,7 @@ +#!/bin/sh + +case $BUTTON in + 1)notify-send "$(df -H | grep "Filesystem\|/dev/sd")";; + 3)urxvt -e vim ~/.local/bin/statusbar/storage +esac +df -H | awk '/\/home/ { print $4 }' diff --git a/.local/bin/statusbar/bar-time b/.local/bin/statusbar/bar-time new file mode 100755 index 0000000..f61a268 --- /dev/null +++ b/.local/bin/statusbar/bar-time @@ -0,0 +1,7 @@ +#!/bin/sh + +case $BUTTON in + 1)notify-send "$(ncal -hb)";; + 3)urxvt -e vim ~/.local/bin/statusbar/time +esac +date +"%r %A %D" diff --git a/.local/bin/statusbar/bar-volume b/.local/bin/statusbar/bar-volume new file mode 100755 index 0000000..d9bcc9d --- /dev/null +++ b/.local/bin/statusbar/bar-volume @@ -0,0 +1,13 @@ +#!/bin/sh +# i3blocks volume module + +case $BUTTON in + 1)urxvt -e alsamixer;; + 3)urxvt -e vim ~/.local/bin/statusbar/volume;; + 4)amixer -q sset Master 1%+ unmute;; + 5)amixer -q sset Master 1%- unmute;; +esac + +stats=$(amixer sget Master | grep "Front Left:" | cut -d ' ' -f 7,8 | tr -d '[]') +[ "${stats##* }" = "on" ] && echo -n "${stats%% *}" || echo -n "${stats%% *}" + -- cgit v1.2.3