Intl support for search hotkey (where US keyboard has it).

This commit is contained in:
2026-02-05 00:57:42 +00:00
parent 0061fc54ae
commit 5717486197
3 changed files with 9 additions and 4 deletions
+7 -3
View File
@@ -119,8 +119,12 @@ const globalShortcutHandler = (event: KeyboardEvent) => {
else if (!keyup && event.key === 'f' && (event.ctrlKey || event.metaKey)) { else if (!keyup && event.key === 'f' && (event.ctrlKey || event.metaKey)) {
headerMain.value!.toggleSearchInput() headerMain.value!.toggleSearchInput()
} }
// Search also on / (UNIX style) // Search also on / (UNIX style) - use code to support any keyboard layout
else if (!input && keyup && event.key === '/') { else if (!input && keyup && event.code === 'Slash') {
// Record the actual character for display (varies by keyboard layout)
if (event.key.length === 1 && event.key !== store.prefs.searchHotkey) {
store.prefs.searchHotkey = event.key
}
headerMain.value!.toggleSearchInput() headerMain.value!.toggleSearchInput()
} }
// Globally close search, clear errors on Escape // Globally close search, clear errors on Escape
@@ -170,7 +174,7 @@ const globalShortcutHandler = (event: KeyboardEvent) => {
if (arrow && !keyup) { if (arrow && !keyup) {
const focusSearch = () => (document.querySelector('.headermain input[type="search"]') as HTMLElement)?.focus() const focusSearch = () => (document.querySelector('.headermain input[type="search"]') as HTMLElement)?.focus()
const focusBreadcrumb = () => (document.querySelector('.breadcrumb') as HTMLElement)?.focus() const focusBreadcrumb = () => (document.querySelector('.breadcrumb') as HTMLElement)?.focus()
if (inBreadcrumb) { if (inBreadcrumb) {
// Breadcrumb: up→header (no repeat), down→files (with repeat) // Breadcrumb: up→header (no repeat), down→files (with repeat)
if (arrow === 'up') { focusSearch(); f = null } if (arrow === 'up') { focusSearch(); f = null }
+1 -1
View File
@@ -17,7 +17,7 @@
@input="updateSearch" @input="updateSearch"
@keydown.escape="clearSearch" @keydown.escape="clearSearch"
/> />
<span v-if="!query" class="search-hint" @click="focusSearch">/</span> <span v-if="!query" class="search-hint" @click="focusSearch">{{ store.prefs.searchHotkey }}</span>
</div> </div>
<div class="spacer smallgap"></div> <div class="spacer smallgap"></div>
<DiskSpace v-if="store.space.disk" /> <DiskSpace v-if="store.space.disk" />
+1
View File
@@ -87,6 +87,7 @@ export const useMainStore = defineStore('main', {
gallery: false, gallery: false,
sortListing: '' as SortOrder, sortListing: '' as SortOrder,
sortFiltered: '' as SortOrder, sortFiltered: '' as SortOrder,
searchHotkey: '/', // Character shown for search hotkey (Slash key)
}, },
user: { user: {
username: '' as string, username: '' as string,