-
Notifications
You must be signed in to change notification settings - Fork 23
/
bspcp
60 lines (57 loc) · 1.48 KB
/
bspcp
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
#!/bin/sh
i=1
case $1 in
dsktp) # Add or remove a desktop
case $2 in
add)
current=$(bspc query -D | wc -l)
if [ "$current" -lt "10" ]; then
new=$((current + 1))
bspc monitor -a $new
else
notify-send "You already have ten desktops" "Are those really necessary? Consider closing unneeded windows." -i warning
fi
;;
rm)
current=$(bspc query -D | wc -l)
if [ "$current" -gt "4" ]; then
bspc monitor -r $(bspc query -D | sed -n ${current}p)
else
notify-send "You currently have four desktops" "That can be considered a bare minimum. You should not remove more." -i warning
fi
;;
esac
;;
empty)
nextFreeDesktop=$(bspc query -D -d next.free)
if [ -z "$nextFreeDesktop" ]
then
nextFreeDesktop=$(( $(bspc query -D | wc -l) + 1 ))
bspc monitor -a $nextFreeDesktop
fi
case $2 in
move)
bspc window -d $nextFreeDesktop
;;
next)
bspc rule -a \* -o desktop=$nextFreeDesktop follow=true
;;
esac
;;
tile) # Force every existing window to tile (the opposite is dumb IMHO)
for window in $(bspc query -N -d focused)
do
bspc node $window -t tiled
done
;;
float) # Force every existing window to float and place the windows
for window in $(bspc query -N -d focused)
do
bspc node $window -t floating
let i++
done
;;
*)
exit
;;
esac