1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-11 09:28:38 +00:00

Hide MT button from control strip when touch bar is empty

This commit is contained in:
Wiktor Latanowicz 2021-10-31 13:29:23 +01:00
parent fa63734312
commit 9542e332f5

View File

@ -294,20 +294,23 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
} }
func updateControlStripPresence() { func updateControlStripPresence() {
DFRElementSetControlStripPresenceForIdentifier(.controlStripItem, true) let showMtmrButtonOnControlStrip = touchBarContainsAnyItems()
DFRElementSetControlStripPresenceForIdentifier(.controlStripItem, showMtmrButtonOnControlStrip)
} }
@objc private func presentTouchBar() { @objc private func presentTouchBar() {
if AppSettings.showControlStripState { if AppSettings.showControlStripState {
updateControlStripPresence()
presentSystemModal(touchBar, systemTrayItemIdentifier: .controlStripItem) presentSystemModal(touchBar, systemTrayItemIdentifier: .controlStripItem)
} else { } else {
presentSystemModal(touchBar, placement: 1, systemTrayItemIdentifier: .controlStripItem) presentSystemModal(touchBar, placement: 1, systemTrayItemIdentifier: .controlStripItem)
} }
updateControlStripPresence()
} }
@objc private func dismissTouchBar() { @objc private func dismissTouchBar() {
minimizeSystemModal(touchBar) if touchBarContainsAnyItems() {
minimizeSystemModal(touchBar)
}
updateControlStripPresence() updateControlStripPresence()
} }