summaryrefslogtreecommitdiff
path: root/herbstluftwm/mvrs.sh
blob: f7b3c14cc639334ff5118cd537dab24573abcb40 (plain)
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
#!/bin/bash

# ./mvrs WINID X Y Width Height

floating=$(herbstclient get_attr tags.focus.floating)

if [[ x"$floating" == xfalse ]]
then
    resizestep=0.02
    herbstclient resize $1 $2
else
    resizestep=15
    winid="$(herbstclient get_attr clients.focus.winid)"

    width=$(xwininfo -id "${winid}" | grep Width | awk '{print $2}')
    height=$(xwininfo -id "${winid}" | grep Height | awk '{print $2}')

    case $1 in
        left)
            width=$(($width - ${resizestep}))
            ;;
        right)
            width=$(($width + ${resizestep}))
            ;;
        up)
            height=$(($height - ${resizestep}))
            ;;
        down)
            height=$(($height + ${resizestep}))
            ;;
    esac


    ~/.config/herbstluftwm/bin/mvrs ${winid} $width $height
fi