Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some great new features for ultra wide monitors #311

Merged
merged 2 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 44 additions & 14 deletions ShiftIt/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16096" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16096"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand All @@ -11,7 +11,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="494" customClass="ShiftItAppDelegate">
<connections>
<outlet property="statusMenu_" destination="535" id="789"/>
Expand Down Expand Up @@ -45,31 +45,60 @@
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="780"/>
<menuItem title="Center" tag="2009" keyEquivalent="c" id="537">
<menuItem title="Left Third Top" tag="2009" keyEquivalent="u" id="bYc-Bv-i87" userLabel="Left Third Top">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Toggle Zoom" tag="2010" keyEquivalent="z" id="791">
<menuItem title="Left Third Bottom" tag="2010" keyEquivalent="j" id="rsR-hX-aGC" userLabel="Left Third Bottom">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Maximize" tag="2011" keyEquivalent="m" id="792">
<menuItem title="Center Third Top" tag="2011" keyEquivalent="i" id="Kde-dw-26m" userLabel="Center Third Top">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Toggle Full Screen" tag="2012" keyEquivalent="f" id="545">
<menuItem title="Center Third Bottom" tag="2012" keyEquivalent="k" id="UKu-YS-Z99" userLabel="Center Third Bottom">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Right Third Top" tag="2013" keyEquivalent="o" id="jxH-mM-wG5" userLabel="Right Third Top">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Right Third Bottom" tag="2014" keyEquivalent="l" id="GEI-WN-flk" userLabel="Right Third Bottom">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="qWg-NF-P0c"/>
<menuItem title="Left Third" tag="2015" keyEquivalent="q" id="WF1-Yp-cEQ" userLabel="Left Third">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Center Third" tag="2016" keyEquivalent="w" id="5Af-dm-SQu" userLabel="Center Third">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Right Third" tag="2017" keyEquivalent="e" id="1Dg-Ca-mPq" userLabel="Right Third">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="lzs-6S-vAY"/>
<menuItem title="Center" tag="2018" keyEquivalent="c" id="537">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Toggle Zoom" tag="2019" keyEquivalent="z" id="791">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Maximize" tag="2020" keyEquivalent="m" id="792">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Toggle Full Screen" tag="2021" keyEquivalent="f" id="545">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="538"/>
<menuItem title="Increase" tag="2013" keyEquivalent="=" id="786">
<menuItem title="Increase" tag="2022" keyEquivalent="=" id="786">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Reduce" tag="2014" keyEquivalent="-" id="787">
<menuItem title="Reduce" tag="2023" keyEquivalent="-" id="787">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="788"/>
<menuItem title="Next Screen" tag="2015" keyEquivalent="n" id="794">
<menuItem title="Next Screen" tag="2024" keyEquivalent="n" id="794">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem title="Previous Screen" tag="2016" id="URi-Kh-uDb">
<modifierMask key="keyEquivalentModifierMask"/>
<menuItem title="Previous Screen" tag="2025" keyEquivalent="p" id="URi-Kh-uDb">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="793"/>
<menuItem title="Preferences" keyEquivalent="," id="558">
Expand All @@ -89,6 +118,7 @@
</connections>
</menuItem>
</items>
<point key="canvasLocation" x="0.0" y="17"/>
</menu>
<customObject id="670" customClass="SUUpdater">
<connections>
Expand Down
9 changes: 9 additions & 0 deletions ShiftIt/DefaultShiftItActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ const extern SimpleWindowGeometryChangeBlock shiftItBottomLeft;
const extern SimpleWindowGeometryChangeBlock shiftItBottomRight;
const extern SimpleWindowGeometryChangeBlock shiftItFullScreen;
const extern SimpleWindowGeometryChangeBlock shiftItCenter;
const extern SimpleWindowGeometryChangeBlock shiftItThirdTopLeft;
const extern SimpleWindowGeometryChangeBlock shiftItThirdBottomLeft;
const extern SimpleWindowGeometryChangeBlock shiftItThirdTopCenter;
const extern SimpleWindowGeometryChangeBlock shiftItThirdBottomCenter;
const extern SimpleWindowGeometryChangeBlock shiftItThirdTopRight;
const extern SimpleWindowGeometryChangeBlock shiftItThirdBottomRight;
const extern SimpleWindowGeometryChangeBlock shiftItThirdLeft;
const extern SimpleWindowGeometryChangeBlock shiftItThirdCenter;
const extern SimpleWindowGeometryChangeBlock shiftItThirdRight;

