diff --git a/MTMR/AppDelegate.swift b/MTMR/AppDelegate.swift index 5ce03ed..ada059a 100644 --- a/MTMR/AppDelegate.swift +++ b/MTMR/AppDelegate.swift @@ -46,7 +46,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { } @objc func toggleControlStrip(_ sender: Any?) { - TouchBarController.shared.controlStripState = !TouchBarController.shared.controlStripState + TouchBarController.shared.showControlStripState = !TouchBarController.shared.showControlStripState createMenu() TouchBarController.shared.resetControlStrip() } @@ -96,7 +96,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { startAtLogin.state = LaunchAtLoginController().launchAtLogin ? .on : .off let hideControlStrip = NSMenuItem(title: "Hide Control Strip", action: #selector(toggleControlStrip(_:)), keyEquivalent: "T") - hideControlStrip.state = TouchBarController.shared.controlStripState ? .on : .off + hideControlStrip.state = TouchBarController.shared.showControlStripState ? .off : .on let settingSeparator = NSMenuItem(title: "Settings", action: nil, keyEquivalent: "") settingSeparator.isEnabled = false diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift index 8023bb0..95c8a6a 100644 --- a/MTMR/TouchBarController.swift +++ b/MTMR/TouchBarController.swift @@ -74,12 +74,12 @@ class TouchBarController: NSObject, NSTouchBarDelegate { var scrollArea: NSCustomTouchBarItem? var centerScrollArea = NSTouchBarItem.Identifier("com.toxblh.mtmr.scrollArea.".appending(UUID().uuidString)) - var controlStripState: Bool { + var showControlStripState: Bool { get { return UserDefaults.standard.bool(forKey: "com.toxblh.mtmr.settings.showControlStrip") } set { - UserDefaults.standard.set(!controlStripState, forKey: "com.toxblh.mtmr.settings.showControlStrip") + UserDefaults.standard.set(newValue, forKey: "com.toxblh.mtmr.settings.showControlStrip") } } @@ -216,7 +216,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate { @objc private func presentTouchBar() { if touchbarNeedRefresh { - if self.controlStripState { + if self.showControlStripState { presentSystemModal(touchBar, systemTrayItemIdentifier: .controlStripItem) } else { presentSystemModal(touchBar, placement: 1, systemTrayItemIdentifier: .controlStripItem) diff --git a/MTMR/Widgets/GroupBarItem.swift b/MTMR/Widgets/GroupBarItem.swift index 3eac647..cc5fd49 100644 --- a/MTMR/Widgets/GroupBarItem.swift +++ b/MTMR/Widgets/GroupBarItem.swift @@ -55,7 +55,7 @@ class GroupBarItem: NSPopoverTouchBarItem, NSTouchBarDelegate { TouchBarController.shared.touchBar.defaultItemIdentifiers = [] TouchBarController.shared.touchBar.defaultItemIdentifiers = self.leftIdentifiers + [centerScrollArea] + self.rightIdentifiers - if TouchBarController.shared.controlStripState { + if TouchBarController.shared.showControlStripState { presentSystemModal(TouchBarController.shared.touchBar, systemTrayItemIdentifier: .controlStripItem) } else { presentSystemModal(TouchBarController.shared.touchBar, placement: 1, systemTrayItemIdentifier: .controlStripItem)