From 9542e332f578ae2d8097b68e515c5101cae65236 Mon Sep 17 00:00:00 2001 From: Wiktor Latanowicz Date: Sun, 31 Oct 2021 13:29:23 +0100 Subject: [PATCH] Hide MT button from control strip when touch bar is empty --- MTMR/TouchBarController.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift index eb1603d..155b028 100644 --- a/MTMR/TouchBarController.swift +++ b/MTMR/TouchBarController.swift @@ -294,20 +294,23 @@ class TouchBarController: NSObject, NSTouchBarDelegate { } func updateControlStripPresence() { - DFRElementSetControlStripPresenceForIdentifier(.controlStripItem, true) + let showMtmrButtonOnControlStrip = touchBarContainsAnyItems() + DFRElementSetControlStripPresenceForIdentifier(.controlStripItem, showMtmrButtonOnControlStrip) } @objc private func presentTouchBar() { if AppSettings.showControlStripState { - updateControlStripPresence() presentSystemModal(touchBar, systemTrayItemIdentifier: .controlStripItem) } else { presentSystemModal(touchBar, placement: 1, systemTrayItemIdentifier: .controlStripItem) } + updateControlStripPresence() } @objc private func dismissTouchBar() { - minimizeSystemModal(touchBar) + if touchBarContainsAnyItems() { + minimizeSystemModal(touchBar) + } updateControlStripPresence() }