Created
January 10, 2015 11:51
-
-
Save aboettger/c367facee459f8eccde6 to your computer and use it in GitHub Desktop.
center active window
This file contains 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 | |
IFS='x' read screenWidth screenHeight < <(xdpyinfo | grep dimensions | grep -o '[0-9x]*' | head -n1) | |
width=$(xdotool getactivewindow getwindowgeometry --shell | head -4 | tail -1 | sed 's/[^0-9]*//') | |
height=$(xdotool getactivewindow getwindowgeometry --shell | head -5 | tail -1 | sed 's/[^0-9]*//') | |
newPosX=$((screenWidth/2-width/2)) | |
newPosY=$((screenHeight/2-height/2)) | |
xdotool getactivewindow windowmove "$newPosX" "$newPosY" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment