Created
June 28, 2018 17:47
-
-
Save wallacesilva/3f2aae1da99fc0fbcd1fe354faf6a35e to your computer and use it in GitHub Desktop.
Resize window active/focused with this script - [INCOMPLETE]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Wallace Silva - wallacesilva.com | |
dothis=true | |
toW=720 | |
toH=560 | |
nowW=0 | |
nowH=0 | |
increment=1 | |
while [ dothis ] | |
do | |
nowW=$(xdotool getwindowfocus getwindowgeometry | sed -n '3,30p' | cut -d ':' -f 2 | xargs | cut -d 'x' -f 1) | |
nowH=$(xdotool getwindowfocus getwindowgeometry | sed -n '3,30p' | cut -d ':' -f 2 | xargs | cut -d 'x' -f 2) | |
ratioW=$(((toW-nowW)/100)) | |
ratioH=$(((toH-nowH)/100)) | |
echo "Ratio // W: $ratioW / H: $ratioH" | |
if [ "$nowW" -lt "$toW" ]; then | |
# nowW=$((nowW+increment)) | |
nowW=$((nowW+ratioW)) | |
fi | |
if [ "$nowH" -lt "$toH" ]; then | |
# nowH=$((nowH+increment)) | |
nowH=$((nowH+ratioH)) | |
fi | |
sleep 0.1 && wmctrl -r :ACTIVE: -e 0,300,168,$nowW,$nowH | |
if [ "$nowW" -ge "$toW" ] && [ "$nowH" -ge "$toH" ]; then | |
dothis=false | |
fi | |
# can be better | |
if [ $dothis ]; then | |
doNothing=0 | |
echo "NOW // W: $nowW / H: $nowH" | |
echo "TO // W: $toW / H: $toH" | |
else | |
exit | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment