From c5ad08069253ecd18dcb8c9be009f7d6aa8106fc Mon Sep 17 00:00:00 2001 From: Talon Date: Sun, 21 Jun 2026 02:09:08 +0200 Subject: [PATCH] fix(macos): toggle Join Voice / Share Screen toolbar item labels setVoiceJoinedState / setShareScreenButton updated only the inner NSButton's title+image, but the text shown beneath a custom-view NSToolbarItem comes from the item's label, not the button's title -- so the toolbar kept reading "Join Voice" / "Share Screen Audio" after joining. Hold references to the NSToolbarItems and update their label/paletteLabel alongside the button. --- .../VoiceCatMac/Windows/MainWindowController.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/clients/apple/macOS/VoiceCatMac/Windows/MainWindowController.swift b/clients/apple/macOS/VoiceCatMac/Windows/MainWindowController.swift index 19b6074..e3adca7 100644 --- a/clients/apple/macOS/VoiceCatMac/Windows/MainWindowController.swift +++ b/clients/apple/macOS/VoiceCatMac/Windows/MainWindowController.swift @@ -69,7 +69,9 @@ final class MainWindowController: NSWindowController, NSWindowDelegate { // MARK: - Toolbar controls (kept as fields so we can update their state) private var joinVoiceButton: NSButton? + private var joinVoiceItem: NSToolbarItem? private var shareScreenButton: NSButton? + private var shareScreenItem: NSToolbarItem? private var muteButton: NSButton? private var deafenButton: NSButton? private var outputVolumeSlider: NSSlider? @@ -706,6 +708,10 @@ final class MainWindowController: NSWindowController, NSWindowDelegate { joinVoiceButton?.title = joined ? "Leave Voice" : "Join Voice" joinVoiceButton?.image = NSImage(systemSymbolName: joined ? "mic.fill" : "mic", accessibilityDescription: joined ? "Leave Voice" : "Join Voice") + // The text shown beneath a custom-view toolbar item comes from the NSToolbarItem's + // label, not the inner button's title — update it too or the label stays "Join Voice". + joinVoiceItem?.label = joined ? "Leave Voice" : "Join Voice" + joinVoiceItem?.paletteLabel = joined ? "Leave Voice" : "Join Voice" joinVoiceButton?.setAccessibilityLabel(joined ? "Leave Voice — stop sending microphone audio" : "Join Voice — start sending microphone audio") muteButton?.isEnabled = joined @@ -739,6 +745,10 @@ final class MainWindowController: NSWindowController, NSWindowDelegate { shareScreenButton?.image = NSImage( systemSymbolName: active ? "rectangle.on.rectangle.angled.fill" : "rectangle.on.rectangle.angled", accessibilityDescription: active ? "Stop Screen Audio" : "Share Screen Audio") + // Update the toolbar item's label too (see setVoiceJoinedState) — the inner button's + // title alone doesn't change the text shown beneath a custom-view toolbar item. + shareScreenItem?.label = active ? "Stop Screen Audio" : "Share Screen Audio" + shareScreenItem?.paletteLabel = active ? "Stop Screen Audio" : "Share Screen Audio" } /// Start ScreenCaptureKit capture for our own SCREEN_AUDIO stream. Called from the @@ -1314,6 +1324,7 @@ extension MainWindowController: NSToolbarDelegate { item.paletteLabel = "Join Voice" item.toolTip = "Join or leave voice (⌘⇧V)" joinVoiceButton = btn + joinVoiceItem = item case ToolbarID.shareScreen: let btn = makeToolbarButton(symbol: "rectangle.on.rectangle.angled", label: "Share Screen Audio", @@ -1324,6 +1335,7 @@ extension MainWindowController: NSToolbarDelegate { item.paletteLabel = "Share Screen Audio" item.toolTip = "Share screen audio (⌘⇧S)" shareScreenButton = btn + shareScreenItem = item case ToolbarID.mute: let btn = makeToolbarButton(symbol: "mic.fill", label: "Mute",