Created
December 9, 2011 20:05
-
-
Save jaromero/1453073 to your computer and use it in GitHub Desktop.
Quick n' dirty window resize script
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 | |
| E_BADARGS=65 | |
| usage() | |
| { | |
| cat << EOF | |
| usage: $0 [options|dimensions] | |
| <dimensions> | |
| Specify dimensions e.g. 800x600 | |
| -h This message | |
| -p <preset> | |
| Specify a preset to use | |
| EOF | |
| } | |
| if [ -z $1 ] | |
| then | |
| echo "Please specify window dimensions or a preset name" | |
| exit $E_BADARGS | |
| fi | |
| case $1 in | |
| "") | |
| usage | |
| exit 0 | |
| ;; | |
| "-h") | |
| usage | |
| exit 0 | |
| ;; | |
| "-p") | |
| if [ -z $2 ] | |
| then | |
| echo "Please specify a preset name" | |
| exit $E_BADARGS | |
| else | |
| echo "Preset name: ${2}" | |
| case $2 in | |
| # From http://en.wikipedia.org/wiki/Graphic_display_resolutions | |
| "vga") | |
| dimensions="640,480" | |
| ;; | |
| "svga") | |
| dimensions="800,600" | |
| ;; | |
| "xga") | |
| dimensions="1024,768" | |
| ;; | |
| "wxga") | |
| dimensions="1280,768" | |
| ;; | |
| "sxga") | |
| dimensions="1280,1024" | |
| ;; | |
| "sxga+") | |
| dimensions="1400,1050" | |
| ;; | |
| "nhd") | |
| dimensions="640,360" | |
| ;; | |
| "hd") | |
| dimensions="1280,720" | |
| ;; | |
| "fhd") | |
| dimensions="1920,1080" | |
| ;; | |
| "browser") | |
| dimensions="1280,960" | |
| ;; | |
| esac | |
| fi | |
| ;; | |
| *) | |
| IFS='x' read -ra dims <<< "$1" | |
| dimensions="${dims[0]},${dims[1]}" | |
| ;; | |
| esac | |
| wmctrl -r :SELECT: -e 5,0,0,"${dimensions}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment