⌨️ Keyboard Shortcuts: Boost Your Productivity
Master these VS Code-style keyboard shortcuts to navigate Libre WebUI like a pro and boost your productivity.
~2 minutes to learn the essential shortcuts that will save you hours of clicking!
🚀 Overview
This implementation adds VS Code-like keyboard shortcuts to the Libre WebUI application, making it more efficient for power users.
🎯 Smart Design
Familiar shortcuts for VS Code users
🛡️ Safe Operation
Disabled when typing in input fields
🌍 Cross-Platform
Works on Windows, Mac, and Linux
⌨️ Available Shortcuts
- 🧭 Navigation
- ⚙️ Settings & Help
- 💬 Chat
Shortcut | Action | Description |
---|---|---|
⌘B / Ctrl+B | Toggle Sidebar | Show/hide the main sidebar |
⌘D / Ctrl+D | Toggle Theme | Switch between light and dark themes |
- ⌘B is especially useful for maximizing chat space on smaller screens
- ⌘D instantly switches themes without opening settings
Shortcut | Action | Description |
---|---|---|
⌘, / Ctrl+, | Open Settings | Quick access to settings modal |
? | Show Shortcuts | Display this keyboard shortcuts help |
Esc | Close Modals | Close any open modal dialogs |
- ⌘, matches VS Code's settings shortcut exactly
- ? works from anywhere in the app for instant help
Shortcut | Action | Description |
---|---|---|
Enter | Send Message | Send your typed message |
Shift+Enter | New Line | Add a new line without sending |
- Shift+Enter is perfect for multi-line messages or code snippets
- These shortcuts work in the main chat input field
Files Modified/Created
New Files
-
frontend/src/hooks/useKeyboardShortcuts.ts
- Custom hook for managing keyboard shortcuts
- Handles key combination detection and prevents conflicts with input fields
- Provides helper functions for formatting shortcut displays
-
frontend/src/components/KeyboardShortcuts.tsx
- Modal component displaying all available keyboard shortcuts
- Floating indicator button for easy access
- Organized shortcuts by category (Navigation, Settings, Chat)
Modified Files
-
frontend/src/App.tsx
- Integrated keyboard shortcuts system
- Added state management for modals (settings, shortcuts)
- Implemented global keyboard shortcut handlers
-
frontend/src/components/Header.tsx
- Updated to accept
onSettingsClick
prop - Removed internal settings modal management
- Added keyboard shortcut hints to tooltips
- Updated to accept
-
frontend/src/components/Sidebar.tsx
- Added keyboard shortcut hints in footer
- Shows ⌘B shortcut for sidebar toggle
- Shows ? shortcut for help
-
frontend/src/components/ThemeToggle.tsx
- Added ⌘D shortcut hint to tooltip
-
frontend/src/components/SidebarToggle.tsx
- Added ⌘B shortcut hint to tooltip
-
frontend/src/components/index.ts
- Exported new keyboard shortcuts components
Features
Smart Conflict Prevention
- Shortcuts are disabled when user is typing in input fields, textareas, or contenteditable elements
- Prevents accidental triggering while composing messages
Cross-Platform Compatibility
- Uses metaKey detection for Cmd on Mac and Ctrl on Windows/Linux
- Displays appropriate symbols (⌘ vs Ctrl) based on platform
Visual Indicators
- Tooltips show keyboard shortcuts for relevant buttons
- Floating help button in bottom-right corner
- Footer hints in sidebar
- kbd elements for proper shortcut styling
Modal Management
- Centralized modal state management in App component
- Esc key closes all modals
- Proper z-index stacking
Usage
For Users
- Press ⌘B to quickly toggle the sidebar
- Press ⌘, to open settings
- Press ⌘D to switch themes
- Press ? to see all available shortcuts
- Look for keyboard shortcut hints in tooltips and the sidebar footer
For Developers
- Import and use
useKeyboardShortcuts
hook for custom shortcuts - Add new shortcuts to the
shortcuts
array in App.tsx - Use
formatShortcut
helper to display shortcuts consistently - Follow the pattern for adding tooltips with shortcut hints
Implementation Notes
- Keyboard shortcuts use the same state management as existing UI controls
- No new dependencies were added - uses existing React patterns
- Fully integrated with the existing theme system
- Responsive design works on all screen sizes
- Accessible with proper ARIA labels and semantic HTML
Testing
- All shortcuts work as expected in the browser
- No conflicts with existing functionality
- Proper fallbacks when shortcuts are disabled
- Visual feedback through tooltips and help modal
This implementation provides a VS Code-like experience while maintaining the app's existing design language and functionality.