├── ShiftIt ├── ShortcutRecorder.framework │ ├── Versions │ │ ├── Current │ │ └── A │ │ │ ├── ShortcutRecorder │ │ │ ├── Resources │ │ │ ├── ShortcutRecorder.ibplugin │ │ │ │ └── Contents │ │ │ │ │ ├── MacOS │ │ │ │ │ └── ShortcutRecorder │ │ │ │ │ ├── Resources │ │ │ │ │ ├── SRRecorderControl.classdescription │ │ │ │ │ └── English.lproj │ │ │ │ │ │ ├── InfoPlist.strings │ │ │ │ │ │ ├── SR_LeopardLibrary.nib │ │ │ │ │ │ └── SR_LeopardInspector.nib │ │ │ │ │ └── Info.plist │ │ │ └── Info.plist │ │ │ └── Headers │ │ │ ├── SR_LeopardView.h │ │ │ ├── SRKeyCodeTransformer.h │ │ │ ├── ShortcutRecorder.h │ │ │ ├── SRValidator.h │ │ │ ├── SRRecorderControl.h │ │ │ ├── SRRecorderCell.h │ │ │ └── SRCommon.h │ ├── Headers │ ├── Resources │ └── ShortcutRecorder ├── ShiftIt.icns ├── English.lproj │ ├── InfoPlist.strings │ ├── ShortcutRecorder.strings │ └── MainMenu.xib ├── ShiftIt-defaults.plist ├── ShiftIt-menuIcon.png ├── ShiftIt-menuIcon@2x.png ├── NSScreen+Coordinates.h ├── ShiftIt.xcodeproj │ ├── xcuserdata │ │ └── onsi.xcuserdatad │ │ │ ├── xcdebugger │ │ │ └── Breakpoints.xcbkptlist │ │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── ShiftIt.xcscheme │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── onsi.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── project.pbxproj ├── ShiftComputer.h ├── ShiftIt.m ├── NSScreen+Coordinates.m ├── ShiftableWindow.h ├── ShiftIt_Prefix.pch ├── main.m ├── ShiftIt-Info.plist ├── PreferencesWindowController.h ├── dsa_pub.pem ├── ShiftItAppDelegate.h ├── FMT │ ├── FMTHotKey+SRKeyCombo.h │ ├── FMTHotKeyManager.h │ ├── FMTHotKey+SRKeyCombo.m │ ├── FMTUtils.h │ ├── FMTHotKey.h │ ├── Readme.md │ ├── FMTLoginItems.h │ ├── FMTHotKey.m │ ├── FMTUtils.m │ ├── FMTLoginItems.m │ ├── FMTHotKeyManager.m │ └── FMTDefines.h ├── ShiftItAction.m ├── ShiftItAction.h ├── ShiftIt.h ├── PreferencesWindowController.m ├── ShiftableWindow.m ├── ShiftComputer.m ├── ShiftItAppDelegate.m └── PreferencesWindow.xib ├── ShiftIt.zip ├── artwork └── ShiftIt.png ├── .gitignore └── README.md /ShiftIt/ShortcutRecorder.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /ShiftIt.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt.zip -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShiftIt.icns -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/ShortcutRecorder: -------------------------------------------------------------------------------- 1 | Versions/Current/ShortcutRecorder -------------------------------------------------------------------------------- /artwork/ShiftIt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/artwork/ShiftIt.png -------------------------------------------------------------------------------- /ShiftIt/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt-defaults.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShiftIt-defaults.plist -------------------------------------------------------------------------------- /ShiftIt/ShiftIt-menuIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShiftIt-menuIcon.png -------------------------------------------------------------------------------- /ShiftIt/ShiftIt-menuIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShiftIt-menuIcon@2x.png -------------------------------------------------------------------------------- /ShiftIt/English.lproj/ShortcutRecorder.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/English.lproj/ShortcutRecorder.strings -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ShiftIt/build 2 | ShiftIt/ShiftIt.xcodeproj/*.pbxuser 3 | ShiftIt/ShiftIt.xcodeproj/*.perspectivev3 4 | ShiftIt/DerivedData 5 | *.mode1v3 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/ShortcutRecorder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShortcutRecorder.framework/Versions/A/ShortcutRecorder -------------------------------------------------------------------------------- /ShiftIt/NSScreen+Coordinates.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSScreen (Coordinates) 4 | 5 | - (CGRect)windowRectFromScreenRect:(CGRect)screenRect; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.xcodeproj/xcuserdata/onsi.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.xcodeproj/project.xcworkspace/xcuserdata/onsi.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShiftIt.xcodeproj/project.xcworkspace/xcuserdata/onsi.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/MacOS/ShortcutRecorder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/MacOS/ShortcutRecorder -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Resources/SRRecorderControl.classdescription: -------------------------------------------------------------------------------- 1 | { 2 | Actions = { 3 | }; 4 | Outlets = { 5 | delegate = id; 6 | }; 7 | ClassName = SRRecorderControl; 8 | SuperClass = NSControl; 9 | } 10 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Resources/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /ShiftIt/ShiftComputer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ShiftComputer : NSObject 4 | 5 | + (ShiftComputer *)shiftComputer; 6 | 7 | - (void)left; 8 | - (void)right; 9 | - (void)top; 10 | - (void)bottom; 11 | - (void)fullscreen; 12 | - (void)center; 13 | - (void)swapscreen; 14 | 15 | @end -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Resources/English.lproj/SR_LeopardLibrary.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Resources/English.lproj/SR_LeopardLibrary.nib -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Resources/English.lproj/SR_LeopardInspector.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/onsi/ShiftIt/HEAD/ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Resources/English.lproj/SR_LeopardInspector.nib -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.m: -------------------------------------------------------------------------------- 1 | BOOL AreClose(float a, float b) { 2 | return fabs(a - b) < 20; 3 | } 4 | 5 | BOOL RectsAreClose(CGRect a, CGRect b) { 6 | return AreClose(a.size.width, b.size.width) && 7 | AreClose(a.size.height, b.size.height) && 8 | AreClose(a.origin.x, b.origin.x) && 9 | AreClose(a.origin.y, b.origin.y); 10 | } 11 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Headers/SR_LeopardView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SR_LeopardView.h 3 | // SR Leopard 4 | // 5 | // Created by Jesper on 2007-10-19. 6 | // Copyright 2007 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SR_LeopardView : NSView { 12 | 13 | } 14 | 15 | @end -------------------------------------------------------------------------------- /ShiftIt/NSScreen+Coordinates.m: -------------------------------------------------------------------------------- 1 | #import "NSScreen+Coordinates.h" 2 | 3 | @implementation NSScreen (Coordinates) 4 | 5 | - (CGRect)windowRectFromScreenRect:(CGRect)screenRect { 6 | NSScreen *mainScreen = [[NSScreen screens] objectAtIndex:0]; 7 | return CGRectMake(screenRect.origin.x, mainScreen.frame.size.height - screenRect.origin.y - screenRect.size.height, screenRect.size.width, screenRect.size.height); 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Headers/SRKeyCodeTransformer.h: -------------------------------------------------------------------------------- 1 | // 2 | // SRKeyCodeTransformer.h 3 | // ShortcutRecorder 4 | // 5 | // Copyright 2006-2007 Contributors. All rights reserved. 6 | // 7 | // License: BSD 8 | // 9 | // Contributors: 10 | // David Dauer 11 | // Jesper 12 | // Jamie Kirkpatrick 13 | 14 | #import 15 | 16 | @interface SRKeyCodeTransformer : NSValueTransformer {} @end 17 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Headers/ShortcutRecorder.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShortcutRecorder.h 3 | // ShortcutRecorder 4 | // - 10.5 version only; master framework header 5 | // 6 | // Copyright 2007 Contributors. All rights reserved. 7 | // 8 | // License: BSD 9 | // 10 | // Contributors to this file: 11 | // Jesper 12 | 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | -------------------------------------------------------------------------------- /ShiftIt/ShiftableWindow.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | typedef enum { 4 | topLeft, 5 | topRight, 6 | bottomRight, 7 | bottomLeft, 8 | center 9 | } Origin; 10 | 11 | @interface ShiftableWindow : NSObject 12 | 13 | + (ShiftableWindow *)focusedWindow; 14 | 15 | - (CGRect)frame; 16 | - (NSScreen *)screen; 17 | 18 | - (BOOL)origin:(Origin)Origin isNearPoint:(CGPoint)point; 19 | 20 | - (void)setWindowSize:(CGSize)targetSize andSnapOrigin:(Origin)origin to:(CGPoint)point; 21 | - (void)setWindowSize:(CGSize)targetSize andSnapOrigin:(Origin)origin to:(CGPoint)point onScreen:(NSScreen *)screen; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.xcodeproj/xcuserdata/onsi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ShiftIt.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 27002DE61269CA1B0062B6D6 16 | 17 | primary 18 | 19 | 20 | 8D1107260486CEB800E47090 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ShortcutRecorder 9 | CFBundleIdentifier 10 | net.wafflesoftware.ShortcutRecorder.framework.Leopard 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Aravind 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | #ifdef __OBJC__ 21 | #import 22 | #endif 23 | -------------------------------------------------------------------------------- /ShiftIt/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Aravind 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | 21 | #import 22 | 23 | int main(int argc, char *argv[]) 24 | { 25 | return NSApplicationMain(argc, (const char **) argv); 26 | } 27 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ShortcutRecorder 9 | CFBundleIdentifier 10 | net.wafflesoftware.ShortcutRecorder.IB.Leopard 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ShortcutRecorder 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSPrincipalClass 24 | SR_Leopard 25 | 26 | 27 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Headers/SRValidator.h: -------------------------------------------------------------------------------- 1 | // 2 | // SRValidator.h 3 | // ShortcutRecorder 4 | // 5 | // Copyright 2006-2007 Contributors. All rights reserved. 6 | // 7 | // License: BSD 8 | // 9 | // Contributors: 10 | // David Dauer 11 | // Jesper 12 | // Jamie Kirkpatrick 13 | 14 | #import 15 | 16 | @interface SRValidator : NSObject { 17 | id delegate; 18 | } 19 | 20 | - (id) initWithDelegate:(id)theDelegate; 21 | 22 | - (BOOL) isKeyCode:(NSInteger)keyCode andFlagsTaken:(NSUInteger)flags error:(NSError **)error; 23 | - (BOOL) isKeyCode:(NSInteger)keyCode andFlags:(NSUInteger)flags takenInMenu:(NSMenu *)menu error:(NSError **)error; 24 | 25 | - (id) delegate; 26 | - (void) setDelegate: (id) theDelegate; 27 | 28 | @end 29 | 30 | #pragma mark - 31 | 32 | @interface NSObject( SRValidation ) 33 | - (BOOL) shortcutValidator:(SRValidator *)validator isKeyCode:(NSInteger)keyCode andFlagsTaken:(NSUInteger)flags reason:(NSString **)aReason; 34 | @end 35 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | ShiftIt.icns 11 | CFBundleIdentifier 12 | org.shiftitapp.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 2.3 23 | LSMinimumSystemVersion 24 | ${MACOSX_DEPLOYMENT_TARGET} 25 | LSUIElement 26 | 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /ShiftIt/PreferencesWindowController.h: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Aravind 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | 21 | #import 22 | #import 23 | 24 | @interface PreferencesWindowController : NSWindowController 25 | 26 | @property (nonatomic, assign) IBOutlet NSView *view; 27 | @property (nonatomic, assign) IBOutlet NSTextField *titleLabel; 28 | @property BOOL shouldStartAtLogin; 29 | 30 | - (void)showPreferences:(id)sender; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /ShiftIt/dsa_pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIDOzCCAi0GByqGSM44BAEwggIgAoIBAQDjToUI2Y53evDHD8Pqy9IKwgK7Gwju 3 | YbrJl58URCzTJOTPkR/JKeLd3bbZxHY4OwN6PfBhWw2jwhURMncZA1WMgHpuTEfa 4 | eOyat0Xedv3o+Lcdf3Yy8KrKSjI9aobpULfYi7xJVbabbR781BN/Dtl3Mt7d3RSI 5 | rs32tT61JZL0Nq2jLjvSrm4pR/nV72y5vow3D8FAZV7x7+Lop3TieF98uuHuHcWF 6 | 1ot5FPOmO4JICAmeEBqkrUxFXUydjwk1AMjVcDBNT93c1Gtt6Y0MI+XeCpR8h1vZ 7 | XkLgeoNKJy74TGpITqSBRokbfufwd0raLzJ6VkXKGUNBfwrFRkwNFj9rAhUA1Izw 8 | Tb26hipCFo9yffpIbUtvajcCggEAGMfx9NmXW43ifLnjRTBIT52P9cPpHaC6+lNX 9 | utDpcCzWsb3h/95CytQQvw/MVJbwKMLLknn2zclKaKGzyDk8/GeZLmHeB59hCgu5 10 | Yt0d7UN8BXyj4+rBJ3+qbfh109a9tY5Lr7elWSZrCtuRwToAcKBuq4g42oDL+1pc 11 | Z3xwTpvk2oj1m5PMyTNcbopFFZrDbS3IcqeJim6oJNINnUGpO9/izGEzqrFYbewF 12 | ST8iXsykfGgpyWRxIRdjiNTu82QGNZLpOBuAOFMAAKMCRrzqqs6iTnudA6YayDkQ 13 | 2cv8uIm6Y36zMzufZ69rFRm2f74+yDC3J7zJOd7BuHsVlTZPbQOCAQYAAoIBAQCb 14 | 1fZo3Fc9gJCL4Oh1tZPXmA9IeINPAYKePfDP9y/PbE6SGSkRMmJ97ZgJxBn3hSDa 15 | KiWCXT5bZ0MnlxMMI4aFm21uM0feeMlukTxt3rM6OeYerCNdkPWCgrF6rhr2CPnB 16 | RjOBkukCqPDEscAv1UPMb4TMss72aVo71HLzjlZPgMHgEfdGorF/4ez+BCQrqHc5 17 | hHW+srToisGAzrKtzASCegjWcXiuarHfrh2jL6BZqk3+KISVg15v8ROK6pOJAzTl 18 | FuVk1tY8owm32lYPjpGGyeB5XdV2szpjiP7B+JaLh51+RboFXIz/qYPJZG2PGCb4 19 | c5r1ieqppZmRioMQ5OqP 20 | -----END PUBLIC KEY----- 21 | -------------------------------------------------------------------------------- /ShiftIt/ShiftItAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Aravind 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | #import 21 | 22 | @class PreferencesWindowController; 23 | @class FMTHotKeyManager; 24 | 25 | @interface ShiftItAppDelegate : NSObject { 26 | @private 27 | PreferencesWindowController *preferencesController_; 28 | FMTHotKeyManager *hotKeyManager_; 29 | 30 | NSMutableDictionary *allHotKeys_; 31 | BOOL paused_; 32 | 33 | IBOutlet NSMenu *statusMenu_; 34 | NSStatusItem *statusItem_; 35 | NSImage *statusMenuItemIcon_; 36 | } 37 | 38 | - (IBAction)showPreferences:(id)sender; 39 | - (IBAction)shiftItMenuAction_:(id)sender; 40 | 41 | @end -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTHotKey+SRKeyCombo.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | 25 | #import 26 | 27 | #import "FMTHotKey.h" 28 | 29 | @interface FMTHotKey (SRKeyCombo) 30 | 31 | + (FMTHotKey *)hotKey:(KeyCombo)keyCombo; 32 | - (KeyCombo)asKeyCombo; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ShiftIt/ShiftItAction.m: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Filip Krikava 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | #import "ShiftItAction.h" 21 | 22 | @implementation ShiftItAction 23 | 24 | @synthesize identifier, label, uiTag; 25 | 26 | + (ShiftItAction *)actionWithID:(NSString *)identifier label:(NSString *)label uiTag:(NSInteger)uiTag { 27 | ShiftItAction *action = [[[self alloc] init] autorelease]; 28 | action.identifier = identifier; 29 | action.label = label; 30 | action.uiTag = uiTag; 31 | 32 | return action; 33 | } 34 | 35 | - (void)dealloc { 36 | self.identifier = nil; 37 | self.label = nil; 38 | [super dealloc]; 39 | } 40 | 41 | - (SEL)action { 42 | return NSSelectorFromString(self.identifier); 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ShiftIt/ShiftItAction.h: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Filip Krikava 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | #import 21 | 22 | /** 23 | * A reference to a function that position 24 | * and size the window's geometry denoted by the windowRect argument 25 | * relatively to a screen rect that originates at [0,0] (top left corner) 26 | * and has a size screenSize. The windowRect is the whole window 27 | * including any sort window decorators. 28 | */ 29 | 30 | @interface ShiftItAction : NSObject 31 | 32 | @property (nonatomic, retain) NSString *identifier; 33 | @property (nonatomic, retain) NSString *label; 34 | @property (nonatomic, assign) NSInteger uiTag; 35 | 36 | + (ShiftItAction *)actionWithID:(NSString *)identifier label:(NSString *)label uiTag:(NSInteger)uiTag; 37 | 38 | - (SEL)action; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTHotKeyManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | #import 25 | 26 | #import "FMTHotKey.h" 27 | 28 | @interface FMTHotKeyManager : NSObject { 29 | @private 30 | NSInteger hotKeyIdSequence_; 31 | } 32 | 33 | + (FMTHotKeyManager *)sharedHotKeyManager; 34 | 35 | - (void)unregisterHotKey:(FMTHotKey *)hotKey; 36 | - (void)registerHotKey:(FMTHotKey *)hotKey handler:(SEL)handler provider:(id)provider userData:(id)userData; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTHotKey+SRKeyCombo.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import "FMTHotKey+SRKeyCombo.h" 24 | #import "FMTDefines.h" 25 | 26 | @implementation FMTHotKey (SRKeyCombo) 27 | 28 | + (FMTHotKey *)hotKey:(KeyCombo)keyCombo { 29 | FMTHotKey *hotKey = [[FMTHotKey alloc] initWithKeyCode:keyCombo.code modifiers:keyCombo.flags]; 30 | 31 | return hotKey; 32 | } 33 | 34 | - (KeyCombo)asKeyCombo { 35 | KeyCombo keyCombo = SRMakeKeyCombo(keyCode_, modifiers_); 36 | 37 | return keyCombo; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | 25 | NSString *FMTGetBundleResourcePath(NSBundle *bundle, NSString *resourceName, NSString *resourceType); 26 | NSString *FMTGetMainBundleResourcePath(NSString *resourceName, NSString *resourceType); 27 | 28 | NSURL *FMTGetBundleResourceURL(NSBundle *bundle, NSString *resourceName, NSString *resourceType); 29 | NSURL *FMTGetMainBundleResourceURL(NSString *resourceName, NSString *resourceType); 30 | 31 | BOOL FMTOpenSystemPreferencePane(NSString *prefPaneId); 32 | 33 | BOOL FMTIsProcessWithBundleIdRunning(NSString *bundleId); 34 | 35 | NSInteger FMTNumberOfRunningProcessesWithBundleId(NSString *bundleId); 36 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTHotKey.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | #import 25 | 26 | @interface FMTHotKey : NSObject { 27 | @private 28 | 29 | /** 30 | * The virtual key code for the keyboard key associated with the receiving key event. 31 | * 32 | * @see NSEvent keyCode 33 | */ 34 | NSInteger keyCode_; 35 | 36 | /** 37 | * Using the Cocoa modifiers 38 | * 39 | * @see NSEvent for NS*KeyMask (i.e.: NSCommandKeyMask) 40 | */ 41 | NSUInteger modifiers_; 42 | } 43 | 44 | @property (readonly) NSInteger keyCode; 45 | @property (readonly) NSUInteger modifiers; 46 | 47 | - (id)initWithKeyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers; 48 | 49 | - (NSString *)description; 50 | - (BOOL)isEqualTo:(id)object; 51 | 52 | @end 53 | 54 | #pragma mark Key code and modifiers conversion methods 55 | 56 | NSString *FMTStringForCocoaModifiers(NSUInteger modifiers); 57 | -------------------------------------------------------------------------------- /ShiftIt/FMT/Readme.md: -------------------------------------------------------------------------------- 1 | FMT 2 | ======== 3 | 4 | *Fikovnik's Mac Toolkit* 5 | 6 | A collection of utility classes and functions that I share across project. Some documentation is in the header files, but most of the time the names of the methods and functions are pretty self-explanatory. Here's the list of current functionalities: 7 | 8 | * `FMTHotkeys*` - manager and hot key class that allows for simple management of global hotkeys, compatible with the [ShortcutRecorder][1] 9 | * `FMTLoginItems` - manage the list of system/session wide login items 10 | * `FMTDefines` - basic assert and log macros (inspired by the [google-mac-toolbox][2]) 11 | * `FMTUtils` - some additional utility functions that might be handy 12 | 13 | Acknowledgement 14 | --------------- 15 | 16 | Some of the code has been inspired by [google-mac-toolbox][3] and [Growl project][4]. 17 | 18 | License (MIT) 19 | ------------- 20 | 21 | > Copyright (c) 2010 Filip Křikava 22 | > 23 | > Permission is hereby granted, free of charge, to any 24 | > person obtaining a copy of this software and associated 25 | > documentation files (the "Software"), to deal in the 26 | > Software without restriction, including without limitation 27 | > the rights to use, copy, modify, merge, publish, 28 | > distribute, sublicense, and/or sell copies of the 29 | > Software, and to permit persons to whom the Software is 30 | > furnished to do so, subject to the following conditions: 31 | > 32 | > The above copyright notice and this permission notice 33 | > shall be included in all copies or substantial portions of 34 | > the Software. 35 | > 36 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 37 | > KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 38 | > WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 39 | > PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS 40 | > OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 41 | > OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 42 | > OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 43 | > SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 44 | 45 | [1]: http://code.google.com/p/shortcutrecorder/ 46 | [2]: http://code.google.com/p/google-toolbox-for-mac/ 47 | [3]: http://code.google.com/p/google-toolbox-for-mac/ 48 | [4]: http://growl.info/ 49 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Headers/SRRecorderControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // SRRecorderControl.h 3 | // ShortcutRecorder 4 | // 5 | // Copyright 2006-2007 Contributors. All rights reserved. 6 | // 7 | // License: BSD 8 | // 9 | // Contributors: 10 | // David Dauer 11 | // Jesper 12 | // Jamie Kirkpatrick 13 | 14 | #import 15 | #import "SRRecorderCell.h" 16 | 17 | @interface SRRecorderControl : NSControl 18 | { 19 | IBOutlet id delegate; 20 | } 21 | 22 | #pragma mark *** Aesthetics *** 23 | - (BOOL)animates; 24 | - (void)setAnimates:(BOOL)an; 25 | - (SRRecorderStyle)style; 26 | - (void)setStyle:(SRRecorderStyle)nStyle; 27 | 28 | #pragma mark *** Delegate *** 29 | - (id)delegate; 30 | - (void)setDelegate:(id)aDelegate; 31 | 32 | #pragma mark *** Key Combination Control *** 33 | 34 | - (NSUInteger)allowedFlags; 35 | - (void)setAllowedFlags:(NSUInteger)flags; 36 | 37 | - (BOOL)allowsKeyOnly; 38 | - (void)setAllowsKeyOnly:(BOOL)nAllowsKeyOnly escapeKeysRecord:(BOOL)nEscapeKeysRecord; 39 | - (BOOL)escapeKeysRecord; 40 | 41 | - (BOOL)canCaptureGlobalHotKeys; 42 | - (void)setCanCaptureGlobalHotKeys:(BOOL)inState; 43 | 44 | - (NSUInteger)requiredFlags; 45 | - (void)setRequiredFlags:(NSUInteger)flags; 46 | 47 | - (KeyCombo)keyCombo; 48 | - (void)setKeyCombo:(KeyCombo)aKeyCombo; 49 | 50 | - (NSString *)keyChars; 51 | - (NSString *)keyCharsIgnoringModifiers; 52 | 53 | #pragma mark *** Autosave Control *** 54 | 55 | - (NSString *)autosaveName; 56 | - (void)setAutosaveName:(NSString *)aName; 57 | 58 | #pragma mark - 59 | 60 | // Returns the displayed key combination if set 61 | - (NSString *)keyComboString; 62 | 63 | #pragma mark *** Conversion Methods *** 64 | 65 | - (NSUInteger)cocoaToCarbonFlags:(NSUInteger)cocoaFlags; 66 | - (NSUInteger)carbonToCocoaFlags:(NSUInteger)carbonFlags; 67 | 68 | #pragma mark *** Binding Methods *** 69 | 70 | - (NSDictionary *)objectValue; 71 | - (void)setObjectValue:(NSDictionary *)shortcut; 72 | 73 | @end 74 | 75 | // Delegate Methods 76 | @interface NSObject (SRRecorderDelegate) 77 | - (BOOL)shortcutRecorder:(SRRecorderControl *)aRecorder isKeyCode:(NSInteger)keyCode andFlagsTaken:(NSUInteger)flags reason:(NSString **)aReason; 78 | - (void)shortcutRecorder:(SRRecorderControl *)aRecorder keyComboDidChange:(KeyCombo)newKeyCombo; 79 | @end 80 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTLoginItems.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | 25 | /** 26 | * Manages the login items - both global ones (system wide) and session ones (current user). 27 | */ 28 | @interface FMTLoginItems : NSObject { 29 | @private 30 | 31 | /** The type of the login items. This is internaly being called by the two subclasses 32 | * possible values: 33 | * 34 | * kLSSharedFileListGlobalLoginItems - system wide 35 | * kLSSharedFileListSessionLoginItems - current user only 36 | */ 37 | CFStringRef type_; 38 | } 39 | 40 | @property(readonly) CFStringRef type; 41 | 42 | /** Returns true iff an executable (application, unix executable, script) denoted by the path is present in the login items */ 43 | - (BOOL) isInLoginItemsApplicationWithPath:(NSString *)path; 44 | 45 | /** Toggle the presence of an executable (application, unix executable, script) denoted by the path in the login items */ 46 | - (void) toggleApplicationInLoginItemsWithPath:(NSString *)path enabled:(BOOL)enabled; 47 | 48 | /** Ge the global (system wide) login items */ 49 | + (FMTLoginItems *) sharedGlobalLoginItems; 50 | 51 | /** Ge the session (current user) login items */ 52 | + (FMTLoginItems *) sharedSessionLoginItems; 53 | 54 | @end 55 | 56 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.h: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Filip Krikava 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | extern NSString *const kShiftItAppBundleId; 21 | 22 | // indexed using the ShiftItAction identifier 23 | extern NSDictionary *allShiftActions; 24 | 25 | extern NSString *const kShiftItUserDefaults; 26 | 27 | extern NSString *const kKeyCodePrefKeySuffix; 28 | extern NSString *const kModifiersPrefKeySuffix; 29 | 30 | // preferences keys 31 | extern NSString *const kHasStartedBeforePrefKey; 32 | extern NSString *const kShowMenuPrefKey; 33 | 34 | // distributed notifications 35 | extern NSString *const kShowPreferencesRequestNotification; 36 | 37 | // local notifications 38 | extern NSString *const kDidFinishEditingHotKeysPrefNotification; 39 | extern NSString *const kDidStartEditingHotKeysPrefNotification; 40 | extern NSString *const kHotKeyChangedNotification; 41 | 42 | // kHotKeyChangedNotification userInfo keys 43 | extern NSString *const kActionIdentifierKey; 44 | extern NSString *const kHotKeyKeyCodeKey; 45 | extern NSString *const kHotKeyModifiersKey; 46 | 47 | extern NSInteger const kSIMenuUITagPrefix; 48 | extern NSInteger const kSISRUITagPrefix; 49 | 50 | extern NSString *const kSIIconName; 51 | extern NSString *const kSIIconType; 52 | extern NSString *const kSIMenuItemTitle; 53 | 54 | BOOL AreClose(float a, float b); 55 | BOOL RectsAreClose(CGRect a, CGRect b); 56 | 57 | #define CGPointCenterOfCGRect(rect) CGPointMake((rect).origin.x + (rect).size.width / 2, (rect).origin.y + (rect).size.height / 2) 58 | #define KeyCodePrefKey(identifier) FMTStr(@"%@%@", (identifier), kKeyCodePrefKeySuffix) 59 | #define ModifiersPrefKey(identifier) FMTStr(@"%@%@", (identifier), kModifiersPrefKeySuffix) -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTHotKey.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import "FMTHotKey.h" 24 | #import "FMTDefines.h" 25 | 26 | @implementation FMTHotKey 27 | 28 | @synthesize keyCode = keyCode_; 29 | @synthesize modifiers = modifiers_; 30 | 31 | - (id)initWithKeyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers { 32 | 33 | if (![super init]) { 34 | return nil; 35 | } 36 | 37 | keyCode_ = keyCode; 38 | 39 | // TODO: assert that the code and modifiers make sense 40 | modifiers_ = modifiers; 41 | 42 | return self; 43 | } 44 | 45 | - (NSString *)description { 46 | return FMTStr(@"code: %d modifiers: %@ (%ld)", keyCode_, FMTStringForCocoaModifiers(modifiers_), modifiers_); 47 | } 48 | 49 | - (BOOL)isEqualTo:(id)object { 50 | 51 | if ([object isKindOfClass:[self class]] == NO) { 52 | return NO; 53 | } 54 | 55 | FMTHotKey *other = (FMTHotKey *) object; 56 | return (keyCode_ == [other keyCode] 57 | && modifiers_ == [other modifiers]); 58 | } 59 | 60 | // TODO: add hash 61 | 62 | @end 63 | 64 | #pragma mark Key code and modifiers conversion methods 65 | 66 | // this method is based on the SRStringForCocoaModifierFlags from SRCommon.m 67 | // in the ShortcutRecorder. The reason why it is duplicated here is to not to 68 | // have the dependency on ShortcutRecorder in FMTHotKey 69 | NSString *FMTStringForCocoaModifiers(NSUInteger modifiers) { 70 | NSString *modifiersString = [NSString stringWithFormat:@"%@%@%@%@", 71 | (modifiers & NSControlKeyMask ? [NSString stringWithFormat:@"%C", kControlUnicode] : @""), 72 | (modifiers & NSAlternateKeyMask ? [NSString stringWithFormat:@"%C", kOptionUnicode] : @""), 73 | (modifiers & NSShiftKeyMask ? [NSString stringWithFormat:@"%C", kShiftUnicode] : @""), 74 | (modifiers & NSCommandKeyMask ? [NSString stringWithFormat:@"%C", kCommandUnicode] : @"")]; 75 | 76 | return modifiersString; 77 | } -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.xcodeproj/xcuserdata/onsi.xcuserdatad/xcschemes/ShiftIt.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTUtils.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import "FMTUtils.h" 24 | #import "FMTDefines.h" 25 | 26 | NSString *const kSystemPreferencesAppBundeId = @"com.apple.systempreferences"; 27 | 28 | NSString *FMTGetBundleResourcePath(NSBundle *bundle, NSString *resourceName, NSString *resourceType) { 29 | FMTAssertNotNil(bundle); 30 | FMTAssertNotNil(resourceName); 31 | FMTAssertNotNil(resourceType); 32 | 33 | NSString *path = [bundle pathForResource:resourceName ofType:resourceType]; 34 | if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { 35 | return path; 36 | } else { 37 | return nil; 38 | } 39 | } 40 | 41 | NSString *FMTGetMainBundleResourcePath(NSString *resourceName, NSString *resourceType) { 42 | return FMTGetBundleResourcePath([NSBundle mainBundle], resourceName, resourceType); 43 | } 44 | 45 | NSURL *FMTGetBundleResourceURL(NSBundle *bundle, NSString *resourceName, NSString *resourceType) { 46 | NSString *path = FMTGetBundleResourcePath(bundle, resourceName, resourceType); 47 | 48 | if (path) { 49 | return [NSURL fileURLWithPath:path]; 50 | } else { 51 | return nil; 52 | } 53 | } 54 | 55 | NSURL *FMTGetMainBundleResourceURL(NSString *resourceName, NSString *resourceType) { 56 | return FMTGetBundleResourceURL([NSBundle mainBundle], resourceName, resourceType); 57 | } 58 | 59 | BOOL FMTOpenSystemPreferencePane(NSString *prefPaneId) { 60 | FMTAssertNotNil(prefPaneId); 61 | 62 | NSString *source = FMTStr(@"tell application \"System Preferences\"\n" 63 | "activate\n" 64 | "set current pane to pane \"%@\"\n" 65 | "end tell\n", prefPaneId); 66 | 67 | NSAppleScript *script = [[NSAppleScript alloc] initWithSource:source]; 68 | 69 | NSDictionary *dict = nil; 70 | NSAppleEventDescriptor *event = [script executeAndReturnError:&dict]; 71 | 72 | if (dict) { 73 | FMTDevLog(@"Compilation of AppleScript: %@ failed: %@", source, dict); 74 | } 75 | 76 | [script release]; 77 | 78 | return event != nil; 79 | } 80 | 81 | NSInteger FMTNumberOfRunningProcessesWithBundleId(NSString *bundleId) { 82 | FMTAssertNotNil(bundleId); 83 | 84 | NSInteger n = 0; 85 | ProcessSerialNumber PSN = { kNoProcess, kNoProcess }; 86 | 87 | while (GetNextProcess(&PSN) == noErr) { 88 | NSDictionary *infoDict = (NSDictionary *)ProcessInformationCopyDictionary(&PSN, kProcessDictionaryIncludeAllInformationMask); 89 | if(infoDict) { 90 | NSString *processBundleID = [infoDict objectForKey:(NSString *)kCFBundleIdentifierKey]; 91 | if (processBundleID && [processBundleID isEqualToString:bundleId]) { 92 | n++; 93 | } 94 | 95 | CFMakeCollectable(infoDict); 96 | [infoDict release]; 97 | } 98 | } 99 | 100 | return n; 101 | } 102 | 103 | BOOL FMTIsProcessWithBundleIdRunning(NSString *bundleId) { 104 | return FMTNumberOfRunningProcessesWithBundleId(bundleId) >= 1; 105 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ShiftIt 2 | 3 | ## Managing window size and position in OS X 4 | 5 | ShiftIt is an application for OSX that allows you to quickly manipulate window position and size using keyboard shortcuts. 6 | 7 | This is a fork of a fork of a... The original [ShiftIt](http://code.google.com/p/shiftit/) by [Aravindkumar Rajendiran](http://ca.linkedin.com/in/aravind88) is no longer under development. The subsequent fork by [Fikovnik](https://github.com/fikovnik/ShiftIt) has not been updated in a year. This fork adds some extra functionality (toggling through multiple sizes, shifting between screens, centering on the current screen), and does some extra work to make window sizing a teeny bit more robust. 8 | 9 | I don't intend this to become a canonical fork but am happy to maintain it and take pull requests. 10 | 11 | License: [GNU General Public License v3](http://www.gnu.org/licenses/gpl.html) (a la ShiftIt's original license) 12 | 13 | ## Using ShiftIt 14 | 15 | To install: download and unzip [ShiftIt.zip](https://raw.github.com/onsi/ShiftIt/master/ShiftIt.zip). 16 | 17 | ShiftIt allows you to tile windows using your keyboard: 18 | 19 | - Use ⌃⌥⌘ + arrow keys to shift the focused window to the associatd screen edge. Repeatedly shifting to an edge toggles through different sizes. 20 | - Use ⌃⌥⌘ + M to maximize the focused window. Hit it again to toggle the window back to its original size (useful for temporarily zooming a window in). 21 | - Use ⌃⌥⌘ + C to center the focused window. Hit it repeatedly to toggle through different sizes. 22 | - Use ⌃⌥⌘ + space to throw the focused window over to the next monitor. Hit it again to cycle through monitors. 23 | 24 | The exact behavior of the ⌃⌥⌘ + arrow key shifts depends on the aspect ratio of the current monitor. If the monitor is wide screen then shifts to the left and right always fill the screen vertically and toggle through 1/2, 1/3 and then 2/3 the width of the screen. Shifts up and down maintain the current window width while toggling through four heights: full, 2/3, 1/2, and 1/3 height. For portrait monitors this behavior is reversed. 25 | 26 | So, to throw a window to the top-left corner: ⌃⌥⌘ + ←, ⌃⌥⌘ + ↑, ⌃⌥⌘ + ↑. So many keystrokes you say? Yes... but I could never remember my keybindings for the corners (so I removed them!). Besides, something about smashing arrow keys makes me feel like I'm playing a video game. This is a fine thing. 27 | 28 | **Note** this fork of ShiftIt has removed support for repositioning X11 windows. If you desperately need this to come back post an issue or (better yet) a pull request. 29 | 30 | **Also Note** some applications enforce specific size restrictions. As far as I can tell there is no way to measure these restrictions *before* resizing windows. In particular: Xcode doesn't like to get too small, so ShiftIt can't toggle Xcode through thirds on small monitors. Also, Terminal quantizes its sizes to integer rows and columns, so ShiftIt's manipulations of terminal are approximate and there is sometimes a little overlap/gap around the edges. 31 | 32 | ## Release Notes 33 | 34 | - v2.3 (3/25/2013) 35 | - Route to correct preference pane to enable Accessibility on Mavericks 36 | - Throwing a window between monitors maintains the aspect ratio of the window (previously the window was always recentered) 37 | 38 | - v2.2 (6/14/2013) 39 | - Fixed bug in multi-monitor support where two monitors are mirrored and one monitor is not. 40 | - Tool bar icon is now retina-friendly 41 | 42 | - v2.1 (8/16/2012) 43 | - Fixed embarrasing multi-monitor bug 44 | 45 | - v2.0 (8/6/2012) 46 | - Better thirds support 47 | - More robust window sizing 48 | - General code clean up 49 | - Rewrite of window tiling code 50 | 51 | ## 3rd Party Frameworks 52 | 53 | * [ShortcutRecorder](http://code.google.com/p/shortcutrecorder/) framework (*New BSD license*) for capturing key bindings during hotkey reconfiguration. 54 | * [FMT](https://github.com/fikovnik/FMT) framework (*MIT license*) for some utility functions like handling login items, hot keys, etc. 55 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Headers/SRRecorderCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SRRecorderCell.h 3 | // ShortcutRecorder 4 | // 5 | // Copyright 2006-2007 Contributors. All rights reserved. 6 | // 7 | // License: BSD 8 | // 9 | // Contributors: 10 | // David Dauer 11 | // Jesper 12 | // Jamie Kirkpatrick 13 | 14 | #import 15 | #import "SRCommon.h" 16 | 17 | #define SRMinWidth 50 18 | #define SRMaxHeight 22 19 | 20 | #define SRTransitionFPS 30.0f 21 | #define SRTransitionDuration 0.35f 22 | //#define SRTransitionDuration 2.35 23 | #define SRTransitionFrames (SRTransitionFPS*SRTransitionDuration) 24 | #define SRAnimationAxisIsY YES 25 | #define ShortcutRecorderNewStyleDrawing 26 | 27 | #define SRAnimationOffsetRect(X,Y) (SRAnimationAxisIsY ? NSOffsetRect(X,0.0f,-NSHeight(Y)) : NSOffsetRect(X,NSWidth(Y),0.0f)) 28 | 29 | @class SRRecorderControl, SRValidator; 30 | 31 | enum SRRecorderStyle { 32 | SRGradientBorderStyle = 0, 33 | SRGreyStyle = 1 34 | }; 35 | typedef enum SRRecorderStyle SRRecorderStyle; 36 | 37 | @interface SRRecorderCell : NSActionCell 38 | { 39 | NSGradient *recordingGradient; 40 | NSString *autosaveName; 41 | 42 | BOOL isRecording; 43 | BOOL mouseInsideTrackingArea; 44 | BOOL mouseDown; 45 | 46 | SRRecorderStyle style; 47 | 48 | BOOL isAnimating; 49 | CGFloat transitionProgress; 50 | BOOL isAnimatingNow; 51 | BOOL isAnimatingTowardsRecording; 52 | BOOL comboJustChanged; 53 | 54 | NSTrackingRectTag removeTrackingRectTag; 55 | NSTrackingRectTag snapbackTrackingRectTag; 56 | 57 | KeyCombo keyCombo; 58 | BOOL hasKeyChars; 59 | NSString *keyChars; 60 | NSString *keyCharsIgnoringModifiers; 61 | 62 | NSUInteger allowedFlags; 63 | NSUInteger requiredFlags; 64 | NSUInteger recordingFlags; 65 | 66 | BOOL allowsKeyOnly; 67 | BOOL escapeKeysRecord; 68 | 69 | NSSet *cancelCharacterSet; 70 | 71 | SRValidator *validator; 72 | 73 | IBOutlet id delegate; 74 | BOOL globalHotKeys; 75 | void *hotKeyModeToken; 76 | } 77 | 78 | - (void)resetTrackingRects; 79 | 80 | #pragma mark *** Aesthetics *** 81 | 82 | + (BOOL)styleSupportsAnimation:(SRRecorderStyle)style; 83 | 84 | - (BOOL)animates; 85 | - (void)setAnimates:(BOOL)an; 86 | - (SRRecorderStyle)style; 87 | - (void)setStyle:(SRRecorderStyle)nStyle; 88 | 89 | #pragma mark *** Delegate *** 90 | 91 | - (id)delegate; 92 | - (void)setDelegate:(id)aDelegate; 93 | 94 | #pragma mark *** Responder Control *** 95 | 96 | - (BOOL)becomeFirstResponder; 97 | - (BOOL)resignFirstResponder; 98 | 99 | #pragma mark *** Key Combination Control *** 100 | 101 | - (BOOL)performKeyEquivalent:(NSEvent *)theEvent; 102 | - (void)flagsChanged:(NSEvent *)theEvent; 103 | 104 | - (NSUInteger)allowedFlags; 105 | - (void)setAllowedFlags:(NSUInteger)flags; 106 | 107 | - (NSUInteger)requiredFlags; 108 | - (void)setRequiredFlags:(NSUInteger)flags; 109 | 110 | - (BOOL)allowsKeyOnly; 111 | - (void)setAllowsKeyOnly:(BOOL)nAllowsKeyOnly escapeKeysRecord:(BOOL)nEscapeKeysRecord; 112 | - (BOOL)escapeKeysRecord; 113 | 114 | - (BOOL)canCaptureGlobalHotKeys; 115 | - (void)setCanCaptureGlobalHotKeys:(BOOL)inState; 116 | 117 | - (KeyCombo)keyCombo; 118 | - (void)setKeyCombo:(KeyCombo)aKeyCombo; 119 | 120 | #pragma mark *** Autosave Control *** 121 | 122 | - (NSString *)autosaveName; 123 | - (void)setAutosaveName:(NSString *)aName; 124 | 125 | // Returns the displayed key combination if set 126 | - (NSString *)keyComboString; 127 | 128 | - (NSString *)keyChars; 129 | - (NSString *)keyCharsIgnoringModifiers; 130 | 131 | @end 132 | 133 | // Delegate Methods 134 | @interface NSObject (SRRecorderCellDelegate) 135 | - (BOOL)shortcutRecorderCell:(SRRecorderCell *)aRecorderCell isKeyCode:(NSInteger)keyCode andFlagsTaken:(NSUInteger)flags reason:(NSString **)aReason; 136 | - (void)shortcutRecorderCell:(SRRecorderCell *)aRecorderCell keyComboDidChange:(KeyCombo)newCombo; 137 | @end 138 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTLoginItems.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import "FMTLoginItems.h" 24 | 25 | #import "FMTDefines.h" 26 | 27 | @interface FMTLoginItems (Private) 28 | 29 | - (id)initWithLoginItemsType_:(CFStringRef)type; 30 | - (LSSharedFileListItemRef) getApplicationLoginItemWithPath_:(NSString *)path; 31 | 32 | @end 33 | 34 | // following is just to simplify the code 35 | // not sure whether the is a better way to do that 36 | // this will reuse the SINGLETON_BOILERPLATE* macros 37 | // so less typing while maintaining all the properties of these singletons 38 | 39 | @interface FMTGlobalLoginItems_ : FMTLoginItems 40 | 41 | + (FMTGlobalLoginItems_ *) sharedGlobalLoginItems_; 42 | 43 | @end 44 | 45 | @interface FMTSessionLoginItems_ : FMTLoginItems 46 | 47 | + (FMTSessionLoginItems_ *) sharedSessionLoginItems_; 48 | 49 | @end 50 | 51 | 52 | @implementation FMTLoginItems 53 | 54 | @synthesize type = type_; 55 | 56 | 57 | - (id)initWithLoginItemsType_:(CFStringRef)type { 58 | FMTAssertNotNil(type) 59 | 60 | if (![super init]) { 61 | return nil; 62 | } 63 | 64 | type_ = type; 65 | 66 | return self; 67 | } 68 | 69 | - (void)dealloc { 70 | [super dealloc]; 71 | } 72 | 73 | - (BOOL) isInLoginItemsApplicationWithPath:(NSString *)path { 74 | FMTAssertNotNil(path); 75 | 76 | return [self getApplicationLoginItemWithPath_:path] != nil; 77 | } 78 | 79 | // following code has been inspired from Growl sources 80 | // http://growl.info/source.php 81 | - (void) toggleApplicationInLoginItemsWithPath:(NSString *)path enabled:(BOOL)enabled { 82 | FMTAssertNotNil(path); 83 | 84 | OSStatus status; 85 | LSSharedFileListItemRef existingItem = [self getApplicationLoginItemWithPath_:path]; 86 | CFURLRef URLToApp = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)path, kCFURLPOSIXPathStyle, true); 87 | LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL,type_, NULL); 88 | 89 | if (enabled && (existingItem == NULL)) { 90 | NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:path]; 91 | IconRef icon = NULL; 92 | FSRef ref; 93 | Boolean gotRef = CFURLGetFSRef(URLToApp, &ref); 94 | if (gotRef) { 95 | status = GetIconRefFromFileInfo(&ref, 96 | /*fileNameLength*/ 0, /*fileName*/ NULL, 97 | kFSCatInfoNone, /*catalogInfo*/ NULL, 98 | kIconServicesNormalUsageFlag, 99 | &icon, 100 | /*outLabel*/ NULL); 101 | if (status != noErr) 102 | icon = NULL; 103 | } 104 | 105 | LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, (CFStringRef)displayName, icon, URLToApp, /*propertiesToSet*/ NULL, /*propertiesToClear*/ NULL); 106 | } else if (!enabled && (existingItem != NULL)) { 107 | LSSharedFileListItemRemove(loginItems, existingItem); 108 | } 109 | } 110 | 111 | #pragma mark Private methods 112 | 113 | - (LSSharedFileListItemRef) getApplicationLoginItemWithPath_:(NSString *)path { 114 | FMTAssertNotNil(path); 115 | 116 | CFURLRef URLToApp = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)path, kCFURLPOSIXPathStyle, true); 117 | 118 | LSSharedFileListItemRef existingItem = NULL; 119 | UInt32 seed = 0U; 120 | LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL,type_, NULL); 121 | NSArray *currentLoginItems = [NSMakeCollectable(LSSharedFileListCopySnapshot(loginItems, &seed)) autorelease]; 122 | 123 | for (id itemObject in currentLoginItems) { 124 | LSSharedFileListItemRef item = (LSSharedFileListItemRef)itemObject; 125 | 126 | UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes; 127 | CFURLRef URL = NULL; 128 | OSStatus err = LSSharedFileListItemResolve(item, resolutionFlags, &URL, /*outRef*/ NULL); 129 | if (err == noErr) { 130 | Boolean foundIt = CFEqual(URL, URLToApp); 131 | CFRelease(URL); 132 | 133 | if (foundIt) 134 | existingItem = item; 135 | break; 136 | } 137 | } 138 | 139 | CFRelease(URLToApp); 140 | 141 | return existingItem; 142 | } 143 | 144 | + (FMTLoginItems *) sharedGlobalLoginItems { 145 | return [FMTGlobalLoginItems_ sharedGlobalLoginItems_]; 146 | } 147 | 148 | + (FMTLoginItems *) sharedSessionLoginItems { 149 | return [FMTSessionLoginItems_ sharedSessionLoginItems_]; 150 | } 151 | @end 152 | 153 | @implementation FMTGlobalLoginItems_ 154 | 155 | SINGLETON_BOILERPLATE_FULL(FMTGlobalLoginItems_, sharedGlobalLoginItems_, initWithLoginItemsType_:kLSSharedFileListGlobalLoginItems); 156 | 157 | @end 158 | 159 | @implementation FMTSessionLoginItems_ 160 | 161 | SINGLETON_BOILERPLATE_FULL(FMTSessionLoginItems_, sharedSessionLoginItems_, initWithLoginItemsType_:kLSSharedFileListSessionLoginItems); 162 | 163 | @end -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTHotKeyManager.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #import 24 | 25 | #import "FMTHotKeyManager.h" 26 | #import "FMTDefines.h" 27 | 28 | @interface FMTHotKey (Private) 29 | 30 | - (NSInteger)carbonModifiers; 31 | 32 | @end 33 | 34 | @implementation FMTHotKey (Private) 35 | 36 | - (NSInteger) carbonModifiers { 37 | return SRCocoaToCarbonFlags([self modifiers]); 38 | } 39 | 40 | @end 41 | 42 | @interface TWHotKeyRegistartion : NSObject 43 | { 44 | FMTHotKey *hotKey_; 45 | SEL handler_; 46 | id provider_; 47 | id userData_; 48 | EventHotKeyRef ref_; 49 | } 50 | 51 | @property (readonly) FMTHotKey *hotKey; 52 | @property (readonly) SEL handler; 53 | @property (readonly) id provider; 54 | @property (readonly) id userData; 55 | @property (readonly) EventHotKeyRef ref; 56 | 57 | - (id)initWithHotKey:(FMTHotKey *)hotKey handler:(SEL)handler provider:(id)provider userData:(id)userData ref:(EventHotKeyRef)ref; 58 | 59 | @end 60 | 61 | @implementation TWHotKeyRegistartion 62 | 63 | @synthesize hotKey = hotKey_; 64 | @synthesize handler = handler_; 65 | @synthesize provider = provider_; 66 | @synthesize userData = userData_; 67 | @synthesize ref = ref_; 68 | 69 | - (id)initWithHotKey:(FMTHotKey *)hotKey handler:(SEL)handler provider:(id)provider userData:(id)userData ref:(EventHotKeyRef)ref { 70 | if (![super init]) { 71 | return nil; 72 | } 73 | 74 | FMTAssertNotNil(hotKey); 75 | FMTAssertNotNil(handler); 76 | FMTAssertNotNil(provider); 77 | FMTAssertNotNil(ref); 78 | 79 | hotKey_ = [hotKey retain]; 80 | handler_ = handler; 81 | provider_ = [provider retain]; 82 | userData_ = [userData retain]; 83 | ref_ = ref; 84 | 85 | return self; 86 | } 87 | 88 | - (void) dealloc { 89 | [hotKey_ release]; 90 | [provider_ release]; 91 | [userData_ release]; 92 | 93 | [super dealloc]; 94 | } 95 | 96 | @end 97 | 98 | static NSMutableDictionary *allHotKeys; 99 | 100 | OSStatus hotKeyHandler(EventHandlerCallRef inHandlerCallRef,EventRef inEvent, 101 | void *userData) 102 | { 103 | EventHotKeyID hotKeyID; 104 | GetEventParameter(inEvent,kEventParamDirectObject,typeEventHotKeyID,NULL, 105 | sizeof(hotKeyID),NULL,&hotKeyID); 106 | 107 | NSNumber *id = [NSNumber numberWithInt:hotKeyID.id]; 108 | 109 | TWHotKeyRegistartion* hotKeyReg = [allHotKeys objectForKey:id]; 110 | 111 | if (hotKeyReg != nil) { 112 | objc_msgSend([hotKeyReg provider], [hotKeyReg handler], [hotKeyReg userData]); 113 | return noErr; 114 | } else { 115 | return eventNotHandledErr; 116 | } 117 | } 118 | 119 | @implementation FMTHotKeyManager 120 | 121 | SINGLETON_BOILERPLATE(FMTHotKeyManager, sharedHotKeyManager); 122 | 123 | - (id) init { 124 | if (![super init]) { 125 | return nil; 126 | } 127 | 128 | allHotKeys = [[NSMutableDictionary alloc] init]; 129 | hotKeyIdSequence_ = 1; 130 | 131 | EventTypeSpec eventType; 132 | eventType.eventClass=kEventClassKeyboard; 133 | eventType.eventKind=kEventHotKeyPressed; 134 | 135 | InstallApplicationEventHandler(&hotKeyHandler, 1, &eventType, NULL, NULL); 136 | 137 | return self; 138 | } 139 | 140 | - (void)dealloc { 141 | [allHotKeys release]; 142 | 143 | [super dealloc]; 144 | } 145 | 146 | // TODO: modify to propagate error 147 | - (void)unregisterHotKey:(FMTHotKey *)hotKey { 148 | FMTAssertNotNil(hotKey); 149 | 150 | FMTDevLog(@"Unregistering hotKey %@", hotKey); 151 | 152 | // search for the registration 153 | TWHotKeyRegistartion *hotKeyReg; 154 | for (TWHotKeyRegistartion *e in [allHotKeys allValues]) { 155 | if ([hotKey isEqualTo:[e hotKey]]) { 156 | hotKeyReg = e; 157 | break; 158 | } 159 | } 160 | 161 | if (hotKeyReg) { 162 | UnregisterEventHotKey([hotKeyReg ref]); 163 | } else { 164 | // no registration found 165 | FMTDevLog(@"Unable to unregister hotKey: %@ - it has not been registered by this HotKeyManager", hotKey); 166 | } 167 | 168 | } 169 | 170 | - (void)registerHotKey:(FMTHotKey *)hotKey handler:(SEL)handler provider:(id)provider userData:(id)userData { 171 | 172 | FMTAssertNotNil(hotKey); 173 | FMTAssertNotNil(handler); 174 | FMTAssertNotNil(provider); 175 | 176 | FMTDevLog(@"Registering hotKey %@", hotKey); 177 | 178 | EventHotKeyID hotKeyID; 179 | // TODO: extract 180 | hotKeyID.signature = 'TFMT'; 181 | // TODO: make sure it is thread safe 182 | hotKeyID.id = hotKeyIdSequence_++; 183 | 184 | EventHotKeyRef hotKeyRef; 185 | RegisterEventHotKey([hotKey keyCode], [hotKey carbonModifiers], hotKeyID, 186 | GetApplicationEventTarget(), 0, &hotKeyRef); 187 | 188 | if (!hotKeyRef) { 189 | NSLog(@"Unable to register hotKey: %@", hotKey); 190 | return; 191 | } 192 | 193 | // safe 194 | TWHotKeyRegistartion *hotKeyReg = [[TWHotKeyRegistartion alloc] initWithHotKey:hotKey 195 | handler:handler 196 | provider:provider 197 | userData:userData 198 | ref:hotKeyRef]; 199 | 200 | [allHotKeys setObject:hotKeyReg forKey:[NSNumber numberWithInt:hotKeyID.id]]; 201 | } 202 | 203 | @end 204 | -------------------------------------------------------------------------------- /ShiftIt/PreferencesWindowController.m: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Aravind 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | #import "PreferencesWindowController.h" 21 | #import "ShiftIt.h" 22 | #import "ShiftItAction.h" 23 | #import "FMTLoginItems.h" 24 | #import "FMTDefines.h" 25 | #import "FMTUtils.h" 26 | 27 | NSString *const kKeyCodePrefKeySuffix = @"KeyCode"; 28 | NSString *const kModifiersPrefKeySuffix = @"Modifiers"; 29 | 30 | NSString *const kDidFinishEditingHotKeysPrefNotification = @"kEnableActionsRequestNotification"; 31 | NSString *const kDidStartEditingHotKeysPrefNotification = @"kDisableActionsRequestNotification"; 32 | NSString *const kHotKeyChangedNotification = @"kHotKeyChangedNotification"; 33 | NSString *const kActionIdentifierKey = @"kActionIdentifierKey"; 34 | NSString *const kHotKeyKeyCodeKey = @"kHotKeyKeyCodeKey"; 35 | NSString *const kHotKeyModifiersKey = @"kHotKeyModifiersKey"; 36 | 37 | NSInteger const kSISRUITagPrefix = 1000; 38 | NSInteger const kSRContainerTagPrefix = 100; 39 | 40 | @interface PreferencesWindowController(Private) 41 | 42 | - (void)buildShortcutRecorders; 43 | - (void)windowDidResignMain:(NSNotification *)notification; 44 | - (void)windowDidBecomeMain:(NSNotification *)notification; 45 | 46 | @end 47 | 48 | @implementation PreferencesWindowController 49 | 50 | @dynamic shouldStartAtLogin; 51 | @synthesize view, titleLabel; 52 | 53 | -(id)init{ 54 | self = [super initWithWindowNibName:@"PreferencesWindow"]; 55 | return self; 56 | } 57 | 58 | -(BOOL)acceptsFirstResponder{ 59 | return YES; 60 | } 61 | 62 | -(void)awakeFromNib { 63 | NSString *versionString = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; 64 | [self.titleLabel setStringValue:[NSString stringWithFormat:@"ShiftIt %@", versionString]]; 65 | 66 | [[NSNotificationCenter defaultCenter] addObserver:self 67 | selector:@selector(windowDidResignMain:) 68 | name:NSWindowDidResignMainNotification 69 | object:self.window]; 70 | 71 | [[NSNotificationCenter defaultCenter] addObserver:self 72 | selector:@selector(windowDidBecomeMain:) 73 | name:NSWindowDidBecomeMainNotification 74 | object:self.window]; 75 | 76 | [self buildShortcutRecorders]; 77 | } 78 | 79 | -(IBAction)showPreferences:(id)sender{ 80 | [[self window] center]; 81 | [NSApp activateIgnoringOtherApps:YES]; 82 | [[self window] makeKeyAndOrderFront:sender]; 83 | } 84 | 85 | - (void)shortcutRecorder:(SRRecorderControl *)recorder keyComboDidChange:(KeyCombo)newKeyCombo{ 86 | NSInteger tag = [recorder tag] - kSISRUITagPrefix; 87 | 88 | ShiftItAction *action = nil; 89 | for (action in [allShiftActions allValues]) { 90 | if ([action uiTag] == tag) { 91 | break; 92 | } 93 | } 94 | 95 | NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:3]; 96 | [userInfo setObject:[action identifier] forKey:kActionIdentifierKey]; 97 | [userInfo setObject:[NSNumber numberWithInt:newKeyCombo.code] forKey:kHotKeyKeyCodeKey]; 98 | [userInfo setObject:[NSNumber numberWithLong:newKeyCombo.flags] forKey:kHotKeyModifiersKey]; 99 | 100 | [[NSNotificationCenter defaultCenter] postNotificationName:kHotKeyChangedNotification 101 | object:self 102 | userInfo:userInfo]; 103 | } 104 | 105 | 106 | #pragma mark shouldStartAtLogin dynamic property methods 107 | 108 | - (BOOL)shouldStartAtLogin { 109 | NSString *path = [[NSBundle mainBundle] bundlePath]; 110 | return [[FMTLoginItems sharedSessionLoginItems] isInLoginItemsApplicationWithPath:path]; 111 | } 112 | 113 | - (void)setShouldStartAtLogin:(BOOL)flag { 114 | NSString *path = [[NSBundle mainBundle] bundlePath]; 115 | [[FMTLoginItems sharedSessionLoginItems] toggleApplicationInLoginItemsWithPath:path enabled:flag]; 116 | } 117 | 118 | #pragma mark Shortcut Recorder methods 119 | 120 | - (void)buildShortcutRecorders { 121 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 122 | for (ShiftItAction *action in [allShiftActions allValues]) { 123 | NSControl *container = [self.view viewWithTag:kSRContainerTagPrefix + action.uiTag]; 124 | SRRecorderControl *shortcutRecorder = [[[SRRecorderControl alloc] initWithFrame:container.frame] autorelease]; 125 | 126 | shortcutRecorder.style = 1; 127 | shortcutRecorder.allowedFlags = 10354688; 128 | shortcutRecorder.tag = kSISRUITagPrefix + action.uiTag; 129 | shortcutRecorder.delegate = self; 130 | [shortcutRecorder setAllowsKeyOnly:YES escapeKeysRecord:NO]; 131 | 132 | KeyCombo combo; 133 | combo.code = [defaults integerForKey:KeyCodePrefKey(action.identifier)]; 134 | combo.flags = [defaults integerForKey:ModifiersPrefKey(action.identifier)]; 135 | [shortcutRecorder setKeyCombo:combo]; 136 | 137 | [container.superview addSubview:shortcutRecorder]; 138 | [container removeFromSuperview]; 139 | } 140 | } 141 | 142 | #pragma mark Notification handling methods 143 | - (void)windowDidResignMain:(NSNotification *)notification { 144 | [[NSNotificationCenter defaultCenter] postNotificationName:kDidFinishEditingHotKeysPrefNotification object:nil]; 145 | } 146 | 147 | - (void)windowDidBecomeMain:(NSNotification *)notification { 148 | [[NSNotificationCenter defaultCenter] postNotificationName:kDidStartEditingHotKeysPrefNotification object:nil]; 149 | } 150 | 151 | @end 152 | -------------------------------------------------------------------------------- /ShiftIt/FMT/FMTDefines.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Filip Krikava 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this sofFMTare and associated documentation files (the "SofFMTare"), to deal 6 | in the SofFMTare without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the SofFMTare, and to permit persons to whom the SofFMTare is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the SofFMTare. 13 | 14 | THE SOFFMTARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFFMTARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFFMTARE. 21 | */ 22 | 23 | // following assertions were taken from: GMTDefines.h from the google-mac-toolbox: 24 | // http://code.google.com/p/google-toolbox-for-mac/ 25 | 26 | #ifndef FMTDevLog 27 | 28 | #ifndef NDEBUG 29 | #define FMTDevLog(...) NSLog(__VA_ARGS__) 30 | #else 31 | #define FMTDevLog(...) do { } while (0) 32 | #endif // NDEBUG 33 | 34 | #endif // FMTDevLog 35 | 36 | // TODO: rename to NSStr 37 | #ifndef FMTStr 38 | #define FMTStr(fmt,...) [NSString stringWithFormat:fmt,##__VA_ARGS__] 39 | #endif // FMTStr 40 | 41 | #define FMTStrc(cstr) [NSString stringWithCString:(cstr) encoding:NSUTF8StringEncoding] 42 | 43 | #ifndef FMTTraceLog 44 | 45 | #ifndef NTRACE 46 | #define FMTTraceLog(...) NSLog(@"%@: %@",FMTStr(@"[\%s:\%s:\%d]",__PRETTY_FUNCTION__,__FILE__,__LINE__),FMTStr(__VA_ARGS__)) 47 | #define FMTTrace() NSLog(@"[\%s:\%s:\%d]",__PRETTY_FUNCTION__,__FILE__,__LINE__) 48 | #endif // NTRACE 49 | 50 | #endif // FMTTraceLog 51 | 52 | #ifndef FMTAssert 53 | 54 | #if !defined(NS_BLOCK_ASSERTIONS) 55 | 56 | #define FMTAssert(condition, ...) \ 57 | do { \ 58 | if (!(condition)) { \ 59 | [[NSAssertionHandler currentHandler] \ 60 | handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \ 61 | file:[NSString stringWithUTF8String:__FILE__] \ 62 | lineNumber:__LINE__ \ 63 | description:__VA_ARGS__]; \ 64 | } \ 65 | } while(0) 66 | 67 | #define FMTAssertNotNil(var) FMTAssert(var != nil, FMTStr(@"Variabe %@ must not be nil", @#var)); 68 | 69 | #else // !defined(NS_BLOCK_ASSERTIONS) 70 | #define FMTAssert(condition, ...) do { } while (0) 71 | #endif // !defined(NS_BLOCK_ASSERTIONS) 72 | 73 | #endif // FMTAssert 74 | 75 | #ifndef FMTFail 76 | 77 | #define FMTFail(...) FMTAssert(NO,##__VA_ARGS__) 78 | 79 | #endif // FMTFail 80 | 81 | 82 | /// This macro implements the various methods needed to make a safe singleton. 83 | /// 84 | /// This Singleton pattern was taken from: 85 | /// http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_10.html 86 | /// 87 | /// Sample usage: 88 | /// 89 | /// SINGLETON_BOILERPLATE(SomeUsefulManager, sharedSomeUsefulManager) 90 | /// (with no trailing semicolon) 91 | /// 92 | /// This code here is based on Foundation/GTMObjectSingleton.h from google-toolbox-for-mac 93 | /// 94 | 95 | #ifndef SINGLETON_BOILERPLATE 96 | 97 | #define SINGLETON_BOILERPLATE(_object_name_, _shared_obj_name_) SINGLETON_BOILERPLATE_FULL(_object_name_, _shared_obj_name_, init) 98 | 99 | #endif // SINGLETON_BOILERPLATE 100 | 101 | #ifndef SINGLETON_BOILERPLATE_FULL 102 | 103 | #define SINGLETON_BOILERPLATE_FULL(_object_name_, _shared_obj_name_, _init_) \ 104 | static _object_name_ *z##_shared_obj_name_ = nil; \ 105 | + (_object_name_ *)_shared_obj_name_ { \ 106 | @synchronized(self) { \ 107 | if (z##_shared_obj_name_ == nil) { \ 108 | /* Note that 'self' may not be the same as _object_name_ */ \ 109 | /* first assignment done in allocWithZone but we must reassign in case init fails */ \ 110 | z##_shared_obj_name_ = [[self alloc] _init_]; \ 111 | FMTAssert((z##_shared_obj_name_ != nil), @"didn't catch singleton allocation"); \ 112 | } \ 113 | } \ 114 | return z##_shared_obj_name_; \ 115 | } \ 116 | + (id)allocWithZone:(NSZone *)zone { \ 117 | @synchronized(self) { \ 118 | if (z##_shared_obj_name_ == nil) { \ 119 | z##_shared_obj_name_ = [super allocWithZone:zone]; \ 120 | return z##_shared_obj_name_; \ 121 | } \ 122 | } \ 123 | \ 124 | /* We can't return the shared instance, because it's been init'd */ \ 125 | FMTAssert(NO, @"use the singleton API, not alloc+init"); \ 126 | return nil; \ 127 | } \ 128 | - (id)retain { \ 129 | return self; \ 130 | } \ 131 | - (NSUInteger)retainCount { \ 132 | return NSUIntegerMax; \ 133 | } \ 134 | - (void)release { \ 135 | } \ 136 | - (id)autorelease { \ 137 | return self; \ 138 | } \ 139 | - (id)copyWithZone:(NSZone *) __unused zone { \ 140 | return self; \ 141 | } \ 142 | 143 | #endif // SINGLETON_BOILERPLATE_FULL 144 | 145 | #ifndef FMTGetErrorDescription 146 | #define FMTGetErrorDescription(error) [[(error) userInfo] objectForKey:NSLocalizedDescriptionKey] 147 | #endif // FMTGetErrorDescription 148 | -------------------------------------------------------------------------------- /ShiftIt/ShiftableWindow.m: -------------------------------------------------------------------------------- 1 | #import "ShiftableWindow.h" 2 | #import "NSScreen+Coordinates.h" 3 | #import "ShiftIt.h" 4 | 5 | #define NSStringFromCGRect(rect) [NSString stringWithFormat:@"[%.2f, %.2f] x [%.2f, %.2f]", (rect).origin.x, (rect).origin.y, (rect).size.width, (rect).size.height] 6 | 7 | @interface ShiftableWindow () 8 | 9 | @property (nonatomic, assign) AXUIElementRef window; 10 | 11 | - (id) initForFocusedWindow; 12 | 13 | - (CGPoint)targetPositionForOrigin:(Origin)origin toBeAtPoint:(CGPoint)point forSize:(CGSize)size; 14 | - (void)setPosition:(CGPoint)position; 15 | - (void)setSize:(CGSize)size; 16 | 17 | @end 18 | 19 | 20 | @implementation ShiftableWindow 21 | 22 | @synthesize window; 23 | 24 | + (ShiftableWindow *)focusedWindow { 25 | return [[[ShiftableWindow alloc] initForFocusedWindow] autorelease]; 26 | } 27 | 28 | - (id)initForFocusedWindow { 29 | self = [super init]; 30 | if (self) { 31 | AXUIElementRef systemElementRef = AXUIElementCreateSystemWide(); 32 | 33 | AXUIElementRef focusedAppRef = nil; 34 | AXError axerror = AXUIElementCopyAttributeValue(systemElementRef,kAXFocusedApplicationAttribute, (CFTypeRef *) &focusedAppRef); 35 | CFRelease(systemElementRef); 36 | if (axerror != kAXErrorSuccess) return nil; 37 | 38 | AXUIElementRef focusedWindowRef = nil; 39 | axerror = AXUIElementCopyAttributeValue(focusedAppRef,(CFStringRef)NSAccessibilityFocusedWindowAttribute,(CFTypeRef*)&focusedWindowRef); 40 | CFRelease(focusedAppRef); 41 | if (axerror != kAXErrorSuccess) return nil; 42 | 43 | self.window = focusedWindowRef; 44 | } 45 | 46 | return self; 47 | } 48 | 49 | - (void)dealloc { 50 | CFRelease(self.window); 51 | self.window = nil; 52 | [super dealloc]; 53 | } 54 | 55 | - (CGRect)frame { 56 | CGRect frame; 57 | 58 | CFTypeRef positionRef; 59 | if (AXUIElementCopyAttributeValue(self.window, kAXPositionAttribute, &positionRef) != kAXErrorSuccess) { 60 | return CGRectZero; 61 | } 62 | AXValueGetValue(positionRef, kAXValueCGPointType, (void*)&(frame.origin)); 63 | CFRelease(positionRef); 64 | 65 | CFTypeRef sizeRef; 66 | if (AXUIElementCopyAttributeValue(self.window,kAXSizeAttribute, &sizeRef) != kAXErrorSuccess) { 67 | return CGRectZero; 68 | } 69 | AXValueGetValue(sizeRef, kAXValueCGSizeType, (void*)&(frame.size)); 70 | CFRelease(sizeRef); 71 | 72 | return frame; 73 | } 74 | 75 | - (NSScreen *)screen { 76 | NSScreen *winner = [NSScreen mainScreen]; 77 | float winnerArea = 0; 78 | CGRect windowRect = self.frame; 79 | 80 | for (NSScreen *screen in [NSScreen screens]) { 81 | NSRect intersectRect = NSIntersectionRect([screen windowRectFromScreenRect:screen.visibleFrame], windowRect); 82 | float area = intersectRect.size.width * intersectRect.size.height; 83 | if (area > winnerArea) { 84 | winner = screen; 85 | winnerArea = area; 86 | } 87 | } 88 | 89 | return winner; 90 | } 91 | 92 | - (CGPoint)targetPositionForOrigin:(Origin)origin toBeAtPoint:(CGPoint)point forSize:(CGSize)size { 93 | if (origin == topLeft) { 94 | return CGPointMake(point.x, point.y); 95 | } else if (origin == topRight) { 96 | return CGPointMake(point.x - size.width, point.y); 97 | } else if (origin == bottomLeft) { 98 | return CGPointMake(point.x, point.y - size.height); 99 | } else if (origin == bottomRight) { 100 | return CGPointMake(point.x - size.width, point.y - size.height); 101 | } else if (origin == center) { 102 | return CGPointMake(point.x - size.width / 2, point.y - size.height / 2); 103 | } 104 | 105 | return CGPointZero; 106 | } 107 | 108 | - (void)setWindowSize:(CGSize)targetSize andSnapOrigin:(Origin)origin to:(CGPoint)point { 109 | [self setWindowSize:targetSize 110 | andSnapOrigin:origin 111 | to:point 112 | onScreen:self.screen]; 113 | } 114 | 115 | - (void)setWindowSize:(CGSize)targetSize andSnapOrigin:(Origin)origin to:(CGPoint)point onScreen:(NSScreen *)screen { 116 | CGRect screenFrame = [screen windowRectFromScreenRect:screen.visibleFrame]; 117 | CGRect windowFrame = self.frame; 118 | 119 | BOOL willExceedWidth = windowFrame.origin.x + targetSize.width > screenFrame.origin.x + screenFrame.size.width + 5; 120 | BOOL willExceedHeight = windowFrame.origin.y + targetSize.height > screenFrame.origin.y + screenFrame.size.height + 5; 121 | 122 | if (willExceedWidth || willExceedHeight) { 123 | CGPoint temporaryPosition = [self targetPositionForOrigin:origin toBeAtPoint:point forSize:targetSize]; 124 | if (temporaryPosition.x + targetSize.width > screenFrame.origin.x + screenFrame.size.width + 5) { 125 | temporaryPosition.x = screenFrame.origin.x + screenFrame.size.width - targetSize.width; 126 | } 127 | 128 | if (temporaryPosition.y + targetSize.height > screenFrame.origin.y + screenFrame.size.height + 5) { 129 | temporaryPosition.y = screenFrame.origin.y + screenFrame.size.height - targetSize.height; 130 | } 131 | 132 | [self setPosition:temporaryPosition]; 133 | } 134 | 135 | [self setSize:targetSize]; 136 | [self setPosition:[self targetPositionForOrigin:origin toBeAtPoint:point forSize:self.frame.size]]; 137 | } 138 | 139 | - (void)setPosition:(CGPoint)position { 140 | CFTypeRef positionRef = (CFTypeRef)(AXValueCreate(kAXValueCGPointType, (const void *)&position)); 141 | AXUIElementSetAttributeValue(self.window, kAXPositionAttribute, positionRef); 142 | CFRelease(positionRef); 143 | } 144 | 145 | - (void)setSize:(CGSize)size { 146 | CFTypeRef sizeRef = (CFTypeRef)(AXValueCreate(kAXValueCGSizeType, (const void *)&size)); 147 | AXUIElementSetAttributeValue(self.window, kAXSizeAttribute, sizeRef); 148 | CFRelease(sizeRef); 149 | } 150 | 151 | - (BOOL)origin:(Origin)Origin isNearPoint:(CGPoint)point { 152 | CGRect frame = self.frame; 153 | CGPoint positionOfOrigin; 154 | 155 | if (Origin == topLeft) { 156 | positionOfOrigin = CGPointMake(frame.origin.x, frame.origin.y); 157 | } else if (Origin == topRight) { 158 | positionOfOrigin = CGPointMake(frame.origin.x + frame.size.width, frame.origin.y); 159 | } else if (Origin == bottomLeft) { 160 | positionOfOrigin = CGPointMake(frame.origin.x, frame.origin.y + frame.size.height); 161 | } else if (Origin == bottomRight) { 162 | positionOfOrigin = CGPointMake(frame.origin.x + frame.size.width, frame.origin.y + frame.size.height); 163 | } else if (Origin == center) { 164 | positionOfOrigin = CGPointCenterOfCGRect(frame); 165 | } 166 | 167 | return AreClose(positionOfOrigin.x, point.x) && AreClose(positionOfOrigin.y, point.y); 168 | } 169 | 170 | @end 171 | -------------------------------------------------------------------------------- /ShiftIt/ShortcutRecorder.framework/Versions/A/Headers/SRCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // SRCommon.h 3 | // ShortcutRecorder 4 | // 5 | // Copyright 2006-2007 Contributors. All rights reserved. 6 | // 7 | // License: BSD 8 | // 9 | // Contributors: 10 | // David Dauer 11 | // Jesper 12 | // Jamie Kirkpatrick 13 | 14 | #import 15 | #import 16 | #import 17 | 18 | #pragma mark Dummy class 19 | 20 | @interface SRDummyClass : NSObject {} @end 21 | 22 | #pragma mark - 23 | #pragma mark Typedefs 24 | 25 | typedef struct _KeyCombo { 26 | NSUInteger flags; // 0 for no flags 27 | NSInteger code; // -1 for no code 28 | } KeyCombo; 29 | 30 | #pragma mark - 31 | #pragma mark Enums 32 | 33 | // Unicode values of some keyboard glyphs 34 | enum { 35 | KeyboardTabRightGlyph = 0x21E5, 36 | KeyboardTabLeftGlyph = 0x21E4, 37 | KeyboardCommandGlyph = kCommandUnicode, 38 | KeyboardOptionGlyph = kOptionUnicode, 39 | KeyboardShiftGlyph = kShiftUnicode, 40 | KeyboardControlGlyph = kControlUnicode, 41 | KeyboardReturnGlyph = 0x2305, 42 | KeyboardReturnR2LGlyph = 0x21A9, 43 | KeyboardDeleteLeftGlyph = 0x232B, 44 | KeyboardDeleteRightGlyph = 0x2326, 45 | KeyboardPadClearGlyph = 0x2327, 46 | KeyboardLeftArrowGlyph = 0x2190, 47 | KeyboardRightArrowGlyph = 0x2192, 48 | KeyboardUpArrowGlyph = 0x2191, 49 | KeyboardDownArrowGlyph = 0x2193, 50 | KeyboardPageDownGlyph = 0x21DF, 51 | KeyboardPageUpGlyph = 0x21DE, 52 | KeyboardNorthwestArrowGlyph = 0x2196, 53 | KeyboardSoutheastArrowGlyph = 0x2198, 54 | KeyboardEscapeGlyph = 0x238B, 55 | KeyboardHelpGlyph = 0x003F, 56 | KeyboardUpArrowheadGlyph = 0x2303, 57 | }; 58 | 59 | // Special keys 60 | enum { 61 | kSRKeysF1 = 122, 62 | kSRKeysF2 = 120, 63 | kSRKeysF3 = 99, 64 | kSRKeysF4 = 118, 65 | kSRKeysF5 = 96, 66 | kSRKeysF6 = 97, 67 | kSRKeysF7 = 98, 68 | kSRKeysF8 = 100, 69 | kSRKeysF9 = 101, 70 | kSRKeysF10 = 109, 71 | kSRKeysF11 = 103, 72 | kSRKeysF12 = 111, 73 | kSRKeysF13 = 105, 74 | kSRKeysF14 = 107, 75 | kSRKeysF15 = 113, 76 | kSRKeysF16 = 106, 77 | kSRKeysF17 = 64, 78 | kSRKeysF18 = 79, 79 | kSRKeysF19 = 80, 80 | kSRKeysSpace = 49, 81 | kSRKeysDeleteLeft = 51, 82 | kSRKeysDeleteRight = 117, 83 | kSRKeysPadClear = 71, 84 | kSRKeysLeftArrow = 123, 85 | kSRKeysRightArrow = 124, 86 | kSRKeysUpArrow = 126, 87 | kSRKeysDownArrow = 125, 88 | kSRKeysSoutheastArrow = 119, 89 | kSRKeysNorthwestArrow = 115, 90 | kSRKeysEscape = 53, 91 | kSRKeysPageDown = 121, 92 | kSRKeysPageUp = 116, 93 | kSRKeysReturnR2L = 36, 94 | kSRKeysReturn = 76, 95 | kSRKeysTabRight = 48, 96 | kSRKeysHelp = 114 97 | }; 98 | 99 | #pragma mark - 100 | #pragma mark Macros 101 | 102 | // Localization macros, for use in any bundle 103 | #define SRLoc(key) SRLocalizedString(key, nil) 104 | #define SRLocalizedString(key, comment) NSLocalizedStringFromTableInBundle(key, @"ShortcutRecorder", [NSBundle bundleForClass: [SRDummyClass class]], comment) 105 | 106 | // Image macros, for use in any bundle 107 | //#define SRImage(name) [[[NSImage alloc] initWithContentsOfFile: [[NSBundle bundleForClass: [self class]] pathForImageResource: name]] autorelease] 108 | #define SRResIndImage(name) [SRSharedImageProvider supportingImageWithName:name] 109 | #define SRImage(name) SRResIndImage(name) 110 | 111 | //#define SRCommonWriteDebugImagery 112 | 113 | // Macros for glyps 114 | #define SRInt(x) [NSNumber numberWithInteger:x] 115 | #define SRChar(x) [NSString stringWithFormat: @"%C", x] 116 | 117 | // Some default values 118 | #define ShortcutRecorderEmptyFlags 0 119 | #define ShortcutRecorderAllFlags ShortcutRecorderEmptyFlags | (NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask | NSShiftKeyMask | NSFunctionKeyMask) 120 | #define ShortcutRecorderEmptyCode -1 121 | 122 | // These keys will cancel the recoding mode if not pressed with any modifier 123 | #define ShortcutRecorderEscapeKey 53 124 | #define ShortcutRecorderBackspaceKey 51 125 | #define ShortcutRecorderDeleteKey 117 126 | 127 | #pragma mark - 128 | #pragma mark Getting a string of the key combination 129 | 130 | // 131 | // ################### +- Returns string from keyCode like NSEvent's -characters 132 | // # EXPLANATORY # | +- Returns string from keyCode like NSEvent's -charactersUsingModifiers 133 | // # CHART # | | +- Returns fully readable and localized name of modifier (if modifier given) 134 | // ################### | | | +- Returns glyph of modifier (if modifier given) 135 | // SRString... X - - X 136 | // SRReadableString... X - X - 137 | // SRCharacter... - X - - 138 | // 139 | NSString * SRStringForKeyCode( NSInteger keyCode ); 140 | NSString * SRStringForCarbonModifierFlags( NSUInteger flags ); 141 | NSString * SRStringForCarbonModifierFlagsAndKeyCode( NSUInteger flags, NSInteger keyCode ); 142 | NSString * SRStringForCocoaModifierFlags( NSUInteger flags ); 143 | NSString * SRStringForCocoaModifierFlagsAndKeyCode( NSUInteger flags, NSInteger keyCode ); 144 | NSString * SRReadableStringForCarbonModifierFlagsAndKeyCode( NSUInteger flags, NSInteger keyCode ); 145 | NSString * SRReadableStringForCocoaModifierFlagsAndKeyCode( NSUInteger flags, NSInteger keyCode ); 146 | NSString *SRCharacterForKeyCodeAndCarbonFlags(NSInteger keyCode, NSUInteger carbonFlags); 147 | NSString *SRCharacterForKeyCodeAndCocoaFlags(NSInteger keyCode, NSUInteger cocoaFlags); 148 | 149 | #pragma mark Converting between Cocoa and Carbon modifier flags 150 | 151 | NSUInteger SRCarbonToCocoaFlags( NSUInteger carbonFlags ); 152 | NSUInteger SRCocoaToCarbonFlags( NSUInteger cocoaFlags ); 153 | 154 | #pragma mark - 155 | #pragma mark Animation pace function 156 | 157 | CGFloat SRAnimationEaseInOut(CGFloat t); 158 | 159 | #pragma mark - 160 | #pragma mark Inlines 161 | 162 | FOUNDATION_STATIC_INLINE KeyCombo SRMakeKeyCombo(NSInteger code, NSUInteger flags) { 163 | KeyCombo kc; 164 | kc.code = code; 165 | kc.flags = flags; 166 | return kc; 167 | } 168 | 169 | FOUNDATION_STATIC_INLINE BOOL SRIsSpecialKey(NSInteger keyCode) { 170 | return (keyCode == kSRKeysF1 || keyCode == kSRKeysF2 || keyCode == kSRKeysF3 || keyCode == kSRKeysF4 || keyCode == kSRKeysF5 || keyCode == kSRKeysF6 || keyCode == kSRKeysF7 || keyCode == kSRKeysF8 || keyCode == kSRKeysF9 || keyCode == kSRKeysF10 || keyCode == kSRKeysF11 || keyCode == kSRKeysF12 || keyCode == kSRKeysF13 || keyCode == kSRKeysF14 || keyCode == kSRKeysF15 || keyCode == kSRKeysF16 || keyCode == kSRKeysSpace || keyCode == kSRKeysDeleteLeft || keyCode == kSRKeysDeleteRight || keyCode == kSRKeysPadClear || keyCode == kSRKeysLeftArrow || keyCode == kSRKeysRightArrow || keyCode == kSRKeysUpArrow || keyCode == kSRKeysDownArrow || keyCode == kSRKeysSoutheastArrow || keyCode == kSRKeysNorthwestArrow || keyCode == kSRKeysEscape || keyCode == kSRKeysPageDown || keyCode == kSRKeysPageUp || keyCode == kSRKeysReturnR2L || keyCode == kSRKeysReturn || keyCode == kSRKeysTabRight || keyCode == kSRKeysHelp); 171 | } 172 | 173 | #pragma mark - 174 | #pragma mark Additions 175 | 176 | @interface NSAlert( SRAdditions ) 177 | + (NSAlert *) alertWithNonRecoverableError:(NSError *)error; 178 | @end 179 | 180 | #pragma mark - 181 | #pragma mark Image provider 182 | 183 | @interface SRSharedImageProvider : NSObject 184 | + (NSImage *)supportingImageWithName:(NSString *)name; 185 | @end 186 | -------------------------------------------------------------------------------- /ShiftIt/ShiftComputer.m: -------------------------------------------------------------------------------- 1 | #import "ShiftComputer.h" 2 | #import "NSScreen+Coordinates.h" 3 | #import "ShiftIt.h" 4 | #import "ShiftableWindow.h" 5 | 6 | CGRect lastWindowRect = {{0,0},{0,0}}; 7 | 8 | @interface ShiftComputer () 9 | 10 | @property (nonatomic, retain) ShiftableWindow *window; 11 | @property (nonatomic, assign) BOOL isWide; 12 | 13 | - (CGRect)screenFrame; 14 | - (float)snapToThirdsForValue:(float)value 15 | containerValue:(float)containerValue 16 | ifOrigin:(Origin)Origin 17 | isNearPoint:(CGPoint)point 18 | cycleThroughFullValue:(BOOL)cycleThroughFullValue; 19 | 20 | @end 21 | 22 | @implementation ShiftComputer 23 | 24 | @synthesize window, isWide; 25 | 26 | + (ShiftComputer *)shiftComputer { 27 | return [[[ShiftComputer alloc] init] autorelease]; 28 | } 29 | 30 | - (id)init { 31 | self = [super init]; 32 | if (self) { 33 | self.window = [ShiftableWindow focusedWindow]; 34 | if (!self.window) return nil; 35 | self.isWide = self.window.screen.visibleFrame.size.width > self.window.screen.visibleFrame.size.height; 36 | } 37 | 38 | return self; 39 | } 40 | 41 | - (void)dealloc { 42 | self.window = nil; 43 | [super dealloc]; 44 | } 45 | 46 | - (CGRect)screenFrame { 47 | NSScreen *screen = self.window.screen; 48 | return [screen windowRectFromScreenRect:screen.visibleFrame]; 49 | } 50 | 51 | - (float)snapToThirdsForValue:(float)value containerValue:(float)containerValue ifOrigin:(Origin)Origin isNearPoint:(CGPoint)point cycleThroughFullValue:(BOOL)cycleThroughFullValue { 52 | float resultingValue = ceilf(containerValue / 2.0); 53 | if ([self.window origin:Origin isNearPoint:point]) { 54 | if (AreClose(value, ceilf(containerValue / 2.0))) { 55 | resultingValue = ceilf(containerValue / 3.0); 56 | } 57 | if (cycleThroughFullValue) { 58 | if (AreClose(value, ceilf(containerValue / 3.0))) { 59 | resultingValue = ceilf(containerValue); 60 | } 61 | if (AreClose(value, ceilf(containerValue))) { 62 | resultingValue = ceilf(2 * containerValue / 3.0); 63 | } 64 | } else { 65 | if (AreClose(value, ceilf(containerValue / 3.0))) { 66 | resultingValue = ceilf(2 * containerValue / 3.0); 67 | } 68 | } 69 | } 70 | 71 | return resultingValue; 72 | } 73 | 74 | - (void)left { 75 | CGRect frame = self.screenFrame; 76 | CGPoint originPoint = CGPointMake(frame.origin.x, self.isWide ? frame.origin.y : self.window.frame.origin.y); 77 | float targetHeight = self.isWide ? frame.size.height : self.window.frame.size.height; 78 | float targetWidth = [self snapToThirdsForValue:self.window.frame.size.width containerValue:frame.size.width 79 | ifOrigin:topLeft isNearPoint:originPoint cycleThroughFullValue:!self.isWide]; 80 | 81 | [self.window setWindowSize:CGSizeMake(targetWidth, targetHeight) 82 | andSnapOrigin:topLeft 83 | to:originPoint]; 84 | } 85 | 86 | - (void)right { 87 | CGRect frame = self.screenFrame; 88 | CGPoint originPoint = CGPointMake(frame.origin.x + frame.size.width, self.isWide ? frame.origin.y : self.window.frame.origin.y); 89 | float targetHeight = self.isWide ? frame.size.height : self.window.frame.size.height; 90 | float targetWidth = [self snapToThirdsForValue:self.window.frame.size.width containerValue:frame.size.width 91 | ifOrigin:topRight isNearPoint:originPoint cycleThroughFullValue:!self.isWide]; 92 | 93 | [self.window setWindowSize:CGSizeMake(targetWidth, targetHeight) 94 | andSnapOrigin:topRight 95 | to:originPoint]; 96 | } 97 | 98 | - (void)top { 99 | CGRect frame = self.screenFrame; 100 | CGPoint originPoint = CGPointMake(self.isWide ? self.window.frame.origin.x : frame.origin.x, frame.origin.y); 101 | float targetHeight = [self snapToThirdsForValue:self.window.frame.size.height containerValue:frame.size.height 102 | ifOrigin:topLeft isNearPoint:originPoint cycleThroughFullValue:self.isWide]; 103 | float targetWidth = self.isWide ? self.window.frame.size.width : frame.size.width; 104 | 105 | [self.window setWindowSize:CGSizeMake(targetWidth, targetHeight) 106 | andSnapOrigin:topLeft 107 | to:originPoint]; 108 | } 109 | 110 | - (void)bottom { 111 | CGRect frame = self.screenFrame; 112 | CGPoint originPoint = CGPointMake(self.isWide ? self.window.frame.origin.x : frame.origin.x, frame.origin.y + frame.size.height); 113 | float targetHeight = [self snapToThirdsForValue:self.window.frame.size.height containerValue:frame.size.height 114 | ifOrigin:bottomLeft isNearPoint:originPoint cycleThroughFullValue:self.isWide]; 115 | float targetWidth = self.isWide ? self.window.frame.size.width : frame.size.width; 116 | 117 | [self.window setWindowSize:CGSizeMake(targetWidth, targetHeight) 118 | andSnapOrigin:bottomLeft 119 | to:originPoint]; 120 | } 121 | 122 | - (void)fullscreen { 123 | CGRect frame = self.screenFrame; 124 | if (RectsAreClose(self.window.frame, frame) && !CGRectIsEmpty(lastWindowRect)) { 125 | [self.window setWindowSize:lastWindowRect.size 126 | andSnapOrigin:topLeft 127 | to:lastWindowRect.origin]; 128 | } else { 129 | lastWindowRect = self.window.frame; 130 | [self.window setWindowSize:frame.size 131 | andSnapOrigin:topLeft 132 | to:frame.origin]; 133 | } 134 | } 135 | 136 | - (void)center { 137 | CGRect frame = self.screenFrame; 138 | float targetFactor = 0.85; 139 | 140 | float currentWidthFactor = self.window.frame.size.width / frame.size.width; 141 | float currentHeightFactor = self.window.frame.size.height / frame.size.height; 142 | 143 | if ([self.window origin:center isNearPoint:CGPointCenterOfCGRect(frame)] && AreClose(currentWidthFactor, currentHeightFactor)) { 144 | if (AreClose(currentWidthFactor * 1000, 850)) { 145 | targetFactor = 0.6; 146 | } else if (AreClose(currentWidthFactor * 1000, 600)) { 147 | targetFactor = 0.33333; 148 | } 149 | } 150 | 151 | [self.window setWindowSize:CGSizeMake(frame.size.width * targetFactor, frame.size.height * targetFactor) 152 | andSnapOrigin:center 153 | to:CGPointCenterOfCGRect(frame)]; 154 | } 155 | 156 | - (NSString *)frameKeyForScreen:(NSScreen *)screen 157 | 158 | { 159 | return [NSString stringWithFormat:@"%.1f,%.1f,%.1f,%.1f", screen.frame.origin.x, screen.frame.origin.y, screen.frame.size.width, screen.frame.size.height]; 160 | } 161 | 162 | - (void)swapscreen { 163 | if ([[NSScreen screens] count] > 1) { 164 | NSMutableArray *uniqueScreens = [NSMutableArray array]; 165 | NSMutableDictionary *screenFrameLookup = [NSMutableDictionary dictionary]; 166 | for (NSScreen *screen in [NSScreen screens]) { 167 | NSString *frameKey = [self frameKeyForScreen:screen]; 168 | if (!screenFrameLookup[frameKey]) { 169 | [uniqueScreens addObject:screen]; 170 | screenFrameLookup[frameKey] = screen; 171 | } 172 | } 173 | 174 | NSScreen *currentScreen = self.window.screen; 175 | NSUInteger index = [uniqueScreens indexOfObject:screenFrameLookup[[self frameKeyForScreen:currentScreen]]] + 1; 176 | NSScreen *nextScreen = [uniqueScreens objectAtIndex:index % uniqueScreens.count]; 177 | 178 | CGRect currentFrame = self.screenFrame; 179 | CGRect nextFrame = [nextScreen windowRectFromScreenRect:nextScreen.visibleFrame]; 180 | 181 | float xFrac = (self.window.frame.origin.x - currentFrame.origin.x) / currentFrame.size.width; 182 | float yFrac = (self.window.frame.origin.y - currentFrame.origin.y) / currentFrame.size.height; 183 | float wFrac = self.window.frame.size.width / currentFrame.size.width; 184 | float hFrac = self.window.frame.size.height / currentFrame.size.height; 185 | 186 | [self.window setWindowSize:CGSizeMake(wFrac * nextFrame.size.width, hFrac * nextFrame.size.height) 187 | andSnapOrigin:topLeft 188 | to:CGPointMake(xFrac * nextFrame.size.width + nextFrame.origin.x,yFrac * nextFrame.size.height + nextFrame.origin.y) 189 | onScreen:nextScreen]; 190 | } 191 | } 192 | 193 | @end -------------------------------------------------------------------------------- /ShiftIt/ShiftItAppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | ShiftIt: Resize windows with Hotkeys 3 | Copyright (C) 2010 Aravind 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | */ 19 | 20 | #import "ShiftItAppDelegate.h" 21 | #import "ShiftIt.h" 22 | #import "ShiftItAction.h" 23 | #import "PreferencesWindowController.h" 24 | #import "ShiftComputer.h" 25 | #import "FMTLoginItems.h" 26 | #import "FMTHotKey.h" 27 | #import "FMTHotKeyManager.h" 28 | #import "FMTUtils.h" 29 | #import "FMTDefines.h" 30 | 31 | NSString *const kShiftItAppBundleId = @"org.shiftitapp.ShiftIt"; 32 | 33 | // the name of the plist file containing the preference defaults 34 | NSString *const kShiftItUserDefaults = @"ShiftIt-defaults"; 35 | 36 | // preferencs 37 | NSString *const kHasStartedBeforePrefKey = @"hasStartedBefore"; 38 | NSString *const kShowMenuPrefKey = @"shiftItshowMenu"; 39 | 40 | // notifications 41 | NSString *const kShowPreferencesRequestNotification = @"org.shiftitapp.shiftit.notifiactions.showPreferences"; 42 | 43 | // icon 44 | NSString *const kSIIconName = @"ShiftIt-menuIcon"; 45 | NSString *const kSIMenuItemTitle = @"Shift"; 46 | 47 | // the size that should be reserved for the menu item in the system menu in px 48 | NSInteger const kSIMenuItemSize = 30; 49 | NSInteger const kSIMenuUITagPrefix = 2000; 50 | 51 | NSDictionary *allShiftActions = nil; 52 | 53 | @interface ShiftItAppDelegate (Private) 54 | 55 | - (void)initializeActions_; 56 | - (void)updateMenuBarIcon_; 57 | - (void)firstLaunch_; 58 | - (void)invokeShiftItActionByIdentifier_:(NSString *)identifier; 59 | - (void)updateStatusMenuShortcutForAction_:(ShiftItAction *)action keyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers; 60 | 61 | - (void)handleShowPreferencesRequest_:(NSNotification *) notification; 62 | - (void) shiftItActionHotKeyChanged_:(NSNotification *) notification; 63 | - (void)handleActionsStateChangeRequest_:(NSNotification *) notification; 64 | 65 | @end 66 | 67 | 68 | @implementation ShiftItAppDelegate 69 | 70 | - (id)init{ 71 | if(![super init]){ 72 | return nil; 73 | } 74 | 75 | statusMenuItemIcon_ = [[NSImage imageNamed:kSIIconName] retain]; 76 | allHotKeys_ = [[NSMutableDictionary alloc] init]; 77 | 78 | return self; 79 | } 80 | 81 | - (void) dealloc { 82 | [statusMenuItemIcon_ release]; 83 | [allShiftActions release]; 84 | 85 | [super dealloc]; 86 | } 87 | 88 | - (void) firstLaunch_ { 89 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 90 | 91 | // ask to start it automatically - make sure it is not there 92 | 93 | // TODO: refactor this so it shares the code from the pref controller 94 | FMTLoginItems *loginItems = [FMTLoginItems sharedSessionLoginItems]; 95 | NSString *appPath = [[NSBundle mainBundle] bundlePath]; 96 | 97 | if (![loginItems isInLoginItemsApplicationWithPath:appPath]) { 98 | int ret = NSRunAlertPanel (@"Start ShiftIt automatically?", @"Would you like to have ShiftIt automatically started at a login time?", @"Yes", @"No",NULL); 99 | switch (ret){ 100 | case NSAlertDefaultReturn: 101 | // do it! 102 | [loginItems toggleApplicationInLoginItemsWithPath:appPath enabled:YES]; 103 | break; 104 | default: 105 | break; 106 | } 107 | } 108 | 109 | // make sure this was the only time 110 | [defaults setBool:YES forKey:@"hasStartedBefore"]; 111 | [defaults synchronize]; 112 | 113 | } 114 | 115 | - (int)osxMinorVersion { 116 | NSDictionary *systemVersionDictionary = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]; 117 | NSString *systemVersion = [systemVersionDictionary objectForKey:@"ProductVersion"]; 118 | NSArray *components = [systemVersion componentsSeparatedByString:@"."]; 119 | if (components.count > 1) { 120 | return [components[1] intValue]; 121 | } else { 122 | return 0; 123 | } 124 | } 125 | 126 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 127 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 128 | [defaults synchronize]; 129 | 130 | // check preferences 131 | BOOL hasStartedBefore = [defaults boolForKey:kHasStartedBeforePrefKey]; 132 | 133 | if (!hasStartedBefore) { 134 | [self firstLaunch_]; 135 | } 136 | 137 | // register defaults - we assume that the installation is correct 138 | NSString *path = FMTGetMainBundleResourcePath(kShiftItUserDefaults, @"plist"); 139 | NSDictionary *d = [NSDictionary dictionaryWithContentsOfFile:path]; 140 | [defaults registerDefaults:d]; 141 | 142 | if (!AXAPIEnabled()){ 143 | NSString *subMessage = @""; 144 | if (self.osxMinorVersion >= 9) { 145 | subMessage = @"it's under the privacy tab in System Preferences>Privacy"; 146 | } 147 | int ret = NSRunAlertPanel (@"ShiftIt requires that the Accessibility API be enabled. Please enable Accessibility access.", subMessage, @"Take me there", @"Quit",NULL); 148 | switch (ret){ 149 | case NSAlertDefaultReturn: 150 | if (self.osxMinorVersion < 9) { 151 | [[NSWorkspace sharedWorkspace] openFile:@"/System/Library/PreferencePanes/UniversalAccessPref.prefPane"]; 152 | } else { 153 | [[NSWorkspace sharedWorkspace] openFile:@"/System/Library/PreferencePanes/Security.prefPane"]; 154 | } 155 | [NSApp terminate:self]; 156 | 157 | return; 158 | case NSAlertAlternateReturn: 159 | [NSApp terminate:self]; 160 | 161 | return; 162 | default: 163 | break; 164 | } 165 | } 166 | 167 | hotKeyManager_ = [FMTHotKeyManager sharedHotKeyManager]; 168 | 169 | [self initializeActions_]; 170 | [self updateMenuBarIcon_]; 171 | 172 | NSUserDefaultsController *userDefaultsController = [NSUserDefaultsController sharedUserDefaultsController]; 173 | [userDefaultsController addObserver:self forKeyPath:FMTStr(@"values.%@",kShowMenuPrefKey) options:0 context:self]; 174 | 175 | for (ShiftItAction *action in [allShiftActions allValues]) { 176 | NSString *identifier = [action identifier]; 177 | 178 | NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:3]; 179 | [userInfo setObject:[action identifier] forKey:kActionIdentifierKey]; 180 | [userInfo setObject:[NSNumber numberWithInt:[defaults integerForKey:KeyCodePrefKey(identifier)]] forKey:kHotKeyKeyCodeKey]; 181 | [userInfo setObject:[NSNumber numberWithInt:[defaults integerForKey:ModifiersPrefKey(identifier)]] forKey:kHotKeyModifiersKey]; 182 | 183 | NSNotification *notification = [NSNotification notificationWithName:kHotKeyChangedNotification object:self userInfo:userInfo]; 184 | [self shiftItActionHotKeyChanged_:notification]; 185 | } 186 | 187 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 188 | [notificationCenter addObserver:self selector:@selector(shiftItActionHotKeyChanged_:) name:kHotKeyChangedNotification object:nil]; 189 | [notificationCenter addObserver:self selector:@selector(handleActionsStateChangeRequest_:) name:kDidFinishEditingHotKeysPrefNotification object:nil]; 190 | [notificationCenter addObserver:self selector:@selector(handleActionsStateChangeRequest_:) name:kDidStartEditingHotKeysPrefNotification object:nil]; 191 | 192 | notificationCenter = [NSDistributedNotificationCenter defaultCenter]; 193 | [notificationCenter addObserver:self selector:@selector(handleShowPreferencesRequest_:) name:kShowPreferencesRequestNotification object:nil]; 194 | } 195 | 196 | - (void) applicationWillTerminate:(NSNotification *)aNotification { 197 | // unregister hotkeys 198 | for (FMTHotKey *hotKey in [allHotKeys_ allValues]) { 199 | [hotKeyManager_ unregisterHotKey:hotKey]; 200 | } 201 | } 202 | 203 | - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows: (BOOL)flag{ 204 | if(flag==NO){ 205 | [self showPreferences:nil]; 206 | } 207 | return YES; 208 | } 209 | 210 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ 211 | if([FMTStr(@"values.%@",kShowMenuPrefKey) isEqualToString:keyPath]) { 212 | [self updateMenuBarIcon_]; 213 | } 214 | } 215 | 216 | - (void) updateMenuBarIcon_ { 217 | BOOL showIconInMenuBar = [[NSUserDefaults standardUserDefaults] boolForKey:kShowMenuPrefKey]; 218 | NSStatusBar * statusBar = [NSStatusBar systemStatusBar]; 219 | 220 | if(showIconInMenuBar) { 221 | if(!statusItem_) { 222 | statusItem_ = [[statusBar statusItemWithLength:kSIMenuItemSize] retain]; 223 | [statusItem_ setMenu:statusMenu_]; 224 | if (statusMenuItemIcon_) { 225 | [statusItem_ setImage:statusMenuItemIcon_]; 226 | } else { 227 | [statusItem_ setTitle:kSIMenuItemTitle]; 228 | } 229 | [statusItem_ setHighlightMode:YES]; 230 | } 231 | } else { 232 | [statusBar removeStatusItem:statusItem_]; 233 | [statusItem_ autorelease]; 234 | statusItem_ = nil; 235 | } 236 | } 237 | 238 | - (IBAction)showPreferences:(id)sender { 239 | if (!preferencesController_) { 240 | preferencesController_ = [[PreferencesWindowController alloc] init]; 241 | } 242 | 243 | [preferencesController_ showPreferences:sender]; 244 | [NSApp activateIgnoringOtherApps:YES]; 245 | } 246 | 247 | - (void)updateStatusMenuShortcutForAction_:(ShiftItAction *)action keyCode:(NSInteger)keyCode modifiers:(NSUInteger)modifiers { 248 | NSMenuItem *menuItem = [statusMenu_ itemWithTag:kSIMenuUITagPrefix+[action uiTag]]; 249 | 250 | [menuItem setTitle:action.label]; 251 | [menuItem setRepresentedObject:action.identifier]; 252 | [menuItem setAction:@selector(shiftItMenuAction_:)]; 253 | 254 | if (keyCode != -1) { 255 | NSString *keyCodeString = keyCode == 49 ? @" " : SRStringForKeyCode(keyCode); 256 | 257 | if (!keyCodeString) keyCodeString = @""; 258 | 259 | [menuItem setKeyEquivalent:[keyCodeString lowercaseString]]; 260 | [menuItem setKeyEquivalentModifierMask:modifiers]; 261 | } else { 262 | [menuItem setKeyEquivalent:@""]; 263 | [menuItem setKeyEquivalentModifierMask:0]; 264 | } 265 | } 266 | 267 | - (void) initializeActions_ { 268 | NSMutableDictionary *dict = [NSMutableDictionary dictionary]; 269 | 270 | [dict setObject:[ShiftItAction actionWithID:@"left" label:@"Left" uiTag:1] forKey:@"left"]; 271 | [dict setObject:[ShiftItAction actionWithID:@"right" label:@"Right" uiTag:2] forKey:@"right"]; 272 | [dict setObject:[ShiftItAction actionWithID:@"top" label:@"Top" uiTag:3] forKey:@"top"]; 273 | [dict setObject:[ShiftItAction actionWithID:@"bottom" label:@"Bottom" uiTag:4] forKey:@"bottom"]; 274 | [dict setObject:[ShiftItAction actionWithID:@"fullscreen" label:@"Full Screen" uiTag:5] forKey:@"fullscreen"]; 275 | [dict setObject:[ShiftItAction actionWithID:@"center" label:@"Center" uiTag:6] forKey:@"center"]; 276 | [dict setObject:[ShiftItAction actionWithID:@"swapscreen" label:@"Swap Screen" uiTag:7] forKey:@"swapscreen"]; 277 | 278 | allShiftActions = [[NSDictionary dictionaryWithDictionary:dict] retain]; 279 | } 280 | 281 | - (void)handleShowPreferencesRequest_:(NSNotification *) notification { 282 | [self showPreferences:self]; 283 | } 284 | 285 | - (void)handleActionsStateChangeRequest_:(NSNotification *) notification { 286 | NSString *name = [notification name]; 287 | 288 | if ([name isEqualTo:kDidFinishEditingHotKeysPrefNotification]) { 289 | @synchronized(self) { 290 | paused_ = NO; 291 | } 292 | } else if ([name isEqualTo:kDidStartEditingHotKeysPrefNotification]) { 293 | @synchronized(self) { 294 | paused_ = YES; 295 | } 296 | } 297 | 298 | } 299 | 300 | - (void) shiftItActionHotKeyChanged_:(NSNotification *) notification { 301 | NSDictionary *userInfo = [notification userInfo]; 302 | 303 | NSString *identifier = [userInfo objectForKey:kActionIdentifierKey]; 304 | NSInteger keyCode = [[userInfo objectForKey:kHotKeyKeyCodeKey] integerValue]; 305 | NSUInteger modifiers = [[userInfo objectForKey:kHotKeyModifiersKey] longValue]; 306 | 307 | ShiftItAction *action = [allShiftActions objectForKey:identifier]; 308 | 309 | FMTHotKey *newHotKey = [[FMTHotKey alloc] initWithKeyCode:keyCode modifiers:modifiers]; 310 | FMTHotKey *hotKey = [allHotKeys_ objectForKey:identifier]; 311 | if (hotKey) { 312 | if ([hotKey isEqualTo:newHotKey]) { 313 | return; 314 | } 315 | 316 | [hotKeyManager_ unregisterHotKey:hotKey]; 317 | [allHotKeys_ removeObjectForKey:identifier]; 318 | } 319 | 320 | if (keyCode != -1) { 321 | [hotKeyManager_ registerHotKey:newHotKey handler:@selector(invokeShiftItActionByIdentifier_:) provider:self userData:identifier]; 322 | [allHotKeys_ setObject:newHotKey forKey:identifier]; 323 | } 324 | 325 | [self updateStatusMenuShortcutForAction_:action keyCode:keyCode modifiers:modifiers]; 326 | 327 | if ([notification object] != self) { 328 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 329 | [defaults setInteger:keyCode forKey:KeyCodePrefKey(identifier)]; 330 | [defaults setInteger:modifiers forKey:ModifiersPrefKey(identifier)]; 331 | [defaults synchronize]; 332 | } 333 | } 334 | 335 | - (void) invokeShiftItActionByIdentifier_:(NSString *)identifier { 336 | @synchronized(self) { 337 | if (paused_) { 338 | return ; 339 | } 340 | } 341 | 342 | ShiftItAction *action = [allShiftActions objectForKey:identifier]; 343 | [[ShiftComputer shiftComputer] performSelector:action.action]; 344 | } 345 | 346 | - (IBAction)shiftItMenuAction_:(id)sender { 347 | NSString *identifier = [sender representedObject]; 348 | [self invokeShiftItActionByIdentifier_:identifier]; 349 | } 350 | 351 | @end -------------------------------------------------------------------------------- /ShiftIt/English.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1070 5 | 11D50d 6 | 2182 7 | 1138.32 8 | 568.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2182 12 | 13 | 14 | YES 15 | NSMenu 16 | NSMenuItem 17 | NSCustomObject 18 | 19 | 20 | YES 21 | com.apple.InterfaceBuilder.CocoaPlugin 22 | 23 | 24 | PluginDependencyRecalculationVersion 25 | 26 | 27 | 28 | YES 29 | 30 | NSApplication 31 | 32 | 33 | FirstResponder 34 | 35 | 36 | NSApplication 37 | 38 | 39 | ShiftItAppDelegate 40 | 41 | 42 | Status Menu 43 | 44 | YES 45 | 46 | 47 | Left 48 | 49 | 1835008 50 | 2147483647 51 | 52 | NSImage 53 | NSMenuCheckmark 54 | 55 | 56 | NSImage 57 | NSMenuMixedState 58 | 59 | 2001 60 | 61 | 62 | 63 | Right 64 | 65 | 1835008 66 | 2147483647 67 | 68 | 69 | 2002 70 | 71 | 72 | 73 | Top 74 | 75 | 1835008 76 | 2147483647 77 | 78 | 79 | 2003 80 | 81 | 82 | 83 | Bottom 84 | 85 | 1835008 86 | 2147483647 87 | 88 | 89 | 2004 90 | 91 | 92 | 93 | YES 94 | YES 95 | 96 | 97 | 2147483647 98 | 99 | 100 | 101 | 102 | 103 | Maximize 104 | f 105 | 1835008 106 | 2147483647 107 | 108 | 109 | 2005 110 | 111 | 112 | 113 | Center 114 | c 115 | 1835008 116 | 2147483647 117 | 118 | 119 | 2006 120 | 121 | 122 | 123 | YES 124 | YES 125 | 126 | 127 | 2147483647 128 | 129 | 130 | 131 | 132 | 133 | Swap Screen 134 | IA 135 | 1835008 136 | 2147483647 137 | 138 | 139 | 2007 140 | 141 | 142 | 143 | YES 144 | YES 145 | 146 | 147 | 2147483647 148 | 149 | 150 | 151 | 152 | 153 | Preferences 154 | , 155 | 1048576 156 | 2147483647 157 | 158 | 159 | 160 | 161 | 162 | Exit 163 | q 164 | 1048576 165 | 2147483647 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | YES 175 | 176 | 177 | terminate: 178 | 179 | 180 | 181 | 628 182 | 183 | 184 | 185 | delegate 186 | 187 | 188 | 189 | 495 190 | 191 | 192 | 193 | showPreferences: 194 | 195 | 196 | 197 | 760 198 | 199 | 200 | 201 | statusMenu_ 202 | 203 | 204 | 205 | 782 206 | 207 | 208 | 209 | shiftItMenuAction_: 210 | 211 | 212 | 213 | 785 214 | 215 | 216 | 217 | shiftItMenuAction_: 218 | 219 | 220 | 221 | 786 222 | 223 | 224 | 225 | shiftItMenuAction_: 226 | 227 | 228 | 229 | 787 230 | 231 | 232 | 233 | shiftItMenuAction_: 234 | 235 | 236 | 237 | 788 238 | 239 | 240 | 241 | shiftItMenuAction_: 242 | 243 | 244 | 245 | 789 246 | 247 | 248 | 249 | shiftItMenuAction_: 250 | 251 | 252 | 253 | 790 254 | 255 | 256 | 257 | shiftItMenuAction_: 258 | 259 | 260 | 261 | 791 262 | 263 | 264 | 265 | 266 | YES 267 | 268 | 0 269 | 270 | YES 271 | 272 | 273 | 274 | 275 | 276 | -2 277 | 278 | 279 | File's Owner 280 | 281 | 282 | -1 283 | 284 | 285 | First Responder 286 | 287 | 288 | -3 289 | 290 | 291 | Application 292 | 293 | 294 | 494 295 | 296 | 297 | 298 | 299 | 535 300 | 301 | 302 | YES 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 537 320 | 321 | 322 | 323 | 324 | 538 325 | 326 | 327 | 328 | 329 | 545 330 | 331 | 332 | 333 | 334 | 546 335 | 336 | 337 | 338 | 339 | 547 340 | 341 | 342 | 343 | 344 | 548 345 | 346 | 347 | 348 | 349 | 549 350 | 351 | 352 | 353 | 354 | 550 355 | 356 | 357 | 358 | 359 | 558 360 | 361 | 362 | 363 | 364 | 781 365 | 366 | 367 | 368 | 369 | 783 370 | 371 | 372 | 373 | 374 | 784 375 | 376 | 377 | 378 | 379 | 380 | 381 | YES 382 | 383 | YES 384 | -1.IBPluginDependency 385 | -2.IBPluginDependency 386 | -3.IBPluginDependency 387 | 494.IBPluginDependency 388 | 535.IBPluginDependency 389 | 537.IBPluginDependency 390 | 538.IBPluginDependency 391 | 545.IBPluginDependency 392 | 546.IBPluginDependency 393 | 547.IBPluginDependency 394 | 548.IBPluginDependency 395 | 549.IBPluginDependency 396 | 550.IBPluginDependency 397 | 558.IBPluginDependency 398 | 781.IBPluginDependency 399 | 783.IBPluginDependency 400 | 784.IBPluginDependency 401 | 402 | 403 | YES 404 | com.apple.InterfaceBuilder.CocoaPlugin 405 | com.apple.InterfaceBuilder.CocoaPlugin 406 | com.apple.InterfaceBuilder.CocoaPlugin 407 | com.apple.InterfaceBuilder.CocoaPlugin 408 | com.apple.InterfaceBuilder.CocoaPlugin 409 | com.apple.InterfaceBuilder.CocoaPlugin 410 | com.apple.InterfaceBuilder.CocoaPlugin 411 | com.apple.InterfaceBuilder.CocoaPlugin 412 | com.apple.InterfaceBuilder.CocoaPlugin 413 | com.apple.InterfaceBuilder.CocoaPlugin 414 | com.apple.InterfaceBuilder.CocoaPlugin 415 | com.apple.InterfaceBuilder.CocoaPlugin 416 | com.apple.InterfaceBuilder.CocoaPlugin 417 | com.apple.InterfaceBuilder.CocoaPlugin 418 | com.apple.InterfaceBuilder.CocoaPlugin 419 | com.apple.InterfaceBuilder.CocoaPlugin 420 | com.apple.InterfaceBuilder.CocoaPlugin 421 | 422 | 423 | 424 | YES 425 | 426 | 427 | 428 | 429 | 430 | YES 431 | 432 | 433 | 434 | 435 | 791 436 | 437 | 438 | 439 | YES 440 | 441 | ShiftItAppDelegate 442 | NSObject 443 | 444 | YES 445 | 446 | YES 447 | shiftItMenuAction_: 448 | showPreferences: 449 | 450 | 451 | YES 452 | id 453 | id 454 | 455 | 456 | 457 | YES 458 | 459 | YES 460 | shiftItMenuAction_: 461 | showPreferences: 462 | 463 | 464 | YES 465 | 466 | shiftItMenuAction_: 467 | id 468 | 469 | 470 | showPreferences: 471 | id 472 | 473 | 474 | 475 | 476 | statusMenu_ 477 | NSMenu 478 | 479 | 480 | statusMenu_ 481 | 482 | statusMenu_ 483 | NSMenu 484 | 485 | 486 | 487 | IBProjectSource 488 | ./Classes/ShiftItAppDelegate.h 489 | 490 | 491 | 492 | 493 | 0 494 | IBCocoaFramework 495 | 496 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 497 | 498 | 499 | YES 500 | 3 501 | 502 | YES 503 | 504 | YES 505 | NSMenuCheckmark 506 | NSMenuMixedState 507 | 508 | 509 | YES 510 | {11, 11} 511 | {10, 3} 512 | 513 | 514 | 515 | 516 | -------------------------------------------------------------------------------- /ShiftIt/ShiftIt.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 11 | 256AC3DA0F4B6AC300CF3369 /* ShiftItAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* ShiftItAppDelegate.m */; }; 12 | 2708BF011260E10900192883 /* ShiftItAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 2708BF001260E10900192883 /* ShiftItAction.m */; }; 13 | 2708BF121260E5BB00192883 /* ShiftComputer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2708BF111260E5BB00192883 /* ShiftComputer.m */; }; 14 | 27A14DB41269CD4200E68263 /* ShortcutRecorder.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 27A14D7F1269CCA200E68263 /* ShortcutRecorder.framework */; }; 15 | 27A14DD31269CE5600E68263 /* ShortcutRecorder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27A14D7F1269CCA200E68263 /* ShortcutRecorder.framework */; }; 16 | 27A14EC01269EC1500E68263 /* ShiftIt-defaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 27A14EBF1269EC1500E68263 /* ShiftIt-defaults.plist */; }; 17 | 27F4FD4B12730F2F00A65750 /* FMTHotKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F4FD4612730F2F00A65750 /* FMTHotKey.m */; }; 18 | 27F4FD4C12730F2F00A65750 /* FMTHotKey+SRKeyCombo.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F4FD4812730F2F00A65750 /* FMTHotKey+SRKeyCombo.m */; }; 19 | 27F4FD4D12730F2F00A65750 /* FMTHotKeyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F4FD4A12730F2F00A65750 /* FMTHotKeyManager.m */; }; 20 | 27F4FD5612730F4600A65750 /* FMTLoginItems.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F4FD5312730F4600A65750 /* FMTLoginItems.m */; }; 21 | 27F4FD5712730F4600A65750 /* FMTUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F4FD5512730F4600A65750 /* FMTUtils.m */; }; 22 | 83E55ED5125A5FCF00FC49BF /* ShiftIt-menuIcon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83E55ED3125A5FCF00FC49BF /* ShiftIt-menuIcon@2x.png */; }; 23 | 83E55ED6125A5FCF00FC49BF /* ShiftIt.icns in Resources */ = {isa = PBXBuildFile; fileRef = 83E55ED4125A5FCF00FC49BF /* ShiftIt.icns */; }; 24 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 25 | 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 26 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 27 | E32D97F017935BAD0098A52C /* ShiftIt-menuIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = E32D97EF17935BAD0098A52C /* ShiftIt-menuIcon.png */; }; 28 | E3478FD515CF466300BA1A16 /* ShiftableWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = E3478FD415CF466300BA1A16 /* ShiftableWindow.m */; }; 29 | E3478FD715CF47E000BA1A16 /* ShiftIt.m in Sources */ = {isa = PBXBuildFile; fileRef = E3478FD615CF47E000BA1A16 /* ShiftIt.m */; }; 30 | E3F68AE415CD90D300CD3A90 /* NSScreen+Coordinates.m in Sources */ = {isa = PBXBuildFile; fileRef = E3F68AE315CD90D300CD3A90 /* NSScreen+Coordinates.m */; }; 31 | F2520B641133874D00DB826F /* PreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F2520B631133874D00DB826F /* PreferencesWindowController.m */; }; 32 | F2DC1A321133829D009BDCA5 /* PreferencesWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = F2DC1A311133829D009BDCA5 /* PreferencesWindow.xib */; }; 33 | F2DC61EF1127C862000E1A5B /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2DC61EE1127C862000E1A5B /* Carbon.framework */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXCopyFilesBuildPhase section */ 37 | F270823F117FCFD600C0A04C /* CopyFiles */ = { 38 | isa = PBXCopyFilesBuildPhase; 39 | buildActionMask = 2147483647; 40 | dstPath = ""; 41 | dstSubfolderSpec = 10; 42 | files = ( 43 | 27A14DB41269CD4200E68263 /* ShortcutRecorder.framework in CopyFiles */, 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXCopyFilesBuildPhase section */ 48 | 49 | /* Begin PBXFileReference section */ 50 | 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 51 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 52 | 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; 53 | 256AC3D80F4B6AC300CF3369 /* ShiftItAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShiftItAppDelegate.h; sourceTree = ""; }; 54 | 256AC3D90F4B6AC300CF3369 /* ShiftItAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShiftItAppDelegate.m; sourceTree = ""; }; 55 | 256AC3F00F4B6AF500CF3369 /* ShiftIt_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShiftIt_Prefix.pch; sourceTree = ""; }; 56 | 2708BEFF1260E10900192883 /* ShiftItAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShiftItAction.h; sourceTree = ""; }; 57 | 2708BF001260E10900192883 /* ShiftItAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShiftItAction.m; sourceTree = ""; }; 58 | 2708BF101260E5BB00192883 /* ShiftComputer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShiftComputer.h; sourceTree = ""; }; 59 | 2708BF111260E5BB00192883 /* ShiftComputer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShiftComputer.m; sourceTree = ""; }; 60 | 2708C2551261C8E800192883 /* ShiftIt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShiftIt.h; sourceTree = ""; }; 61 | 27A14D7F1269CCA200E68263 /* ShortcutRecorder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ShortcutRecorder.framework; sourceTree = ""; }; 62 | 27A14EBF1269EC1500E68263 /* ShiftIt-defaults.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = "ShiftIt-defaults.plist"; sourceTree = ""; }; 63 | 27F4FD4512730F2F00A65750 /* FMTHotKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FMTHotKey.h; path = FMT/FMTHotKey.h; sourceTree = ""; }; 64 | 27F4FD4612730F2F00A65750 /* FMTHotKey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FMTHotKey.m; path = FMT/FMTHotKey.m; sourceTree = ""; }; 65 | 27F4FD4712730F2F00A65750 /* FMTHotKey+SRKeyCombo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "FMTHotKey+SRKeyCombo.h"; path = "FMT/FMTHotKey+SRKeyCombo.h"; sourceTree = ""; }; 66 | 27F4FD4812730F2F00A65750 /* FMTHotKey+SRKeyCombo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "FMTHotKey+SRKeyCombo.m"; path = "FMT/FMTHotKey+SRKeyCombo.m"; sourceTree = ""; }; 67 | 27F4FD4912730F2F00A65750 /* FMTHotKeyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FMTHotKeyManager.h; path = FMT/FMTHotKeyManager.h; sourceTree = ""; }; 68 | 27F4FD4A12730F2F00A65750 /* FMTHotKeyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FMTHotKeyManager.m; path = FMT/FMTHotKeyManager.m; sourceTree = ""; }; 69 | 27F4FD5112730F4600A65750 /* FMTDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FMTDefines.h; path = FMT/FMTDefines.h; sourceTree = ""; }; 70 | 27F4FD5212730F4600A65750 /* FMTLoginItems.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FMTLoginItems.h; path = FMT/FMTLoginItems.h; sourceTree = ""; }; 71 | 27F4FD5312730F4600A65750 /* FMTLoginItems.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FMTLoginItems.m; path = FMT/FMTLoginItems.m; sourceTree = ""; }; 72 | 27F4FD5412730F4600A65750 /* FMTUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FMTUtils.h; path = FMT/FMTUtils.h; sourceTree = ""; }; 73 | 27F4FD5512730F4600A65750 /* FMTUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FMTUtils.m; path = FMT/FMTUtils.m; sourceTree = ""; }; 74 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 75 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 76 | 83E55ED3125A5FCF00FC49BF /* ShiftIt-menuIcon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ShiftIt-menuIcon@2x.png"; sourceTree = ""; }; 77 | 83E55ED4125A5FCF00FC49BF /* ShiftIt.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = ShiftIt.icns; sourceTree = ""; }; 78 | 8D1107310486CEB800E47090 /* ShiftIt-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ShiftIt-Info.plist"; sourceTree = ""; }; 79 | 8D1107320486CEB800E47090 /* ShiftIt.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ShiftIt.app; sourceTree = BUILT_PRODUCTS_DIR; }; 80 | E32D97EF17935BAD0098A52C /* ShiftIt-menuIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ShiftIt-menuIcon.png"; sourceTree = ""; }; 81 | E3478FD315CF466300BA1A16 /* ShiftableWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShiftableWindow.h; sourceTree = ""; }; 82 | E3478FD415CF466300BA1A16 /* ShiftableWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShiftableWindow.m; sourceTree = ""; }; 83 | E3478FD615CF47E000BA1A16 /* ShiftIt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShiftIt.m; sourceTree = ""; }; 84 | E3F68AE215CD90D300CD3A90 /* NSScreen+Coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSScreen+Coordinates.h"; sourceTree = ""; }; 85 | E3F68AE315CD90D300CD3A90 /* NSScreen+Coordinates.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSScreen+Coordinates.m"; sourceTree = ""; }; 86 | F2520B621133874D00DB826F /* PreferencesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesWindowController.h; sourceTree = ""; }; 87 | F2520B631133874D00DB826F /* PreferencesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindowController.m; sourceTree = ""; }; 88 | F2DC1A311133829D009BDCA5 /* PreferencesWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PreferencesWindow.xib; sourceTree = ""; }; 89 | F2DC61EE1127C862000E1A5B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 90 | /* End PBXFileReference section */ 91 | 92 | /* Begin PBXFrameworksBuildPhase section */ 93 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 94 | isa = PBXFrameworksBuildPhase; 95 | buildActionMask = 2147483647; 96 | files = ( 97 | 27A14DD31269CE5600E68263 /* ShortcutRecorder.framework in Frameworks */, 98 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 99 | F2DC61EF1127C862000E1A5B /* Carbon.framework in Frameworks */, 100 | ); 101 | runOnlyForDeploymentPostprocessing = 0; 102 | }; 103 | /* End PBXFrameworksBuildPhase section */ 104 | 105 | /* Begin PBXGroup section */ 106 | 080E96DDFE201D6D7F000001 /* Classes */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 2708C1CC1261388A00192883 /* External */, 110 | F2D9C239112F9D0E003E9435 /* Preferences */, 111 | 256AC3D80F4B6AC300CF3369 /* ShiftItAppDelegate.h */, 112 | 256AC3D90F4B6AC300CF3369 /* ShiftItAppDelegate.m */, 113 | 2708BEFF1260E10900192883 /* ShiftItAction.h */, 114 | 2708BF001260E10900192883 /* ShiftItAction.m */, 115 | 2708BF101260E5BB00192883 /* ShiftComputer.h */, 116 | 2708BF111260E5BB00192883 /* ShiftComputer.m */, 117 | 2708C2551261C8E800192883 /* ShiftIt.h */, 118 | E3478FD615CF47E000BA1A16 /* ShiftIt.m */, 119 | E3F68AE215CD90D300CD3A90 /* NSScreen+Coordinates.h */, 120 | E3F68AE315CD90D300CD3A90 /* NSScreen+Coordinates.m */, 121 | E3478FD315CF466300BA1A16 /* ShiftableWindow.h */, 122 | E3478FD415CF466300BA1A16 /* ShiftableWindow.m */, 123 | ); 124 | name = Classes; 125 | sourceTree = ""; 126 | }; 127 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 131 | 27A14D7F1269CCA200E68263 /* ShortcutRecorder.framework */, 132 | ); 133 | name = "Linked Frameworks"; 134 | sourceTree = ""; 135 | }; 136 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | F2DC61EE1127C862000E1A5B /* Carbon.framework */, 140 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 141 | ); 142 | name = "Other Frameworks"; 143 | sourceTree = ""; 144 | }; 145 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 8D1107320486CEB800E47090 /* ShiftIt.app */, 149 | ); 150 | name = Products; 151 | sourceTree = ""; 152 | }; 153 | 2708C1CC1261388A00192883 /* External */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 2708C1CE126138A000192883 /* FMT */, 157 | ); 158 | name = External; 159 | sourceTree = ""; 160 | }; 161 | 2708C1CD1261389000192883 /* HotKey */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 27F4FD4512730F2F00A65750 /* FMTHotKey.h */, 165 | 27F4FD4612730F2F00A65750 /* FMTHotKey.m */, 166 | 27F4FD4712730F2F00A65750 /* FMTHotKey+SRKeyCombo.h */, 167 | 27F4FD4812730F2F00A65750 /* FMTHotKey+SRKeyCombo.m */, 168 | 27F4FD4912730F2F00A65750 /* FMTHotKeyManager.h */, 169 | 27F4FD4A12730F2F00A65750 /* FMTHotKeyManager.m */, 170 | ); 171 | name = HotKey; 172 | sourceTree = ""; 173 | }; 174 | 2708C1CE126138A000192883 /* FMT */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 2708C1CD1261389000192883 /* HotKey */, 178 | 27F4FD5112730F4600A65750 /* FMTDefines.h */, 179 | 27F4FD5212730F4600A65750 /* FMTLoginItems.h */, 180 | 27F4FD5312730F4600A65750 /* FMTLoginItems.m */, 181 | 27F4FD5412730F4600A65750 /* FMTUtils.h */, 182 | 27F4FD5512730F4600A65750 /* FMTUtils.m */, 183 | ); 184 | name = FMT; 185 | sourceTree = ""; 186 | }; 187 | 29B97314FDCFA39411CA2CEA /* ShiftIt */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | 080E96DDFE201D6D7F000001 /* Classes */, 191 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 192 | 29B97317FDCFA39411CA2CEA /* Resources */, 193 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 194 | 19C28FACFE9D520D11CA2CBB /* Products */, 195 | ); 196 | name = ShiftIt; 197 | sourceTree = ""; 198 | }; 199 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 200 | isa = PBXGroup; 201 | children = ( 202 | 256AC3F00F4B6AF500CF3369 /* ShiftIt_Prefix.pch */, 203 | 29B97316FDCFA39411CA2CEA /* main.m */, 204 | ); 205 | name = "Other Sources"; 206 | sourceTree = ""; 207 | }; 208 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 209 | isa = PBXGroup; 210 | children = ( 211 | 27A14EBF1269EC1500E68263 /* ShiftIt-defaults.plist */, 212 | E32D97EF17935BAD0098A52C /* ShiftIt-menuIcon.png */, 213 | 83E55ED3125A5FCF00FC49BF /* ShiftIt-menuIcon@2x.png */, 214 | 83E55ED4125A5FCF00FC49BF /* ShiftIt.icns */, 215 | 8D1107310486CEB800E47090 /* ShiftIt-Info.plist */, 216 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 217 | 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, 218 | F2DC1A311133829D009BDCA5 /* PreferencesWindow.xib */, 219 | ); 220 | name = Resources; 221 | sourceTree = ""; 222 | }; 223 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 224 | isa = PBXGroup; 225 | children = ( 226 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 227 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 228 | ); 229 | name = Frameworks; 230 | sourceTree = ""; 231 | }; 232 | F2D9C239112F9D0E003E9435 /* Preferences */ = { 233 | isa = PBXGroup; 234 | children = ( 235 | F2520B621133874D00DB826F /* PreferencesWindowController.h */, 236 | F2520B631133874D00DB826F /* PreferencesWindowController.m */, 237 | ); 238 | name = Preferences; 239 | sourceTree = ""; 240 | }; 241 | /* End PBXGroup section */ 242 | 243 | /* Begin PBXNativeTarget section */ 244 | 8D1107260486CEB800E47090 /* ShiftIt */ = { 245 | isa = PBXNativeTarget; 246 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "ShiftIt" */; 247 | buildPhases = ( 248 | 8D1107290486CEB800E47090 /* Resources */, 249 | 8D11072C0486CEB800E47090 /* Sources */, 250 | 8D11072E0486CEB800E47090 /* Frameworks */, 251 | F270823F117FCFD600C0A04C /* CopyFiles */, 252 | ); 253 | buildRules = ( 254 | ); 255 | dependencies = ( 256 | ); 257 | name = ShiftIt; 258 | productInstallPath = "$(HOME)/Applications"; 259 | productName = ShiftIt; 260 | productReference = 8D1107320486CEB800E47090 /* ShiftIt.app */; 261 | productType = "com.apple.product-type.application"; 262 | }; 263 | /* End PBXNativeTarget section */ 264 | 265 | /* Begin PBXProject section */ 266 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 267 | isa = PBXProject; 268 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ShiftIt" */; 269 | compatibilityVersion = "Xcode 3.1"; 270 | developmentRegion = English; 271 | hasScannedForEncodings = 1; 272 | knownRegions = ( 273 | English, 274 | Japanese, 275 | French, 276 | German, 277 | ); 278 | mainGroup = 29B97314FDCFA39411CA2CEA /* ShiftIt */; 279 | projectDirPath = ""; 280 | projectRoot = ""; 281 | targets = ( 282 | 8D1107260486CEB800E47090 /* ShiftIt */, 283 | ); 284 | }; 285 | /* End PBXProject section */ 286 | 287 | /* Begin PBXResourcesBuildPhase section */ 288 | 8D1107290486CEB800E47090 /* Resources */ = { 289 | isa = PBXResourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 293 | 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, 294 | F2DC1A321133829D009BDCA5 /* PreferencesWindow.xib in Resources */, 295 | 83E55ED5125A5FCF00FC49BF /* ShiftIt-menuIcon@2x.png in Resources */, 296 | 83E55ED6125A5FCF00FC49BF /* ShiftIt.icns in Resources */, 297 | 27A14EC01269EC1500E68263 /* ShiftIt-defaults.plist in Resources */, 298 | E32D97F017935BAD0098A52C /* ShiftIt-menuIcon.png in Resources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXResourcesBuildPhase section */ 303 | 304 | /* Begin PBXSourcesBuildPhase section */ 305 | 8D11072C0486CEB800E47090 /* Sources */ = { 306 | isa = PBXSourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | 8D11072D0486CEB800E47090 /* main.m in Sources */, 310 | 256AC3DA0F4B6AC300CF3369 /* ShiftItAppDelegate.m in Sources */, 311 | F2520B641133874D00DB826F /* PreferencesWindowController.m in Sources */, 312 | 2708BF011260E10900192883 /* ShiftItAction.m in Sources */, 313 | 2708BF121260E5BB00192883 /* ShiftComputer.m in Sources */, 314 | 27F4FD4B12730F2F00A65750 /* FMTHotKey.m in Sources */, 315 | 27F4FD4C12730F2F00A65750 /* FMTHotKey+SRKeyCombo.m in Sources */, 316 | 27F4FD4D12730F2F00A65750 /* FMTHotKeyManager.m in Sources */, 317 | 27F4FD5612730F4600A65750 /* FMTLoginItems.m in Sources */, 318 | 27F4FD5712730F4600A65750 /* FMTUtils.m in Sources */, 319 | E3F68AE415CD90D300CD3A90 /* NSScreen+Coordinates.m in Sources */, 320 | E3478FD515CF466300BA1A16 /* ShiftableWindow.m in Sources */, 321 | E3478FD715CF47E000BA1A16 /* ShiftIt.m in Sources */, 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | }; 325 | /* End PBXSourcesBuildPhase section */ 326 | 327 | /* Begin PBXVariantGroup section */ 328 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { 329 | isa = PBXVariantGroup; 330 | children = ( 331 | 089C165DFE840E0CC02AAC07 /* English */, 332 | ); 333 | name = InfoPlist.strings; 334 | sourceTree = ""; 335 | }; 336 | 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { 337 | isa = PBXVariantGroup; 338 | children = ( 339 | 1DDD58150DA1D0A300B32029 /* English */, 340 | ); 341 | name = MainMenu.xib; 342 | sourceTree = ""; 343 | }; 344 | /* End PBXVariantGroup section */ 345 | 346 | /* Begin XCBuildConfiguration section */ 347 | C01FCF4B08A954540054247B /* Debug */ = { 348 | isa = XCBuildConfiguration; 349 | buildSettings = { 350 | ALWAYS_SEARCH_USER_PATHS = NO; 351 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 352 | COPY_PHASE_STRIP = NO; 353 | FRAMEWORK_SEARCH_PATHS = ( 354 | "$(inherited)", 355 | "\"$(SRCROOT)/build/Debug\"", 356 | "\"$(SRCROOT)\"", 357 | ); 358 | GCC_DYNAMIC_NO_PIC = NO; 359 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 360 | GCC_MODEL_TUNING = G5; 361 | GCC_OPTIMIZATION_LEVEL = 0; 362 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 363 | GCC_PREFIX_HEADER = ShiftIt_Prefix.pch; 364 | GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = "_DEBUGPRINTS_=1"; 365 | GCC_WARN_64_TO_32_BIT_CONVERSION = NO; 366 | GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = NO; 367 | GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; 368 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 369 | GCC_WARN_INHIBIT_ALL_WARNINGS = NO; 370 | GCC_WARN_PEDANTIC = NO; 371 | GCC_WARN_SHADOW = NO; 372 | INFOPLIST_FILE = "ShiftIt-Info.plist"; 373 | INSTALL_PATH = "$(HOME)/Applications"; 374 | OTHER_CFLAGS = ""; 375 | OTHER_LDFLAGS = ""; 376 | PRODUCT_NAME = ShiftIt; 377 | SDKROOT = ""; 378 | WARNING_CFLAGS = "-DNDEBUG"; 379 | }; 380 | name = Debug; 381 | }; 382 | C01FCF4C08A954540054247B /* Release */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | ALWAYS_SEARCH_USER_PATHS = NO; 386 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | FRAMEWORK_SEARCH_PATHS = ( 389 | "\"$(SRCROOT)/build/Release\"", 390 | "\"$(SRCROOT)\"", 391 | ); 392 | GCC_MODEL_TUNING = G5; 393 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 394 | GCC_PREFIX_HEADER = ShiftIt_Prefix.pch; 395 | GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = ""; 396 | GCC_WARN_64_TO_32_BIT_CONVERSION = NO; 397 | GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = NO; 398 | GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; 399 | GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; 400 | GCC_WARN_INHIBIT_ALL_WARNINGS = NO; 401 | GCC_WARN_PEDANTIC = NO; 402 | GCC_WARN_SHADOW = NO; 403 | INFOPLIST_FILE = "ShiftIt-Info.plist"; 404 | INSTALL_PATH = "$(HOME)/Applications"; 405 | OTHER_CFLAGS = "-DNDEBUG"; 406 | OTHER_LDFLAGS = ""; 407 | PRODUCT_NAME = ShiftIt; 408 | SDKROOT = ""; 409 | WARNING_CFLAGS = "-DNDEBUG"; 410 | }; 411 | name = Release; 412 | }; 413 | C01FCF4F08A954540054247B /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 417 | FRAMEWORK_SEARCH_PATHS = .; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_OPTIMIZATION_LEVEL = 0; 420 | GCC_VERSION = ""; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 422 | GCC_WARN_UNUSED_VARIABLE = YES; 423 | IBC_OVERRIDING_PLUGINS_AND_FRAMEWORKS_DIR = ""; 424 | IBC_PLUGINS = ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin; 425 | IBC_PLUGIN_SEARCH_PATHS = ""; 426 | LD_RUNPATH_SEARCH_PATHS = ""; 427 | MACOSX_DEPLOYMENT_TARGET = 10.7; 428 | ONLY_ACTIVE_ARCH = YES; 429 | OTHER_CFLAGS = ""; 430 | OTHER_LDFLAGS = ""; 431 | PREBINDING = NO; 432 | SDKROOT = ""; 433 | }; 434 | name = Debug; 435 | }; 436 | C01FCF5008A954540054247B /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 440 | FRAMEWORK_SEARCH_PATHS = .; 441 | GCC_C_LANGUAGE_STANDARD = gnu99; 442 | GCC_VERSION = ""; 443 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 444 | GCC_WARN_UNUSED_VARIABLE = YES; 445 | IBC_PLUGINS = ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin; 446 | MACOSX_DEPLOYMENT_TARGET = 10.7; 447 | ONLY_ACTIVE_ARCH = YES; 448 | OTHER_CFLAGS = "-DNDEBUG"; 449 | OTHER_LDFLAGS = ""; 450 | PREBINDING = NO; 451 | SDKROOT = ""; 452 | }; 453 | name = Release; 454 | }; 455 | /* End XCBuildConfiguration section */ 456 | 457 | /* Begin XCConfigurationList section */ 458 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "ShiftIt" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | C01FCF4B08A954540054247B /* Debug */, 462 | C01FCF4C08A954540054247B /* Release */, 463 | ); 464 | defaultConfigurationIsVisible = 0; 465 | defaultConfigurationName = Release; 466 | }; 467 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ShiftIt" */ = { 468 | isa = XCConfigurationList; 469 | buildConfigurations = ( 470 | C01FCF4F08A954540054247B /* Debug */, 471 | C01FCF5008A954540054247B /* Release */, 472 | ); 473 | defaultConfigurationIsVisible = 0; 474 | defaultConfigurationName = Release; 475 | }; 476 | /* End XCConfigurationList section */ 477 | }; 478 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 479 | } 480 | -------------------------------------------------------------------------------- /ShiftIt/PreferencesWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1070 5 | 11D50d 6 | 2182 7 | 1138.32 8 | 568.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2182 12 | 13 | 14 | NSView 15 | NSBox 16 | NSWindowTemplate 17 | NSTextField 18 | NSTextFieldCell 19 | NSCustomView 20 | NSButtonCell 21 | NSButton 22 | NSUserDefaultsController 23 | NSCustomObject 24 | 25 | 26 | com.apple.InterfaceBuilder.CocoaPlugin 27 | 28 | 29 | PluginDependencyRecalculationVersion 30 | 31 | 32 | 33 | 34 | PreferencesWindowController 35 | 36 | 37 | FirstResponder 38 | 39 | 40 | NSApplication 41 | 42 | 43 | 3 44 | 2 45 | {{488, 178}, {303, 288}} 46 | 544735232 47 | Preferences 48 | NSWindow 49 | 50 | 51 | 52 | 53 | 256 54 | 55 | 56 | 57 | 256 58 | 59 | 60 | 61 | 268 62 | {{167, 251}, {113, 18}} 63 | 64 | 65 | 66 | 2 67 | YES 68 | 69 | -2080244224 70 | 0 71 | Open At Login 72 | 73 | LucidaGrande 74 | 13 75 | 1044 76 | 77 | 78 | 1211912703 79 | 2 80 | 81 | NSImage 82 | NSSwitch 83 | 84 | 85 | NSSwitch 86 | 87 | 88 | 89 | 200 90 | 25 91 | 92 | 93 | 94 | 95 | 268 96 | {{21, 251}, {134, 18}} 97 | 98 | 99 | 100 | 2 101 | YES 102 | 103 | -2080244224 104 | 0 105 | Show In Menu Bar 106 | 107 | 108 | 1211912703 109 | 2 110 | 111 | 112 | 113 | 114 | 200 115 | 25 116 | 117 | 118 | 119 | 120 | 268 121 | {{-3, 275}, {309, 19}} 122 | 123 | 124 | 125 | 2 126 | YES 127 | 128 | 68288064 129 | 138413056 130 | ShiftIt 131 | 132 | LucidaGrande-Bold 133 | 16 134 | 16 135 | 136 | 137 | 138 | 6 139 | System 140 | controlColor 141 | 142 | 3 143 | MC42NjY2NjY2NjY3AA 144 | 145 | 146 | 147 | 6 148 | System 149 | controlTextColor 150 | 151 | 3 152 | MAA 153 | 154 | 155 | 156 | 157 | 158 | 159 | 12 160 | 161 | 162 | 163 | 274 164 | 165 | 166 | 167 | 268 168 | {{45, 173}, {65, 17}} 169 | 170 | 171 | 172 | 2 173 | 100 174 | YES 175 | 176 | 68288064 177 | 71304192 178 | Left 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 268 188 | {{45, 149}, {65, 17}} 189 | 190 | 191 | 192 | 2 193 | YES 194 | 195 | 68288064 196 | 71304192 197 | Right 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 268 207 | {{45, 125}, {65, 17}} 208 | 209 | 210 | 211 | 2 212 | YES 213 | 214 | 68288064 215 | 71304192 216 | Top 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 268 226 | {{45, 101}, {65, 17}} 227 | 228 | 229 | 230 | 2 231 | YES 232 | 233 | 68288064 234 | 71304192 235 | Bottom 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 268 245 | {{37, 71}, {73, 17}} 246 | 247 | 248 | 249 | 2 250 | YES 251 | 252 | 68288064 253 | 71304192 254 | Full Screen 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 268 264 | {{45, 47}, {65, 17}} 265 | 266 | 267 | 268 | 2 269 | YES 270 | 271 | 68288064 272 | 71304192 273 | Center 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 268 283 | {{27, 17}, {83, 17}} 284 | 285 | 286 | 287 | 2 288 | YES 289 | 290 | 68288064 291 | 71304192 292 | Swap Screen 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 298 302 | {{115, 170}, {120, 22}} 303 | 304 | 305 | 306 | 2 307 | NSControl 308 | 309 | 310 | 311 | 298 312 | {{115, 146}, {120, 22}} 313 | 314 | 315 | 316 | 2 317 | NSControl 318 | 319 | 320 | 321 | 298 322 | {{115, 122}, {120, 22}} 323 | 324 | 325 | 326 | 2 327 | NSControl 328 | 329 | 330 | 331 | 298 332 | {{115, 98}, {120, 22}} 333 | 334 | 335 | 336 | 2 337 | NSControl 338 | 339 | 340 | 341 | 298 342 | {{115, 68}, {120, 22}} 343 | 344 | 345 | 346 | 2 347 | NSControl 348 | 349 | 350 | 351 | 298 352 | {{115, 44}, {120, 22}} 353 | 354 | 355 | 356 | 2 357 | NSControl 358 | 359 | 360 | 361 | 298 362 | {{115, 14}, {120, 22}} 363 | 364 | 365 | 366 | 2 367 | NSControl 368 | 369 | 370 | {{1, 1}, {264, 204}} 371 | 372 | 373 | 374 | _NS:11 375 | 376 | 377 | {{17, 37}, {266, 206}} 378 | 379 | 380 | 381 | _NS:9 382 | {0, 0} 383 | 384 | 67239424 385 | 0 386 | Box 387 | 388 | LucidaGrande 389 | 11 390 | 3100 391 | 392 | 393 | 6 394 | System 395 | textBackgroundColor 396 | 397 | 3 398 | MQA 399 | 400 | 401 | 402 | 3 403 | MCAwLjgwMDAwMDAxMTkAA 404 | 405 | 406 | 407 | 1 408 | 0 409 | 0 410 | NO 411 | 412 | 413 | {{0, -20}, {303, 308}} 414 | 415 | 416 | 417 | 2 418 | 419 | 420 | {303, 288} 421 | 422 | 423 | 424 | 2 425 | 426 | {{0, 0}, {1280, 778}} 427 | {10000000000000, 10000000000000} 428 | YES 429 | 430 | 431 | YES 432 | 433 | 434 | 435 | 436 | 437 | 438 | window 439 | 440 | 441 | 442 | 242 443 | 444 | 445 | 446 | view 447 | 448 | 449 | 450 | 682 451 | 452 | 453 | 454 | titleLabel 455 | 456 | 457 | 458 | 685 459 | 460 | 461 | 462 | delegate 463 | 464 | 465 | 466 | 241 467 | 468 | 469 | 470 | initialFirstResponder 471 | 472 | 473 | 474 | 327 475 | 476 | 477 | 478 | value: shouldStartAtLogin 479 | 480 | 481 | 482 | 483 | 484 | value: shouldStartAtLogin 485 | value 486 | shouldStartAtLogin 487 | 2 488 | 489 | 490 | 639 491 | 492 | 493 | 494 | value: values.shiftItshowMenu 495 | 496 | 497 | 498 | 499 | 500 | value: values.shiftItshowMenu 501 | value 502 | values.shiftItshowMenu 503 | 2 504 | 505 | 506 | 638 507 | 508 | 509 | 510 | 511 | 512 | 0 513 | 514 | 515 | 516 | 517 | 518 | -2 519 | 520 | 521 | File's Owner 522 | 523 | 524 | -1 525 | 526 | 527 | First Responder 528 | 529 | 530 | -3 531 | 532 | 533 | Application 534 | 535 | 536 | 1 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 2 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 191 553 | 554 | 555 | 556 | 557 | 629 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 632 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 635 577 | 578 | 579 | 580 | 581 | 633 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 634 590 | 591 | 592 | 593 | 594 | 719 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 631 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 636 624 | 625 | 626 | 627 | 628 | 661 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 681 637 | 638 | 639 | 640 | 641 | 662 642 | 643 | 644 | sr_swapscreen 645 | 646 | 647 | 663 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 680 656 | 657 | 658 | 659 | 660 | 664 661 | 662 | 663 | sr_bottom 664 | 665 | 666 | 665 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 679 675 | 676 | 677 | 678 | 679 | 666 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 678 688 | 689 | 690 | 691 | 692 | 667 693 | 694 | 695 | 696 | sr_center 697 | 698 | 699 | 668 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 677 708 | 709 | 710 | 711 | 712 | 669 713 | 714 | 715 | sr_right 716 | 717 | 718 | 670 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 676 727 | 728 | 729 | 730 | 731 | 671 732 | 733 | 734 | sr_left 735 | 736 | 737 | 672 738 | 739 | 740 | sr_top 741 | 742 | 743 | 673 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 675 752 | 753 | 754 | 755 | 756 | 674 757 | 758 | 759 | sr_fullscreen 760 | 761 | 762 | 763 | 764 | com.apple.InterfaceBuilder.CocoaPlugin 765 | com.apple.InterfaceBuilder.CocoaPlugin 766 | com.apple.InterfaceBuilder.CocoaPlugin 767 | com.apple.InterfaceBuilder.CocoaPlugin 768 | {{312, 138}, {303, 366}} 769 | 770 | com.apple.InterfaceBuilder.CocoaPlugin 771 | com.apple.InterfaceBuilder.CocoaPlugin 772 | com.apple.InterfaceBuilder.CocoaPlugin 773 | 774 | 775 | 776 | 777 | com.apple.InterfaceBuilder.CocoaPlugin 778 | com.apple.InterfaceBuilder.CocoaPlugin 779 | com.apple.InterfaceBuilder.CocoaPlugin 780 | com.apple.InterfaceBuilder.CocoaPlugin 781 | com.apple.InterfaceBuilder.CocoaPlugin 782 | com.apple.InterfaceBuilder.CocoaPlugin 783 | com.apple.InterfaceBuilder.CocoaPlugin 784 | 785 | IBUserDefinedRuntimeAttributesPlaceholderName 786 | 787 | IBUserDefinedRuntimeAttributesPlaceholderName 788 | 789 | 790 | 791 | com.apple.InterfaceBuilder.userDefinedRuntimeAttributeType.number 792 | tag 793 | 794 | 795 | 796 | 797 | 798 | com.apple.InterfaceBuilder.CocoaPlugin 799 | com.apple.InterfaceBuilder.CocoaPlugin 800 | 801 | IBUserDefinedRuntimeAttributesPlaceholderName 802 | 803 | IBUserDefinedRuntimeAttributesPlaceholderName 804 | 805 | 806 | 807 | com.apple.InterfaceBuilder.userDefinedRuntimeAttributeType.number 808 | tag 809 | 810 | 811 | 812 | 813 | 814 | com.apple.InterfaceBuilder.CocoaPlugin 815 | com.apple.InterfaceBuilder.CocoaPlugin 816 | com.apple.InterfaceBuilder.CocoaPlugin 817 | 818 | IBUserDefinedRuntimeAttributesPlaceholderName 819 | 820 | IBUserDefinedRuntimeAttributesPlaceholderName 821 | 822 | 823 | 824 | com.apple.InterfaceBuilder.userDefinedRuntimeAttributeType.number 825 | tag 826 | 827 | 828 | 829 | 830 | 831 | com.apple.InterfaceBuilder.CocoaPlugin 832 | com.apple.InterfaceBuilder.CocoaPlugin 833 | 834 | IBUserDefinedRuntimeAttributesPlaceholderName 835 | 836 | IBUserDefinedRuntimeAttributesPlaceholderName 837 | 838 | 839 | 840 | com.apple.InterfaceBuilder.userDefinedRuntimeAttributeType.number 841 | tag 842 | 843 | 844 | 845 | 846 | 847 | com.apple.InterfaceBuilder.CocoaPlugin 848 | com.apple.InterfaceBuilder.CocoaPlugin 849 | 850 | IBUserDefinedRuntimeAttributesPlaceholderName 851 | 852 | IBUserDefinedRuntimeAttributesPlaceholderName 853 | 854 | 855 | 856 | com.apple.InterfaceBuilder.userDefinedRuntimeAttributeType.number 857 | tag 858 | 859 | 860 | 861 | 862 | 863 | com.apple.InterfaceBuilder.CocoaPlugin 864 | 865 | IBUserDefinedRuntimeAttributesPlaceholderName 866 | 867 | IBUserDefinedRuntimeAttributesPlaceholderName 868 | 869 | 870 | 871 | com.apple.InterfaceBuilder.userDefinedRuntimeAttributeType.number 872 | tag 873 | 874 | 875 | 876 | 877 | 878 | com.apple.InterfaceBuilder.CocoaPlugin 879 | com.apple.InterfaceBuilder.CocoaPlugin 880 | 881 | IBUserDefinedRuntimeAttributesPlaceholderName 882 | 883 | IBUserDefinedRuntimeAttributesPlaceholderName 884 | 885 | 886 | 887 | com.apple.InterfaceBuilder.userDefinedRuntimeAttributeType.number 888 | tag 889 | 890 | 891 | 892 | 893 | 894 | com.apple.InterfaceBuilder.CocoaPlugin 895 | com.apple.InterfaceBuilder.CocoaPlugin 896 | com.apple.InterfaceBuilder.CocoaPlugin 897 | com.apple.InterfaceBuilder.CocoaPlugin 898 | com.apple.InterfaceBuilder.CocoaPlugin 899 | com.apple.InterfaceBuilder.CocoaPlugin 900 | com.apple.InterfaceBuilder.CocoaPlugin 901 | com.apple.InterfaceBuilder.CocoaPlugin 902 | com.apple.InterfaceBuilder.CocoaPlugin 903 | 904 | 905 | 906 | 907 | 908 | 719 909 | 910 | 911 | 912 | 913 | PreferencesWindowController 914 | NSWindowController 915 | 916 | NSTextField 917 | NSView 918 | 919 | 920 | 921 | titleLabel 922 | NSTextField 923 | 924 | 925 | view 926 | NSView 927 | 928 | 929 | 930 | IBProjectSource 931 | ./Classes/PreferencesWindowController.h 932 | 933 | 934 | 935 | 936 | 0 937 | IBCocoaFramework 938 | 939 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 940 | 941 | 942 | YES 943 | 3 944 | 945 | NSSwitch 946 | {15, 15} 947 | 948 | 949 | 950 | --------------------------------------------------------------------------------