Created
August 21, 2013 12:58
-
-
Save moonhouse/6294141 to your computer and use it in GitHub Desktop.
Automatically move Skype and Outlook windows when connecting my MacBook to an external screen with 1200x1600 pixel resolution.
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
| require '/Applications/Zephyros.app/Contents/Resources/libs/zephyros.rb' | |
| def dell_screen | |
| API.all_screens.each do |screen| | |
| frame = screen.frame_without_dock_or_menu | |
| if frame.w == 1200 and frame.h == 1600 | |
| return screen | |
| end | |
| end | |
| return false | |
| end | |
| def move_app_window(app_title) | |
| API.running_apps.each do |app| | |
| if app.title == app_title | |
| return app.visible_windows.first | |
| end | |
| end | |
| return nil | |
| end | |
| API.listen 'screens_changed' do | |
| if screen = dell_screen | |
| skype = move_app_window('Skype') | |
| outlook = move_app_window('Microsoft Outlook') | |
| frame = screen.frame_without_dock_or_menu | |
| puts frame.h | |
| frame.h = 800 | |
| skype.frame = frame | |
| frame.y = 707 | |
| outlook.frame = frame | |
| end | |
| end | |
| wait_on_callbacks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment