blob: 34af41f6e018add034e86ab199898e09288e284b (
plain) (
blame)
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
|
#! /bin/bash
active() {
if [[ $arg = 0 && $(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs) -gt 1 ]]
# if [[ $arg = 0 ]]
then
arg=1
else
arg=0
fi
# fi
num=$(river-bedload -print outputs | jq -r '.['$arg'] | select(.).view_tags')
num=$(echo $num | awk -F' ' '{print $1}')
b=0
while [[ $num -gt 0 ]]
do
let temp=$num%2
if [[ $temp -eq 1 ]]
then
let count=$count+1
fi
let num=$num/2
let b=b+1
if [[ $temp -eq 1 ]]
then
echo $b
fi
done
return $b
}
#define icons for workspaces 1-9
ic=(0 1 2 3 4 5 6 7 8 9)
workspaces() {
export arg="$1"
unset -v \
o1 o2 o3 o4 o5 o6 o7 o8 o9 \
f1 f2 f3 f4 f5 f6 f7 f8 f9
ows="$(active)"
for num in $ows; do
export o"$num"="$num"
done
# Get Focused workspace for current monitor ID
export arg="$1"
if [[ $arg = 0 && $(river-bedload -print outputs | jq -r '.[''] | select(.).name' | wc -l | xargs) -gt 1 ]]
then
arg=1
else
arg=0
fi
num=$(river-bedload -print focused | jq -r '.['$arg'] | select(.).focused_id')
export f"$num"="$num"
echo "(box :class \"workspace\" :orientation \"h\" :space-evenly \"false\" \
(button :onclick \"riverctl set-focused-tags $((1 << (1 - 1)))\" :class \"w0$o1$f1\" \"${ic[1]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (2 - 1)))\" :class \"w0$o2$f2\" \"${ic[2]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (3 - 1)))\" :class \"w0$o3$f3\" \"${ic[3]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (4 - 1)))\" :class \"w0$o4$f4\" \"${ic[4]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (5 - 1)))\" :class \"w0$o5$f5\" \"${ic[5]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (6 - 1)))\" :class \"w0$o6$f6\" \"${ic[6]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (7 - 1)))\" :class \"w0$o7$f7\" \"${ic[7]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (8 - 1)))\" :class \"w0$o8$f8\" \"${ic[8]}\") \
(button :onclick \"riverctl set-focused-tags $((1 << (9 - 1)))\" :class \"w0$o9$f9\" \"${ic[9]}\") \
)"
}
workspaces $1
river-bedload -watch active | while read -r; do
workspaces $1
done
|