blob: cd65726e281ad85b5fa7b27b5960d0a81e681ab3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#! /bin/bash
tsarc config -font "CommitMono:pixelsize=15"
tsarc config -height 17
tsarc config -bg "#101010"
tsarc config -gap 10
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 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' ' '`
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() {
win_id=$(bspc query -N -n focused)
if [[ -n "$win_id" ]]; then
title=$(xtitle $win_id)
tsarc set window -text "$title"
else
tsarc set window -text "[...]"
fi
}
bspc subscribe \
desktop_focus desktop_add desktop_remove \
node_focus node_add node_remove node_transfer \
| while read -r _; do
workspace
window_name
done &
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
tsarc set clock -text "`date +"%a %b %d, %r"` "
tsarc set ram -text "RAM `free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2}'`"
sleep 1
done
|