From 13e1265a513dae87f4c7f3fb63754da832705188 Mon Sep 17 00:00:00 2001 From: HannahPadd Date: Fri, 27 Mar 2026 15:49:19 +0100 Subject: [PATCH] Very big keybinds server refactor --- gui/src/App.tsx | 4 +- .../components/commons/KeybindRecorder.tsx | 17 +- gui/src/components/commons/KeybindRow.tsx | 29 +++- .../components/onboarding/UdevRulesModal.tsx | 2 +- .../settings/pages/KeybindSettings.tsx | 1 + .../src/main/java/dev/slimevr/Keybinding.kt | 93 ++++++----- .../dev/slimevr/config/KeybindingsConfig.kt | 155 ++++++------------ .../dev/slimevr/keybind/KeybindHandler.kt | 54 ++---- .../rpc/keybinds/RPCKeybindHandler.kt | 27 +-- solarxr-protocol | 2 +- 10 files changed, 152 insertions(+), 232 deletions(-) diff --git a/gui/src/App.tsx b/gui/src/App.tsx index b120f6279..a89748f5f 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -56,6 +56,8 @@ import { ElectronContextC, provideElectron } from './hooks/electron'; import { AppLocalizationProvider } from './i18n/config'; import { openUrl } from './hooks/crossplatform'; import { UdevRulesModal } from './components/onboarding/UdevRulesModal'; +import { NewKeybindSettings } from './components/settings/pages/newKeybindSettings'; +import { NewKeybindsRow } from './components/commons/newKeybindsRow'; export const GH_REPO = 'SlimeVR/SlimeVR-Server'; export const VersionContext = createContext(''); @@ -141,7 +143,7 @@ function Layout() { } /> } /> } /> - } /> + } /> { - const initialKeys = ['CTRL', 'ALT']; + const initialKeys: string[] = []; setOldKeys(keys); setLocalKeys(initialKeys); onKeysChange(initialKeys); @@ -92,8 +91,8 @@ export const KeybindRecorder = forwardRef< onBlur={handleOnBlur} onKeyDown={handleKeyDown} /> -
-
+
+
{Array.from({ length: maxKeybindLength }).map((_, i) => { const key = displayKeys[i]; const isActive = isRecording && i === activeIndex; @@ -102,8 +101,8 @@ export const KeybindRecorder = forwardRef<
+ {/*
{displayKeys.length < maxKeybindLength && isRecording ? l10n.getString('settings-keybinds_now-recording') : l10n.getString('settings-keybinds_record-keybind')}
+ */}
); diff --git a/gui/src/components/commons/KeybindRow.tsx b/gui/src/components/commons/KeybindRow.tsx index 345cab8e0..bcd1a89a0 100644 --- a/gui/src/components/commons/KeybindRow.tsx +++ b/gui/src/components/commons/KeybindRow.tsx @@ -2,12 +2,14 @@ import { Controller, Control, UseFormResetField } from 'react-hook-form'; import { Button } from './Button'; import { NumberSelector } from './NumberSelector'; import { KeybindRecorder } from './KeybindRecorder'; +import { KeybindRecorderModal } from './KeybindRecorderModal'; import { useLocaleConfig } from '@/i18n/config'; import { Typography } from './Typography'; import './KeybindRow.scss'; export function KeybindRow({ id, + label, control, resetField, name, @@ -44,15 +46,24 @@ export function KeybindRow({ /> )} /> - secondsFormat.format(value)} - min={0} - max={10} - step={0.2} - /> -
+ + secondsFormat.format(value)} + min={0} + max={10} + step={0.2} + /> +