mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add dialog jump hotkey
This commit is contained in:
parent
45ed9faf29
commit
11e8a58b3b
4 changed files with 12 additions and 11 deletions
|
|
@ -9,10 +9,10 @@ using Flow.Launcher.Infrastructure.Logger;
|
|||
using Flow.Launcher.Infrastructure.DialogJump.Models;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using NHotkey;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
using Windows.Win32.UI.Accessibility;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.DialogJump
|
||||
{
|
||||
|
|
@ -455,7 +455,10 @@ namespace Flow.Launcher.Infrastructure.DialogJump
|
|||
|
||||
#region Hotkey
|
||||
|
||||
public static void OnToggleHotkey(object sender, HotkeyEventArgs args)
|
||||
private static RelayCommand _dialogJumpCommand;
|
||||
public static IRelayCommand DialogJumpCommand => _dialogJumpCommand ??= new RelayCommand(OnToggleHotkey);
|
||||
|
||||
private static void OnToggleHotkey()
|
||||
{
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -285,6 +285,7 @@ public enum RegisteredHotkeyType
|
|||
OpenResultN10,
|
||||
|
||||
Toggle,
|
||||
DialogJump,
|
||||
|
||||
Preview,
|
||||
AutoComplete,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using ChefKeys;
|
|||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Infrastructure.DialogJump;
|
||||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
|
@ -82,6 +83,7 @@ internal static class HotKeyMapper
|
|||
|
||||
// Flow Launcher global hotkeys
|
||||
new(RegisteredHotkeyType.Toggle, HotkeyType.Global, _settings.Hotkey, "flowlauncherHotkey", _mainViewModel.CheckAndToggleFlowLauncherCommand, null, () => _settings.Hotkey = ""),
|
||||
new(RegisteredHotkeyType.DialogJump, HotkeyType.Global, _settings.DialogJumpHotkey, "dialogJumpHotkey", DialogJump.DialogJumpCommand, null, () => _settings.DialogJumpHotkey = ""),
|
||||
|
||||
// Flow Launcher window hotkeys
|
||||
new(RegisteredHotkeyType.Preview, HotkeyType.SearchWindow, _settings.PreviewHotkey, "previewHotkey", _mainViewModel.TogglePreviewCommand, null, () => _settings.PreviewHotkey = ""),
|
||||
|
|
@ -155,6 +157,9 @@ internal static class HotKeyMapper
|
|||
case nameof(_settings.Hotkey):
|
||||
ChangeRegisteredHotkey(RegisteredHotkeyType.Toggle, _settings.Hotkey);
|
||||
break;
|
||||
case nameof(_settings.DialogJumpHotkey):
|
||||
ChangeRegisteredHotkey(RegisteredHotkeyType.DialogJump, _settings.DialogJumpHotkey);
|
||||
break;
|
||||
|
||||
// Flow Launcher window hotkeys
|
||||
case nameof(_settings.PreviewHotkey):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
|
@ -156,14 +156,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
{
|
||||
Settings.EnableDialogJump = value;
|
||||
DialogJump.SetupDialogJump(value);
|
||||
if (Settings.EnableDialogJump)
|
||||
{
|
||||
HotKeyMapper.SetHotkey(new(Settings.DialogJumpHotkey), DialogJump.OnToggleHotkey);
|
||||
}
|
||||
else
|
||||
{
|
||||
HotKeyMapper.RemoveHotkey(Settings.DialogJumpHotkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue