mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
feat(linux): add Control+Q shortcut to exit app
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
- feat(android): Android TV support
|
||||
- feat: add troubleshoot page
|
||||
- feat(windows): left click on tray icon opens app
|
||||
- feat(linux): add Control+Q shortcut to exit app
|
||||
- fix: also scan multicast when pressing on a subnet sync button
|
||||
- fix(android): missing app icon on Android 7
|
||||
- fix(android,ios): show error message when saving to gallery failed
|
||||
|
||||
+2
-6
@@ -1,7 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:localsend_app/gen/strings.g.dart';
|
||||
@@ -18,6 +17,7 @@ import 'package:localsend_app/util/device_info_helper.dart';
|
||||
import 'package:localsend_app/util/platform_check.dart';
|
||||
import 'package:localsend_app/util/tray_helper.dart';
|
||||
import 'package:localsend_app/widget/watcher/life_cycle_watcher.dart';
|
||||
import 'package:localsend_app/widget/watcher/shortcut_watcher.dart';
|
||||
import 'package:localsend_app/widget/watcher/tray_watcher.dart';
|
||||
import 'package:localsend_app/widget/watcher/window_watcher.dart';
|
||||
import 'package:routerino/routerino.dart';
|
||||
@@ -65,11 +65,7 @@ class LocalSendApp extends ConsumerWidget {
|
||||
ref.read(networkStateProvider.notifier).init();
|
||||
}
|
||||
},
|
||||
child: Shortcuts(
|
||||
shortcuts: {
|
||||
// The select button on AndroidTV needs this to work
|
||||
LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(),
|
||||
},
|
||||
child: ShortcutWatcher(
|
||||
child: MaterialApp(
|
||||
title: t.appName,
|
||||
locale: TranslationProvider.of(context).flutterLocale,
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:localsend_app/util/platform_check.dart';
|
||||
|
||||
class ShortcutWatcher extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const ShortcutWatcher({required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Shortcuts(
|
||||
shortcuts: {
|
||||
// The select button on AndroidTV needs this to work
|
||||
LogicalKeySet(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(),
|
||||
},
|
||||
child: Actions(
|
||||
actions: {
|
||||
_ExitAppIntent: CallbackAction(onInvoke: (_) => exit(0)),
|
||||
},
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ExitAppIntent extends Intent {}
|
||||
Reference in New Issue
Block a user