Skip to content
Browse files

v0.0.1 fixed on run issue

  • Loading branch information...
1 parent 36b7cfe commit 6fb64d03746bda9ab35f335bc531f545a490fd9f @jgallen23 committed Feb 22, 2012
Showing with 128 additions and 6 deletions.
  1. +3 −0 .gitmodules
  2. +11 −0 Makefile
  3. +3 −1 README.md
  4. +5 −0 TODO
  5. +1 −1 alfred/out/info.plist
  6. BIN dist/Layouts.alfredextension
  7. +97 −0 docs/index.md
  8. +7 −4 layouts.applescript
  9. +1 −0 site
View
3 .gitmodules
@@ -0,0 +1,3 @@
+[submodule "site"]
+ path = site
+ url = git@github.com:jgallen23/layouts.git
View
11 Makefile
@@ -1,2 +1,13 @@
alfred:
./build.py && cd alfred/out && zip tmp.zip * && mv tmp.zip ../../dist/Layouts.alfredextension
+
+site : docs/index.md
+ @markx --nohl docs/index.md | cat site/layout/head.html - site/layout/foot.html > site/index.html
+
+preview-site:
+ @markx --nohl --preview 8001 docs/index.md
+
+preview-readme:
+ @markx --preview 8001 README.md
+
+.PHONY: preview-docs preview-readme
View
4 README.md
@@ -1,3 +1,5 @@
# Layouts
-Layouts is an applescript and an alfred extension to easily move windows into pre-defined locations. Go [here]() for more info.
+Layouts is an applescript and an [alfred](http://www.alfredapp.com/) extension to easily move and resize application windows.
+
+Go [here](http://projects.jga.me/layouts/) for more info.
View
5 TODO
@@ -0,0 +1,5 @@
+v0.0.1: @done(2012-02-22)
+ - fix on run argv @done(2012-02-22)
+ - screenshot @done(2012-02-22)
+ - alfred hotkey screenshot @done(2012-02-22)
+ - add link to TODO @done(2012-02-22)
View
2 alfred/out/info.plist
@@ -9,7 +9,7 @@
<key>category</key>
<string>APPLESCRIPTS</string>
<key>command</key>
- <string>on resize(loc)
+ <string>on resize(loc)
set perc to 0.9
tell application "Finder"
set _b to bounds of window of desktop
View
BIN dist/Layouts.alfredextension
Binary file not shown.
View
97 docs/index.md
@@ -0,0 +1,97 @@
+# Layouts
+
+Layouts is an applescript and an [alfred](http://www.alfredapp.com/) extension to easily move and resize application windows.
+
+![Example Layout](/ui/layouts.jpg)
+
+##Alfred
+
+I've created an alfred extension, which you can download [here](https://github.com/jgallen23/layouts/raw/master/dist/Layouts.alfredextension).
+
+###Command
+- resize [f, t, b, l, r, tl, tr, bl, br, c]
+
+###Layouts
+- f: full screen
+- c: center window
+- t: top half of screen
+- b: bottom half of screen
+- l: left half of screen
+- r: right half of screen
+- tl: top left quarter of screen
+- tr: top right quarter of screen
+- bl: bottom left quarter of screen
+- br: bottom right quarter of screen
+
+###Hotkey support
+Thanks to Alfred's new hotkey feature, you don't even have to trigger alfred to move your windows around.
+
+![Hotkeys](/ui/layouts-hotkeys.jpg)
+
+##Applescript
+Here's the applescript that is powering the extension, which you can use by itself:
+
+ on resize(loc)
+ set perc to 0.9
+ tell application "Finder"
+ set _b to bounds of window of desktop
+ set w to item 3 of _b
+ set h to item 4 of _b
+ end tell
+
+ set front_app to (path to frontmost application as Unicode text)
+ tell application front_app
+ activate
+ if loc contains "tr" then
+ set bounds of window 1 to {(w / 2), 0, w, (h / 2)}
+ else if loc contains "tl" then
+ set bounds of window 1 to {0, 0, (w / 2), (h / 2)}
+ else if loc contains "bl" then
+ set bounds of window 1 to {0, (h / 2), (w / 2), h}
+ else if loc contains "br" then
+ set bounds of window 1 to {{w / 2, (h / 2), w, h}}
+ else if loc contains "t" then
+ set bounds of window 1 to {0, 0, w, (h / 2)}
+ else if loc contains "r" then
+ set bounds of window 1 to {(w / 2), 0, w, h}
+ else if loc contains "l" then
+ set bounds of window 1 to {0, 0, (w / 2), h}
+ else if loc contains "b" then
+ set bounds of window 1 to {0, (w / 2), w, h}
+ else if loc contains "c" then
+ set newW to w * perc
+ set newH to h * perc
+ set newX to (w * (1 - perc))
+ set newY to (h * (1 - perc))
+ set bounds of window 1 to {newX, newY, newW, newH}
+ else
+ set bounds of window 1 to {0, 0, w, h}
+ end if
+ end tell
+ end resize
+
+ on alfred_script(loc)
+ resize(loc)
+ end alfred_script
+
+ --uncomment these lines to use for command line
+ --on run argv
+ -- resize(item 1 of argv)
+ --end run
+
+ --this can be changed to f,t,b,l,r,tl,tr,bl,br or c
+ --resize("c")
+
+###Command Line
+The script will work via the command line too! *Make sure to uncomment the on run argv lines if you want to use it this way*
+
+ osascript layouts.applescript f
+
+Go [here](https://raw.github.com/jgallen23/layouts/master/layouts.applescript) to download the script
+
+##Future
+
+View [TODO](https://raw.github.com/jgallen23/layouts/master/docs/TODO)
+
+##Authors
+- Greg Allen ([@jgaui](http://twitter.com/jgaui)) [jga.me](http://jga.me)
View
11 layouts.applescript
@@ -40,8 +40,11 @@ end resize
on alfred_script(loc)
resize(loc)
end alfred_script
-on run argv
- resize(item 1 of argv)
-end run
+
+--uncomment these lines to use for command line
+--on run argv
+-- resize(item 1 of argv)
+--end run
+
--this can be changed to f,t,b,l,r,tl,tr,bl,br or c
---resize("c")
+--resize("c")
1 site
@@ -0,0 +1 @@
+Subproject commit 14746e8b7f83c7a7bbf875a48d6f4fb4d38260c9

0 comments on commit 6fb64d0

Please sign in to comment.
Something went wrong with that request. Please try again.