From 1c2567b879e6ad507e579fc82ab7c5737d0f8d99 Mon Sep 17 00:00:00 2001 From: russssl Date: Wed, 9 Jul 2025 17:55:26 +0200 Subject: [PATCH 1/4] add bangs --- src/global.d.ts | 7 ++ src/renderer/src/App.tsx | 10 ++- .../src/components/CommandShortcuts.tsx | 67 +++++++++++++++---- src/renderer/src/lib/utils.tsx | 67 +++++++++++++++++++ 4 files changed, 135 insertions(+), 16 deletions(-) diff --git a/src/global.d.ts b/src/global.d.ts index 6029016..2e30a09 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -62,6 +62,13 @@ declare global { icon: string label: (query: string) => JSX.Element name: string + bang?: BangT + } + + export type BangT = { + bang: string + name: string + url: string } type ResultT = { diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 5359d9d..3670480 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -14,9 +14,9 @@ const App = () => { const [selectedCommand, setSelectedCommand] = useState(null) const [commandSearch, setCommandSearch] = useState('') const commandListRef = useRef(null) + const [currentBangName, setCurrentBangName] = useState(null) useScrollToTop(commandListRef, [commandSearch]) - const handleInputKeyDown = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.preventDefault() @@ -44,7 +44,11 @@ const App = () => { onKeyDown={handleInputKeyDown} placeholder="Search commands..." /> - + {currentBangName && ( + + {currentBangName} + + )} @@ -52,7 +56,7 @@ const App = () => { - +