aboutsummaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/tsarbar_status.sh54
1 files changed, 46 insertions, 8 deletions
diff --git a/.local/bin/tsarbar_status.sh b/.local/bin/tsarbar_status.sh
index dce159f..cd65726 100755
--- a/.local/bin/tsarbar_status.sh
+++ b/.local/bin/tsarbar_status.sh
@@ -2,21 +2,39 @@
tsarc config -font "CommitMono:pixelsize=15"
tsarc config -height 17
-tsarc config -bg "#000000"
+tsarc config -bg "#101010"
tsarc config -gap 10
-tsarc set ~ -text "|"
-tsarc set window -bg "#202020"
+tsarc set ~ -text "~"
+
+tsarc set ~ -fg "#888888"
+tsarc set ram -fg "#888888"
+tsarc set vol -fg "#888888"
+tsarc set player -fg "#888888"
+
+tsarc set window -bg "#FFFFFF"
+tsarc set window -fg "#000000"
tsarc set window -margin 25
-tsarc layout -left workspace -center window -right ram ~ vol ~ clock
+tsarc set cwkspace -bg "#FFFFFF"
+tsarc set cwkspace -fg "#000000"
+tsarc set cwkspace -margin 2
+
+tsarc layout \
+ -left lwkspace cwkspace rwkspace ~ player \
+ -center window \
+ -right ram ~ vol ~ clock
trap "pkill -P $$" INT
workspace() {
focused_ws=`bspc query -D --names -d focused`
- ws=`bspc query -D --names | tr '\n' ' ' | sed s/$focused_ws/$focused_ws\*/`
- tsarc set workspace -text " $ws"
+ ws=`bspc query -D --names | tr '\n' ' '`
+ lws=`echo $ws | awk -F$focused_ws '{print $1}'`
+ rws=`echo $ws | awk -F$focused_ws '{print $2}'`
+ tsarc set lwkspace -text " $lws"
+ tsarc set cwkspace -text "$focused_ws"
+ tsarc set rwkspace -text "$rws "
}
window_name() {
@@ -37,8 +55,28 @@ bspc subscribe \
window_name
done &
-while true; do
- tsarc set vol -text "VOL `pactl get-sink-volume @DEFAULT_SINK@ | awk 'NR==1{printf "%s", $5}'`"
+tsarc set vol -text \
+ "VOL `pactl get-sink-volume @DEFAULT_SINK@ | awk 'NR==1{printf "%s", $5}'`"
+
+pactl subscribe \
+| while read -r line; do
+ case "$line" in *"Event 'change' on sink #"*|*"Event 'change' on source #"*)
+ tsarc set vol -text \
+ "VOL `pactl get-sink-volume @DEFAULT_SINK@ | awk 'NR==1{printf "%s", $5}'`"
+ while read -t 0.01 -r _; do :; done
+ esac
+done &
+
+playerctl -F metadata -f "{{lc(status)}} {{lc(title)}} - {{lc(artist)}}" \
+| while read -r line; do
+ status=`echo $line | awk '{ print $1 }'`
+ case "$status" in "paused")
+ tsarc set player -text "no media"
+ esac
+ case "$status" in "playing")
+ tsarc set player -text \
+ "`echo $line | awk 'match($0, $1) {print substr($0, RSTART+RLENGTH)}'`"
+ esac
done &
while true; do