feat: added toggle for command pallete

This commit is contained in:
LukeGus
2026-01-13 23:57:21 -06:00
parent c0f4f1d74b
commit 7210381f17
4 changed files with 33 additions and 2 deletions

View File

@@ -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";

View File

@@ -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"

View File

@@ -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);

View File

@@ -136,6 +136,11 @@ export function UserProfile({
const [disableUpdateCheck, setDisableUpdateCheck] = useState<boolean>(
localStorage.getItem("disableUpdateCheck") === "true",
);
const [commandPaletteShortcutEnabled, setCommandPaletteShortcutEnabled] =
useState<boolean>(() => {
const saved = localStorage.getItem("commandPaletteShortcutEnabled");
return saved !== null ? saved === "true" : true;
});
const [userRoles, setUserRoles] = useState<UserRole[]>([]);
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}
/>
</div>
<div className="flex items-center justify-between">
<div>
<Label className="text-foreground-secondary">
{t("profile.enableCommandPaletteShortcut")}
</Label>
<p className="text-sm text-muted-foreground mt-1">
{t("profile.enableCommandPaletteShortcutDesc")}
</p>
</div>
<Switch
checked={commandPaletteShortcutEnabled}
onCheckedChange={handleCommandPaletteShortcutToggle}
/>
</div>
</div>
</div>