Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | workspaces() { |
| 3 | |
| 4 | ws1="1" |
| 5 | ws2="2" |
| 6 | ws3="3" |
| 7 | ws4="4" |
| 8 | ws5="5" |
| 9 | ws6="6" |
| 10 | |
| 11 | # Unoccupied |
| 12 | un="0" |
| 13 | |
| 14 | # check if Occupied |
| 15 | o1=$(bspc query -D -d .occupied --names | grep "$ws1" ) |
| 16 | o2=$(bspc query -D -d .occupied --names | grep "$ws2" ) |
| 17 | o3=$(bspc query -D -d .occupied --names | grep "$ws3" ) |
| 18 | o4=$(bspc query -D -d .occupied --names | grep "$ws4" ) |
| 19 | o5=$(bspc query -D -d .occupied --names | grep "$ws5" ) |
| 20 | o6=$(bspc query -D -d .occupied --names | grep "$ws6" ) |
| 21 | |
| 22 | # check if Focused |
| 23 | f1=$(bspc query -D -d focused --names | grep "$ws1" ) |
| 24 | f2=$(bspc query -D -d focused --names | grep "$ws2" ) |
| 25 | f3=$(bspc query -D -d focused --names | grep "$ws3" ) |
| 26 | f4=$(bspc query -D -d focused --names | grep "$ws4" ) |
| 27 | f5=$(bspc query -D -d focused --names | grep "$ws5" ) |
| 28 | f6=$(bspc query -D -d focused --names | grep "$ws6" ) |
| 29 | |
| 30 | ic_1="" |
| 31 | ic_2="" |
| 32 | ic_3="" |
| 33 | ic_4="" |
| 34 | ic_5="" |
| 35 | ic_6="" |
| 36 | if [ $f1 ]; then |
| 37 | ic_1="" |
| 38 | elif [ $f2 ]; then |
| 39 | ic_2="" |
| 40 | elif [ $f3 ]; then |
| 41 | ic_3="" |
| 42 | elif [ $f4 ]; then |
| 43 | ic_4="" |
| 44 | elif [ $f5 ]; then |
| 45 | ic_5="" |
| 46 | elif [ $f6 ]; then |
| 47 | ic_6="" |
| 48 | fi |
| 49 | |
| 50 | echo "(box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"false\" (button :onclick \"bspc desktop -f $ws1\" :class \"$un$o1$f1\" \"$ic_1\") (button :onclick \"bspc desktop -f $ws2\" :class \"$un$o2$f2\" \"$ic_2\") (button :onclick \"bspc desktop -f $ws3\" :class \"$un$o3$f3\" \"$ic_3\") (button :onclick \"bspc desktop -f $ws4\" :class \"$un$o4$f4\" \"$ic_4\") (button :onclick \"bspc desktop -f $ws5\" :class \"$un$o5$f5\" \"$ic_5\") (button :onclick \"bspc desktop -f $ws6\" :class \"$un$o6$f6\" \"$ic_6\"))" |
| 51 | |
| 52 | } |
| 53 | workspaces |
| 54 | bspc subscribe desktop node_transfer | while read -r _ ; do |
| 55 | workspaces |
| 56 | done |