From 9dfaa10a063de2435572081578583b04aee6062f Mon Sep 17 00:00:00 2001 From: abue-ammar Date: Thu, 24 Sep 2026 01:38:18 +0600 Subject: [PATCH] Close Dictionary and extension commands on a second hotkey press Define opened its screen with showPalette, so a second press of its shortcut did nothing. It now goes through togglePalette like File Search and Snippets; a fallback's carried term still always opens. An extension command's shortcut hides the palette when that same command is already on screen, matched through ExtensionManager.running. Any other command still replaces it. --- .../Features/Dictionary/UI/DictionaryCoordinator.swift | 2 +- Tinycast/Features/Extensions/UI/ExtensionCoordinator.swift | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Tinycast/Features/Dictionary/UI/DictionaryCoordinator.swift b/Tinycast/Features/Dictionary/UI/DictionaryCoordinator.swift index 9c4b9df4f..576cd0630 100644 --- a/Tinycast/Features/Dictionary/UI/DictionaryCoordinator.swift +++ b/Tinycast/Features/Dictionary/UI/DictionaryCoordinator.swift @@ -11,7 +11,7 @@ final class DictionaryCoordinator { /// `term` is the fallback row's query, so the screen opens already showing its entry. func show(term: String = "") { - paletteCoordinator.showPalette(mode: .dictionary, seeding: term.isEmpty ? nil : term) + paletteCoordinator.togglePalette(mode: .dictionary, seeding: term.isEmpty ? nil : term) } func copy(_ entry: DictionaryEntry) { diff --git a/Tinycast/Features/Extensions/UI/ExtensionCoordinator.swift b/Tinycast/Features/Extensions/UI/ExtensionCoordinator.swift index 4b7e82d62..3cbeab3de 100644 --- a/Tinycast/Features/Extensions/UI/ExtensionCoordinator.swift +++ b/Tinycast/Features/Extensions/UI/ExtensionCoordinator.swift @@ -71,6 +71,13 @@ final class ExtensionCoordinator { guard settings.extensionsEnabled, let entry = extensions.launcherEntry(forEntryID: entryID) else { return } + // The shortcut's second press closes its command, as a mode command's does. + if paletteCoordinator.isShowing(.extensionCommand), + extensions.running == ExtensionCommandRef(entryID: entryID) + { + paletteCoordinator.hidePalette() + return + } runExtensionCommand(entry) }