-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadjust
executable file
·39 lines (31 loc) · 915 Bytes
/
adjust
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
#!/bin/sh
#
# adjust
usage() {
base="$(basename "$0")"
cat >&2 << EOF
Usage:
$ $base -u | up $PFW : Move $JUMP pixels up.
$ $base -l | left $PFW : Move $JUMP pixels left.
$ $base -d | down $PFW : Move $JUMP pixels down.
$ $base -r | right $PFW : Move $JUMP pixels right.
EOF
[ $# -eq 0 ] || exit "$1"
}
main() {
. fwmrc
wmenv
widCheck "$2" && wid="$2" || wid=$PFW
case "$1" in
-u|--up|up) wmv 0 -$JUMP "$wid" ;;
-d|--down|down) wmv 0 +$JUMP "$wid" ;;
-l|--left|left) wmv -$JUMP 0 "$wid" ;;
-r|--right|right) wmv +$JUMP 0 "$wid" ;;
-h|--help|help) usage 0 ;;
*) usage 1 ;;
esac
# move mouse to middle of window
wmp -a $(($(wattr x "$wid") + $(wattr w "$wid") / 2 + BW)) \
$(($(wattr y "$wid") + $(wattr h "$wid") / 2 + BW))
}
main "$@"