forked from wycats/osx-window-sizing
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use screen-sensitive sizing, with Safari measurements
- Loading branch information
Showing
4 changed files
with
48 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
-- Put frontmost window on left half | ||
|
||
tell application "Safari" | ||
set screen_width to (do JavaScript "screen.availWidth" in document 1) | ||
set screen_height to (do JavaScript "screen.availHeight" in document 1) | ||
end tell | ||
|
||
-- tell application "Finder" | ||
-- set {desktopTop, desktopLeft, desktopRight, desktopBottom} to bounds of desktop | ||
-- end tell | ||
|
||
tell application "System Events" | ||
|
||
set myFrontMost to name of first item of (processes whose frontmost is true) | ||
|
||
tell process myFrontMost | ||
set size of window 1 to {840, 1040} | ||
set size of window 1 to {(screen_width/2), screen_height} | ||
set position of window 1 to {0, 20} | ||
end tell | ||
|
||
end tell | ||
end tell | ||
|
||
tell application "Safari" | ||
quit | ||
end tell |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
-- Put frontmost window on right half | ||
|
||
tell application "Safari" | ||
set screen_width to (do JavaScript "screen.availWidth" in document 1) | ||
set screen_height to (do JavaScript "screen.availHeight" in document 1) | ||
end tell | ||
|
||
-- tell application "Finder" | ||
-- set {desktopTop, desktopLeft, desktopRight, desktopBottom} to bounds of desktop | ||
-- end tell | ||
|
||
tell application "System Events" | ||
|
||
set myFrontMost to name of first item of (processes whose frontmost is true) | ||
|
||
tell process myFrontMost | ||
set size of window 1 to {840, 1040} | ||
set position of window 1 to {840, 20} | ||
set size of window 1 to {(screen_width/2), screen_height} | ||
set position of window 1 to {(screen_width/2), 20} | ||
end tell | ||
|
||
end tell | ||
end tell | ||
|
||
tell application "Safari" | ||
quit | ||
end tell |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
-- Put frontmost window on left side | ||
|
||
tell application "Safari" | ||
set screen_width to (do JavaScript "screen.availWidth" in document 1) | ||
set screen_height to (do JavaScript "screen.availHeight" in document 1) | ||
end tell | ||
|
||
tell application "System Events" | ||
|
||
set myFrontMost to name of first item of (processes whose frontmost is true) | ||
|
||
tell process myFrontMost | ||
set size of window 1 to {1040, 1040} | ||
set size of window 1 to {1040, screen_height} | ||
set position of window 1 to {0, 20} | ||
end tell | ||
|
||
end tell | ||
end tell | ||
|
||
tell application "Safari" | ||
quit | ||
end tell |