From 60a0fa9df41b9f86900a89f48f3425a27b6f1721 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sat, 5 Apr 2025 22:43:59 +0200 Subject: [PATCH] Use a contextual keyboard shortcut for search on macOS --- App/App_macOS.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/App/App_macOS.swift b/App/App_macOS.swift index c620accd..566d61f7 100644 --- a/App/App_macOS.swift +++ b/App/App_macOS.swift @@ -81,7 +81,17 @@ struct Kiwix: App { CommandGroup(after: .textEditing) { Button(LocalString.common_search) { isSearchFocused = true - }.keyboardShortcut("f", modifiers: [.command, .shift]) + } + .keyboardShortcut("f", modifiers: [.command]) + // intentional duplicate! When on reading tab with loaded webview content + // command + F will search the content itself + // therefore we want command + shift + F to trigger top bar ZIM file search + // The priority which one is picked is based on view tree hierarchy, see: + // https://developer.apple.com/documentation/swiftui/view/keyboardshortcut(_:)#discussion + Button(LocalString.common_search) { + isSearchFocused = true + } + .keyboardShortcut("f", modifiers: [.command, .shift]) } CommandGroup(replacing: .help) {} }