From 7210381f17f1cd50a491fe44eda2dab433423110 Mon Sep 17 00:00:00 2001 From: LukeGus Date: Tue, 13 Jan 2026 23:57:21 -0600 Subject: [PATCH] feat: added toggle for command pallete --- src/i18n/i18n.ts | 2 +- src/locales/en.json | 4 +++- src/ui/desktop/DesktopApp.tsx | 5 +++++ src/ui/desktop/user/UserProfile.tsx | 24 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts index 268103f0..39ba04e0 100644 --- a/src/i18n/i18n.ts +++ b/src/i18n/i18n.ts @@ -2,7 +2,7 @@ import i18n from "i18next"; import { initReactI18next } from "react-i18next"; import LanguageDetector from "i18next-browser-languagedetector"; -import enTranslation from "../locales/translated/en.json"; +import enTranslation from "../locales/en.json"; import afTranslation from "../locales/translated/af.json"; import arTranslation from "../locales/translated/ar.json"; import bnTranslation from "../locales/translated/bn.json"; diff --git a/src/locales/en.json b/src/locales/en.json index 3c4bb2ec..164640ea 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1971,7 +1971,9 @@ "themeDark": "Dark", "themeSystem": "System", "appearanceDesc": "Select the color theme for the application", - "terminalSyntaxHighlightingDesc": "Automatically highlight commands, paths, IPs, and log levels in terminal output" + "terminalSyntaxHighlightingDesc": "Automatically highlight commands, paths, IPs, and log levels in terminal output", + "enableCommandPaletteShortcut": "Enable Command Palette Shortcut", + "enableCommandPaletteShortcutDesc": "Double-tap left Shift to open the Command Palette for quick access to hosts" }, "user": { "failedToLoadVersionInfo": "Failed to load version information" diff --git a/src/ui/desktop/DesktopApp.tsx b/src/ui/desktop/DesktopApp.tsx index 2f7bec72..f6f4e0b1 100644 --- a/src/ui/desktop/DesktopApp.tsx +++ b/src/ui/desktop/DesktopApp.tsx @@ -87,6 +87,11 @@ function AppContent() { if (event.repeat) { return; } + const shortcutEnabled = + localStorage.getItem("commandPaletteShortcutEnabled") !== "false"; + if (!shortcutEnabled) { + return; + } const now = Date.now(); if (now - lastShiftPressTime.current < 300) { setIsCommandPaletteOpen((isOpen) => !isOpen); diff --git a/src/ui/desktop/user/UserProfile.tsx b/src/ui/desktop/user/UserProfile.tsx index c41b3f18..1af0b3d7 100644 --- a/src/ui/desktop/user/UserProfile.tsx +++ b/src/ui/desktop/user/UserProfile.tsx @@ -136,6 +136,11 @@ export function UserProfile({ const [disableUpdateCheck, setDisableUpdateCheck] = useState( localStorage.getItem("disableUpdateCheck") === "true", ); + const [commandPaletteShortcutEnabled, setCommandPaletteShortcutEnabled] = + useState(() => { + const saved = localStorage.getItem("commandPaletteShortcutEnabled"); + return saved !== null ? saved === "true" : true; + }); const [userRoles, setUserRoles] = useState([]); useEffect(() => { @@ -220,6 +225,11 @@ export function UserProfile({ localStorage.setItem("disableUpdateCheck", enabled.toString()); }; + const handleCommandPaletteShortcutToggle = (enabled: boolean) => { + setCommandPaletteShortcutEnabled(enabled); + localStorage.setItem("commandPaletteShortcutEnabled", enabled.toString()); + }; + const handleDeleteAccount = async (e: React.FormEvent) => { e.preventDefault(); setDeleteLoading(true); @@ -573,6 +583,20 @@ export function UserProfile({ onCheckedChange={handleTerminalSyntaxHighlightingToggle} /> +
+
+ +

+ {t("profile.enableCommandPaletteShortcutDesc")} +

+
+ +