-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcrystal.sh
executable file
·94 lines (88 loc) · 2.86 KB
/
crystal.sh
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
87
88
89
90
91
92
93
94
#!/usr/bin/env sh
#
# Helps you maintains a single transparent window all throughout multiple windows and workspaces.
#===============================================================================
# Config
#===============================================================================
# BSPWM Specific settings (Chill & ignore if you are a non-user)
TOPPADDING=35
bspc config borderless_monocle true 2> /dev/null
bspc config gapless_monocle true 2> /dev/null
#===============================================================================
# Script
#===============================================================================
WORKSPACE=/tmp/crystal_ws$(xdotool get_desktop)
solo() {
case $1 in
on)
echo solo >> "$WORKSPACE"
xdo id -rd && xdo id -rd | xargs xdo hide
bspc desktop -l monocle 2> /dev/null
;;
off)
sed -i '/solo/d' "$WORKSPACE"
xdo id -rd && xdo id -rd | xargs xdo show
bspc desktop -l tiled 2> /dev/null
;;
esac
xdo id -rd | head -1 | xargs xdo activate
bspc node -n biggest.local 2> /dev/null
}
case $1 in
--navigate)
shift
window=$(xdo id -rd | head -1)
case $1 in
next)
! grep next "$WORKSPACE" && echo next >> "$WORKSPACE" && window=$(xdo id -rd | tail -1)
;;
prev)
grep next "$WORKSPACE" && sed -i 's/next//' "$WORKSPACE" && window=$(xdo id -rd | tail -1)
;;
esac
if grep solo "$WORKSPACE" && xdo id -rd; then
xdo show "$window"
xdo id -rd | tail -1 | xargs xdo hide
else
xdo activate "$window"
fi
;;
--toggle)
shift
case $1 in
solo)
if grep solo "$WORKSPACE"; then
solo off
else
solo on
fi
;;
fullscreen)
if grep fullscreen "$WORKSPACE"; then
sed -i '/fullscreen/d' "$WORKSPACE"
xdo show -a "$STATUSBAR"
solo off
bspc config top_padding $TOPPADDING
else
echo fullscreen >> "$WORKSPACE"
xdo hide -a "$STATUSBAR"
solo on
bspc config top_padding 0
fi
tmux set status
;;
esac
;;
--close)
xdo close
if grep solo "$WORKSPACE"; then
if xdo id -rd; then
xdo id -rd | head -1 | xargs xdo show
else
xdo show -a "$STATUSBAR"
bspc config top_padding $TOPPADDING 2> /dev/null
fi
fi
;;
*) : ;;
esac