blob: f202ef1c46c91a220beec0a965ad9216336ab076 [file] [log] [blame]
Samuel Shuert3f828662024-02-10 20:45:50 -05001#!/bin/sh
2workspaces() {
3
4ws1="1"
5ws2="2"
6ws3="3"
7ws4="4"
8ws5="5"
9ws6="6"
10
11# Unoccupied
12un="0"
13
14# check if Occupied
15o1=$(bspc query -D -d .occupied --names | grep "$ws1" )
16o2=$(bspc query -D -d .occupied --names | grep "$ws2" )
17o3=$(bspc query -D -d .occupied --names | grep "$ws3" )
18o4=$(bspc query -D -d .occupied --names | grep "$ws4" )
19o5=$(bspc query -D -d .occupied --names | grep "$ws5" )
20o6=$(bspc query -D -d .occupied --names | grep "$ws6" )
21
22# check if Focused
23f1=$(bspc query -D -d focused --names | grep "$ws1" )
24f2=$(bspc query -D -d focused --names | grep "$ws2" )
25f3=$(bspc query -D -d focused --names | grep "$ws3" )
26f4=$(bspc query -D -d focused --names | grep "$ws4" )
27f5=$(bspc query -D -d focused --names | grep "$ws5" )
28f6=$(bspc query -D -d focused --names | grep "$ws6" )
29
30ic_1=""
31ic_2=""
32ic_3=""
33ic_4=""
34ic_5=""
35ic_6=""
36if [ $f1 ]; then
37 ic_1=""
38elif [ $f2 ]; then
39 ic_2=""
40elif [ $f3 ]; then
41 ic_3=""
42elif [ $f4 ]; then
43 ic_4=""
44elif [ $f5 ]; then
45 ic_5=""
46elif [ $f6 ]; then
47 ic_6=""
48fi
49
50echo "(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}
53workspaces
54bspc subscribe desktop node_transfer | while read -r _ ; do
55workspaces
56done