Skip to content

Commit

Permalink
#47 Modify hidden shortcut key to in-app scope
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed Dec 19, 2021
1 parent f4e90dc commit 785c13f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/pages/setting_interface/setting_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SettingInterfacePage extends StatefulWidget {
}

class _SettingInterfacePageState extends State<SettingInterfacePage> {
List<double> _maxWindowHeightOptions = [600, 700, 800, 900];
List<double> _maxWindowHeightOptions = [700, 800, 900, 1000];

bool _showTrayIcon = false;
String _trayIconStyle;
Expand Down
8 changes: 7 additions & 1 deletion lib/pages/setting_shortcuts/setting_shortcuts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ class _SettingShortcutsPageState extends State<SettingShortcutsPage> {
Future<void> _handleClickRegisterNewHotKey(
BuildContext context, {
String shortcutKey,
HotKeyScope shortcutScope = HotKeyScope.system,
}) async {
return showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext ctx) {
return RecordHotKeyDialog(
onHotKeyRecorded: (newHotKey) {
sharedConfigManager.setShortcut(shortcutKey, newHotKey);
sharedConfigManager.setShortcut(
shortcutKey,
newHotKey..scope = shortcutScope,
);
},
);
},
Expand Down Expand Up @@ -81,6 +86,7 @@ class _SettingShortcutsPageState extends State<SettingShortcutsPage> {
_handleClickRegisterNewHotKey(
context,
shortcutKey: kShortcutHide,
shortcutScope: HotKeyScope.inapp,
);
},
),
Expand Down
3 changes: 2 additions & 1 deletion lib/utilities/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class ConfigManager extends _ConfigChangeNotifier {
);
Config.instance.maxWindowHeight = double.parse(await _getString(
kPrefMaxWindowHeight,
defaultValue: '600',
defaultValue: '800',
));
Config.instance.appLanguage = await _getString(
kPrefAppLanguage,
Expand All @@ -190,6 +190,7 @@ class ConfigManager extends _ConfigChangeNotifier {
KeyCode.escape,
modifiers: [],
identifier: kShortcutHide,
scope: HotKeyScope.inapp,
),
);
Config.instance.shortcutShowOrHide = await getShortcut(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ class _RecordHotKeyDialogState extends State<RecordHotKeyDialog> {
),
),
actions: <Widget>[
CustomDialogAction(
child: Text('cancel'.tr()),
onPressed: () {
Navigator.of(context).pop();
},
),
CustomDialogAction(
child: Text('ok'.tr()),
onPressed: !_hotKey.isSetted
Expand Down

0 comments on commit 785c13f

Please sign in to comment.