Skip to content

An open-source cross-platform alternative to AirDrop

fix(linux): keep shortcuts working when Num Lock is enabled (#3482)

Shlomo4ecc0e7e672d
diff --git a/app/lib/widget/watcher/shortcut_watcher.dart b/app/lib/widget/watcher/shortcut_watcher.dart
index 3f155a63..fdef6324 100644
--- a/app/lib/widget/watcher/shortcut_watcher.dart
+++ b/app/lib/widget/watcher/shortcut_watcher.dart
@@ -19,22 +19,24 @@ class ShortcutWatcher extends StatelessWidget {
Widget build(BuildContext context) {
return Shortcuts(
shortcuts: {
+ // LogicalKeySet requires an exact pressed-key match, which fails with Num Lock enabled on Linux.
+ // https://github.com/localsend/localsend/issues/3481
// The select button on AndroidTV needs this to work
- LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(),
+ SingleActivator(LogicalKeyboardKey.select): const ActivateIntent(),
// Add Control+Q binding for Linux
// https://github.com/localsend/localsend/issues/194
- if (checkPlatform([TargetPlatform.linux])) LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyQ): _ExitAppIntent(),
+ if (checkPlatform([TargetPlatform.linux])) SingleActivator(LogicalKeyboardKey.keyQ, control: true): _ExitAppIntent(),
// Add Command+W to close the window for macOS
- if (checkPlatform([TargetPlatform.macOS])) LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.keyW): _CloseWindowIntent(),
+ if (checkPlatform([TargetPlatform.macOS])) SingleActivator(LogicalKeyboardKey.keyW, meta: true): _CloseWindowIntent(),
// Add Control+, to open settings for macOS
- if (checkPlatform([TargetPlatform.macOS])) LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.comma): _OpenSettingsIntent(),
+ if (checkPlatform([TargetPlatform.macOS])) SingleActivator(LogicalKeyboardKey.comma, meta: true): _OpenSettingsIntent(),
- LogicalKeySet(LogicalKeyboardKey.escape): _PopPageIntent(),
+ SingleActivator(LogicalKeyboardKey.escape): _PopPageIntent(),
// Control+V and Command+V
- LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyV): _PasteIntent(),
- LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.keyV): _PasteIntent(),
+ SingleActivator(LogicalKeyboardKey.keyV, control: true): _PasteIntent(),
+ SingleActivator(LogicalKeyboardKey.keyV, meta: true): _PasteIntent(),
},
child: Actions(
actions: {