Skip to content

An open-source cross-platform alternative to AirDrop

feat(macos): add command-comma shortcut to open settings (#2715)

Shlomodac49182f875
diff --git a/app/lib/widget/watcher/shortcut_watcher.dart b/app/lib/widget/watcher/shortcut_watcher.dart
index 498a13ab..1f01bab8 100644
--- a/app/lib/widget/watcher/shortcut_watcher.dart
+++ b/app/lib/widget/watcher/shortcut_watcher.dart
@@ -27,7 +27,9 @@ class ShortcutWatcher extends StatelessWidget {
if (checkPlatform([TargetPlatform.linux])) LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyQ): _ExitAppIntent(),
// Add Command+W to close the window for macOS
if (checkPlatform([TargetPlatform.macOS])) LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.keyW): _CloseWindowIntent(),
-
+ // Add Control+, to open settings for macOS
+ if (checkPlatform([TargetPlatform.macOS])) LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.comma): _OpenSettingsIntent(),
+
LogicalKeySet(LogicalKeyboardKey.escape): _PopPageIntent(),
// Control+V and Command+V
@@ -55,6 +57,10 @@ class ShortcutWatcher extends StatelessWidget {
return null;
},
),
+ _OpenSettingsIntent: CallbackAction(onInvoke: (_) async {
+ context.redux(homePageControllerProvider).dispatch(ChangeTabAction(HomeTab.settings));
+ return null;
+ }),
},
child: child,
),
@@ -70,6 +76,8 @@ class _PasteIntent extends Intent {}
class _CloseWindowIntent extends Intent {}
+class _OpenSettingsIntent extends Intent {}
+
bool _ignoreMetaLast = false;
bool _isFakeMetaKey() {
// https://github.com/localsend/localsend/issues/2037