forked from RomaniukVadim/hack_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvroum
More file actions
58 lines (47 loc) · 1.38 KB
/
Copy pathvroum
File metadata and controls
58 lines (47 loc) · 1.38 KB
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
#!/bin/sh
#
# z3bra - 2014 (c) wtfpl
# window focus wrapper that sets borders and can focus next/previous window
BW=${BW:-8} # border width
IBW=${IBW:-4} # inner border with
ACTIVE=${ACTIVE:-0xffffff} # active border color
INACTIVE=${INACTIVE:-0x646464} # inactive border color
# get current window id
CUR=$(pfw)
usage() {
echo "usage: $(basename $0) <next|prev|wid>" >&2
exit 1
}
setborder() {
ROOT=$(lsw -r)
# check that window exists and shouldn't be ignored
wattr $2 || return
wattr o $2 && return
# do not modify border of fullscreen windows
test "$(wattr xywh $2)" = "$(wattr xywh $ROOT)" && return
case $1 in
active)
chwb -s $BW -c $ACTIVE $2
#chwb2 -O $ACTIVE -I $ACTIV2 -i $IBW -o $IBW $2
;;
inactive)
chwb -s $BW -c $INACTIVE $2
#chwb2 -O $INACTIVE -I $INACTIV2 -i $IBW -o $IBW $2
;;
esac
}
case $1 in
next) wid=$(lsw|grep -v $CUR|head -n 1) ;;
prev) wid=$(lsw|grep -v $CUR|tail -n 1) ;;
0x*) wattr $1 && wid=$1 ;;
*) usage ;;
esac
# exit if we can't find another window to focus
if [ -z "$wid" ]; then
echo "$(basename $0): no window to focus" >&2;
exit 1;
fi
chwso -r $wid # put it on top of the stack
wtf $wid # set focus on it
setborder active $wid # activate the new window
setborder inactive $CUR # set inactive border on current window