Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/garthdb/windowresizer
An Alfred 2 Workflow that will resize windows to exact pixel dimensions.
https://github.com/garthdb/windowresizer
Last synced: about 1 month ago
JSON representation
An Alfred 2 Workflow that will resize windows to exact pixel dimensions.
- Host: GitHub
- URL: https://github.com/garthdb/windowresizer
- Owner: GarthDB
- License: apache-2.0
- Created: 2013-06-06T18:11:11.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-05T20:53:02.000Z (about 11 years ago)
- Last Synced: 2024-11-29T15:53:26.221Z (about 1 month ago)
- Language: AppleScript
- Size: 172 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
WindowResizer
=============An [Alfred 2](http://www.alfredapp.com/) Workflow that will resize windows to exact pixel dimensions.
Installation
=============
Download the [workflow](https://github.com/GarthDB/WindowResizer/releases) file and double click it to install it in Alfred.Usage
=============The worklow is simple. It just resizes the topmost window to the pixel dimensions entered. Format the dimensions as `WIDTHxHEIGHT` (replacing `WIDTH` and `HEIGHT` with the size in pixels).
Exmaple:
```
resizer 400x500
```
![Resizer](//screenshot.png)Script
===The actual AppleScript is:
```AppleScript
to splitString(aString, delimiter)
set retVal to {}
set prevDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to {delimiter}
set retVal to every text item of aString
set AppleScript's text item delimiters to prevDelimiter
return retVal
end splitString
on alfred_script(q)
set newDimensions to splitString(q as text, "x")
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
end tell
try
tell application frontApp
set current to bounds of the first window
tell window 1
set the bounds to {item 1 of current, item 2 of current, (item 1 of current) + (item 1 of newDimensions), (item 2 of current) + (item 2 of newDimensions)}
end tell
end tell
on error errMsg
tell application "System Events" to tell application process frontApp
tell window 1
set size to {item 1 of newDimensions, item 2 of newDimensions}
end tell
end tell
end try
end alfred_script
```Colophon
===* This workflow uses Geert JM Vanderkelen's [string splitter example](http://geert.vanderkelen.org/splitting-as-string-and-joining-a-list-using-applescript/).
* The resize icon has been added to [The Noun Project](http://thenounproject.com/garthdb/)