@interface IncreaseReduceShiftItAction : AbstractWindowGeometryShiftItAction {
@private
Expand Down
108 changes: 108 additions & 0 deletions ShiftIt/DefaultShiftItActions.m
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,114 @@ BOOL rectCloseTo(NSRect a, NSRect b) {
return MakeAnchoredRect(r, 0);
};

const SimpleWindowGeometryChangeBlock shiftItThirdTopLeft = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = 0;
r.origin.y = 0;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height / 2;

return MakeAnchoredRect(r, kTopDirection | kLeftDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdBottomLeft = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = 0;
r.origin.y = screenSize.height / 2;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height / 2;

return MakeAnchoredRect(r, kBottomDirection | kLeftDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdTopCenter = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = screenSize.width - ((screenSize.width / 3) * 2);
r.origin.y = 0;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height / 2;

return MakeAnchoredRect(r, kTopDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdBottomCenter = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = screenSize.width - ((screenSize.width / 3) * 2);
r.origin.y = screenSize.height / 2;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height / 2;

return MakeAnchoredRect(r, kBottomDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdTopRight = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = screenSize.width - ((screenSize.width / 3) * 1);
r.origin.y = 0;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height / 2;

return MakeAnchoredRect(r, kTopDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdBottomRight = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = screenSize.width - (screenSize.width / 3);
r.origin.y = screenSize.height / 2;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height / 2;

return MakeAnchoredRect(r, kBottomDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdLeft = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = 0;
r.origin.y = 0;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height;

return MakeAnchoredRect(r, kLeftDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdCenter = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = screenSize.width - ((screenSize.width / 3) * 2);
r.origin.y = 0;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height;

return MakeAnchoredRect(r, kTopDirection);
};

const SimpleWindowGeometryChangeBlock shiftItThirdRight = ^AnchoredRect(NSRect windowRect, NSSize screenSize) {
NSRect r = NSMakeRect(0, 0, 0, 0);

r.origin.x = screenSize.width - (screenSize.width / 3);
r.origin.y = 0;

r.size.width = screenSize.width / 3;
r.size.height = screenSize.height;

return MakeAnchoredRect(r, kTopDirection);
};

@implementation IncreaseReduceShiftItAction

- (id)initWithMode:(BOOL)increase {
Expand Down
13 changes: 12 additions & 1 deletion ShiftIt/PreferencesWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ - (void)setShouldStartAtLogin:(BOOL)flag {
@"bl",
@"br",
NULL,
@"ltt",
@"ltb",
@"ctt",
@"ctb",
@"rtt",
@"rtb",
NULL,
@"lt",
@"ct",
@"rt",
NULL,
@"center",
@"zoom",
@"maximize",
Expand All @@ -203,7 +214,7 @@ - (void)setShouldStartAtLogin:(BOOL)flag {
@"reduce",
NULL,
@"nextscreen",
@"previousscreen",
@"previousscreen"
};

- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
Expand Down
54 changes: 54 additions & 0 deletions ShiftIt/ShiftIt-defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,60 @@
<integer>24</integer>
<key>increaseModifiers</key>
<integer>1835008</integer>
<key>lttKeyCode</key>
<integer>32</integer>
<key>lttMargin</key>
<integer>0</integer>
<key>lttModifiers</key>
<integer>3932160</integer>
<key>ltbKeyCode</key>
<integer>38</integer>
<key>ltbMargin</key>
<integer>0</integer>
<key>ltbModifiers</key>
<integer>3932160</integer>
<key>ctbKeyCode</key>
<integer>40</integer>
<key>ctbMargin</key>
<integer>0</integer>
<key>ctbModifiers</key>
<integer>3932160</integer>
<key>cttKeyCode</key>
<integer>34</integer>
<key>cttMargin</key>
<integer>0</integer>
<key>cttModifiers</key>
<integer>3932160</integer>
<key>rttKeyCode</key>
<integer>31</integer>
<key>rttMargin</key>
<integer>0</integer>
<key>rttModifiers</key>
<integer>3932160</integer>
<key>rtbKeyCode</key>
<integer>37</integer>
<key>rtbMargin</key>
<integer>0</integer>
<key>rtbModifiers</key>
<integer>3932160</integer>
<key>ltKeyCode</key>
<integer>12</integer>
<key>ltMargin</key>
<integer>0</integer>
<key>ltModifiers</key>
<integer>3932160</integer>
<key>ctKeyCode</key>
<integer>13</integer>
<key>ctMargin</key>
<integer>0</integer>
<key>ctModifiers</key>
<integer>3932160</integer>
<key>rtKeyCode</key>
<integer>14</integer>
<key>rtMargin</key>
<integer>0</integer>
<key>rtModifiers</key>
<integer>3932160</integer>
<key>leftKeyCode</key>
<integer>123</integer>
<key>leftMargin</key>
Expand Down
25 changes: 17 additions & 8 deletions ShiftIt/ShiftItAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -584,14 +584,23 @@ - (void)initializeActions_ {
REGISTER_ACTION(dict, @"tr", NSLocalizedString(@"Top Right", nil), 6, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItTopRight] autorelease]);
REGISTER_ACTION(dict, @"bl", NSLocalizedString(@"Bottom Left", nil), 7, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItBottomLeft] autorelease]);
REGISTER_ACTION(dict, @"br", NSLocalizedString(@"Bottom Right", nil), 8, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItBottomRight] autorelease]);
REGISTER_ACTION(dict, @"center", NSLocalizedString(@"Center", nil), 9, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItCenter] autorelease]);
REGISTER_ACTION(dict, @"zoom", NSLocalizedString(@"Toggle Zoom", nil), 10, [[[ToggleZoomShiftItAction alloc] init] autorelease]);
REGISTER_ACTION(dict, @"maximize", NSLocalizedString(@"Maximize", nil), 11, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItFullScreen] autorelease]);
REGISTER_ACTION(dict, @"fullScreen", NSLocalizedString(@"Toggle Full Screen", nil), 12, [[[ToggleFullScreenShiftItAction alloc] init] autorelease]);
REGISTER_ACTION(dict, @"increase", NSLocalizedString(@"Increase", nil), 13, [[[IncreaseReduceShiftItAction alloc] initWithMode:YES] autorelease]);
REGISTER_ACTION(dict, @"reduce", NSLocalizedString(@"Reduce", nil), 14, [[[IncreaseReduceShiftItAction alloc] initWithMode:NO] autorelease]);
REGISTER_ACTION(dict, @"nextscreen", NSLocalizedString(@"Next Screen", nil), 15, [[[ScreenChangeShiftItAction alloc] initWithMode:YES] autorelease]);
REGISTER_ACTION(dict, @"previousscreen", NSLocalizedString(@"Previous Screen", nil), 16, [[[ScreenChangeShiftItAction alloc] initWithMode:NO] autorelease]);
REGISTER_ACTION(dict, @"ltt", NSLocalizedString(@"Left Third Top", nil), 9, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdTopLeft] autorelease]);
REGISTER_ACTION(dict, @"ltb", NSLocalizedString(@"Left Third Bottom", nil), 10, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdBottomLeft] autorelease]);
REGISTER_ACTION(dict, @"ctt", NSLocalizedString(@"Center Third Top", nil), 11, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdTopCenter] autorelease]);
REGISTER_ACTION(dict, @"ctb", NSLocalizedString(@"Center Third Bottom", nil), 12, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdBottomCenter] autorelease]);
REGISTER_ACTION(dict, @"rtt", NSLocalizedString(@"Right Third Top", nil), 13, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdTopRight] autorelease]);
REGISTER_ACTION(dict, @"rtb", NSLocalizedString(@"Right Third Bottom", nil), 14, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdBottomRight] autorelease]);
REGISTER_ACTION(dict, @"lt", NSLocalizedString(@"Left Third", nil), 15, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdLeft] autorelease]);
REGISTER_ACTION(dict, @"ct", NSLocalizedString(@"Center Third", nil), 16, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdCenter] autorelease]);
REGISTER_ACTION(dict, @"rt", NSLocalizedString(@"Right Third", nil), 17, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItThirdRight] autorelease]);
REGISTER_ACTION(dict, @"center", NSLocalizedString(@"Center", nil), 18, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItCenter] autorelease]);
REGISTER_ACTION(dict, @"zoom", NSLocalizedString(@"Toggle Zoom", nil), 19, [[[ToggleZoomShiftItAction alloc] init] autorelease]);
REGISTER_ACTION(dict, @"maximize", NSLocalizedString(@"Maximize", nil), 20, [[[WindowGeometryShiftItAction alloc] initWithBlock:shiftItFullScreen] autorelease]);
REGISTER_ACTION(dict, @"fullScreen", NSLocalizedString(@"Toggle Full Screen", nil), 21, [[[ToggleFullScreenShiftItAction alloc] init] autorelease]);
REGISTER_ACTION(dict, @"increase", NSLocalizedString(@"Increase", nil), 22, [[[IncreaseReduceShiftItAction alloc] initWithMode:YES] autorelease]);
REGISTER_ACTION(dict, @"reduce", NSLocalizedString(@"Reduce", nil), 23, [[[IncreaseReduceShiftItAction alloc] initWithMode:NO] autorelease]);
REGISTER_ACTION(dict, @"nextscreen", NSLocalizedString(@"Next Screen", nil), 24, [[[ScreenChangeShiftItAction alloc] initWithMode:YES] autorelease]);
REGISTER_ACTION(dict, @"previousscreen", NSLocalizedString(@"Previous Screen", nil), 25, [[[ScreenChangeShiftItAction alloc] initWithMode:NO] autorelease]);

#undef REGISTER_ACTION

Expand Down
Binary file modified docs/schreenshot-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.