1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-10 17:08:39 +00:00

fix reversed "hide control strip" menu checkmark beaviour

This commit is contained in:
Serg 2018-10-13 13:22:11 +07:00
parent b368a21f62
commit 85d54e4f53
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)