Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit a97b723

Browse files
committed
Try MAS Again
1 parent b4f5bfc commit a97b723

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

Dynamic/Supporting Files/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>1.0</string>
2121
<key>CFBundleVersion</key>
22-
<string>0</string>
22+
<string>1</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.utilities</string>
2525
<key>LSMinimumSystemVersion</key>

Dynamic/View Controller/AppDelegate.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3131
}
3232

3333
// Command-Shift-T
34-
let event = NSEvent.keyEvent(with: .keyDown, location: .zero, modifierFlags: [.command, .shift], timestamp: 0, windowNumber: 0, context: nil, characters: "T", charactersIgnoringModifiers: "t", isARepeat: false, keyCode: UInt16(kVK_ANSI_T))
35-
let shortcut = MASShortcut(event: event)
36-
let shortcuts = [preferences.toggleShortcutKey: shortcut!]
37-
MASShortcutBinder.shared()?.registerDefaultShortcuts(shortcuts)
3834
MASShortcutBinder.shared()?.bindShortcut(
3935
withDefaultsKey: preferences.toggleShortcutKey,
4036
toAction: toggleInterfaceStyle
@@ -147,4 +143,11 @@ func start() {
147143
AppleScript.setupIfNeeded()
148144
_ = ScreenBrightnessObserver.shared
149145
}
146+
guard preferences.value(forKey: preferences.toggleShortcutKey) == nil else { return }
147+
let event = NSEvent.keyEvent(with: .keyDown, location: .zero, modifierFlags: [.command, .shift], timestamp: 0, windowNumber: 0, context: nil, characters: "T", charactersIgnoringModifiers: "t", isARepeat: false, keyCode: UInt16(kVK_ANSI_T))
148+
let shortcut = MASShortcut(event: event)!
149+
let shortcuts = [preferences.toggleShortcutKey: shortcut]
150+
MASShortcutBinder.shared()?.registerDefaultShortcuts(shortcuts)
151+
let data = try! NSKeyedArchiver.archivedData(withRootObject: shortcut, requiringSecureCoding: true)
152+
preferences.set(data, forKey: preferences.toggleShortcutKey)
150153
}

Dynamic/View Controller/Base.lproj/Main.storyboard

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@
686686
<objects>
687687
<windowController storyboardIdentifier="window" showSeguePresentationStyle="single" id="cXd-3X-aO4" sceneMemberID="viewController">
688688
<window key="window" title="Dynamic" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="ZWC-1W-uDl">
689-
<windowStyleMask key="styleMask" titled="YES" texturedBackground="YES" fullSizeContentView="YES"/>
689+
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" texturedBackground="YES" fullSizeContentView="YES"/>
690690
<rect key="contentRect" x="163" y="199" width="480" height="270"/>
691691
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
692692
<connections>
@@ -705,8 +705,8 @@
705705
<scene sceneID="nDq-M4-5lX">
706706
<objects>
707707
<windowController storyboardIdentifier="setup" showSeguePresentationStyle="single" id="E5A-g3-bTg" customClass="Welcome" customModule="Dynamic" customModuleProvider="target" sceneMemberID="viewController">
708-
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="T1i-3L-V9g">
709-
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" texturedBackground="YES"/>
708+
<window key="window" title="Setup" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="T1i-3L-V9g">
709+
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" texturedBackground="YES" fullSizeContentView="YES"/>
710710
<rect key="contentRect" x="163" y="199" width="480" height="270"/>
711711
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
712712
<connections>
@@ -980,10 +980,10 @@ DQ
980980
<rect key="frame" x="0.0" y="0.0" width="534" height="336"/>
981981
<subviews>
982982
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mbn-Aa-NsX">
983-
<rect key="frame" x="350" y="13" width="100" height="32"/>
984-
<buttonCell key="cell" type="push" title="Quit (⌘Q)" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="vzJ-gO-E1h">
985-
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
986-
<font key="font" metaFont="system"/>
983+
<rect key="frame" x="20" y="19" width="73" height="19"/>
984+
<buttonCell key="cell" type="recessed" title="Quit (⌘Q)" bezelStyle="recessed" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="vzJ-gO-E1h">
985+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
986+
<font key="font" metaFont="systemBold" size="12"/>
987987
<string key="keyEquivalent">q</string>
988988
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
989989
</buttonCell>
@@ -996,6 +996,9 @@ DQ
996996
<buttonCell key="cell" type="push" title="Save" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="4NB-3a-2UR">
997997
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
998998
<font key="font" metaFont="system"/>
999+
<string key="keyEquivalent" base64-UTF8="YES">
1000+
DQ
1001+
</string>
9991002
</buttonCell>
10001003
<connections>
10011004
<action selector="close:" target="2dW-oa-vyd" id="IeT-ID-Z24"/>
@@ -1004,8 +1007,7 @@ DQ
10041007
</subviews>
10051008
<constraints>
10061009
<constraint firstAttribute="trailing" secondItem="7JC-il-y7k" secondAttribute="trailing" constant="20" symbolic="YES" id="8dt-Ic-EoO"/>
1007-
<constraint firstItem="mbn-Aa-NsX" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="8Qe-wF-aDU" secondAttribute="leading" constant="20" symbolic="YES" id="GLd-0X-oNS"/>
1008-
<constraint firstItem="7JC-il-y7k" firstAttribute="leading" secondItem="mbn-Aa-NsX" secondAttribute="trailing" constant="12" symbolic="YES" id="O1m-oO-anL"/>
1010+
<constraint firstItem="mbn-Aa-NsX" firstAttribute="leading" secondItem="8Qe-wF-aDU" secondAttribute="leading" constant="20" symbolic="YES" id="GLd-0X-oNS"/>
10091011
<constraint firstAttribute="bottom" secondItem="mbn-Aa-NsX" secondAttribute="bottom" constant="20" id="fXU-J8-Vjt"/>
10101012
<constraint firstAttribute="bottom" secondItem="7JC-il-y7k" secondAttribute="bottom" constant="20" symbolic="YES" id="nlV-hZ-azm"/>
10111013
</constraints>
@@ -1021,7 +1023,7 @@ DQ
10211023
<gridView xPlacement="fill" yPlacement="fill" rowAlignment="none" rowSpacing="8" columnSpacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="YVR-sd-FzV">
10221024
<rect key="frame" x="0.0" y="61" width="514" height="211"/>
10231025
<constraints>
1024-
<constraint firstAttribute="height" constant="211" id="Wgj-9p-eMY"/>
1026+
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="211" id="Wgj-9p-eMY"/>
10251027
</constraints>
10261028
<rows>
10271029
<gridRow id="0p6-ny-XqA"/>

0 commit comments

Comments
 (0)