forked from lwilletts/fyre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmove.sh
executable file
·53 lines (49 loc) · 1.01 KB
/
move.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
#!/bin/sh
#
# wildefyr - 2015 (c) wtfpl
# mimic i3 tiled windows swapping positions
. ~/.config/fyre/fyrerc
usage() {
printf '%s\n' "usage: $(basename $0) <direction>"
exit 1
}
case $1 in
h|left)
X=$(wattr x $PFW)
Y=$(wattr y $PFW)
X=$((X - W - IGAP - BW))
if [ $X -lt 0 ]; then
snap.sh left
exit 0
fi
;;
j|down)
X=$(wattr x $PFW)
Y=$(wattr y $PFW)
Y=$((Y + H + IGAP + BW))
if [ $((Y + H)) -gt $SH ]; then
snap.sh down
exit 0
fi
;;
k|up)
X=$(wattr x $PFW)
Y=$(wattr y $PFW)
Y=$((Y - H - IGAP - BW))
if [ $Y -lt 0 ]; then
snap.sh up
exit 0
fi
;;
l|right)
X=$(wattr x $PFW)
Y=$(wattr y $PFW)
X=$((X + W + IGAP + BW))
if [ $((X + W)) -gt $SW ]; then
snap.sh right
exit 0
fi
;;
*) usage ;;
esac
wtp $X $Y $W $H $PFW