mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Support hotkey modifiers
This commit is contained in:
parent
68ae8a1df3
commit
979aa3ddff
2 changed files with 16 additions and 3 deletions
|
|
@ -182,7 +182,8 @@
|
|||
Modifiers="Ctrl"/>
|
||||
<KeyBinding
|
||||
Key="{Binding TogglePreviewHotkey}"
|
||||
Command="{Binding TogglePreviewCommand}"/>
|
||||
Command="{Binding TogglePreviewCommand}"
|
||||
Modifiers="{Binding TogglePreviewModifiers}"/>
|
||||
</Window.InputBindings>
|
||||
<Grid>
|
||||
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ using System.IO;
|
|||
using System.Collections.Specialized;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Globalization;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -74,7 +75,7 @@ namespace Flow.Launcher.ViewModel
|
|||
OnPropertyChanged(nameof(OpenResultCommandModifiers));
|
||||
break;
|
||||
case nameof(Settings.PreviewHotkey):
|
||||
OnPropertyChanged(nameof(TogglePreviewHotkey));
|
||||
UpdatePreviewHotkey();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
@ -114,6 +115,7 @@ namespace Flow.Launcher.ViewModel
|
|||
RegisterViewUpdate();
|
||||
RegisterResultsUpdatedEvent();
|
||||
_ = RegisterClockAndDateUpdateAsync();
|
||||
UpdatePreviewHotkey();
|
||||
}
|
||||
|
||||
private void RegisterViewUpdate()
|
||||
|
|
@ -582,7 +584,9 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string TogglePreviewHotkey => Settings.PreviewHotkey; // TODO: is hotkey combo possible?
|
||||
public Key TogglePreviewHotkey { get; set; }
|
||||
|
||||
public ModifierKeys TogglePreviewModifiers { get; set; }
|
||||
|
||||
public string Image => Constant.QueryTextBoxIconImagePath;
|
||||
|
||||
|
|
@ -1014,6 +1018,14 @@ namespace Flow.Launcher.ViewModel
|
|||
return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen() || GameModeStatus;
|
||||
}
|
||||
|
||||
private void UpdatePreviewHotkey()
|
||||
{
|
||||
var converter = new KeyGestureConverter();
|
||||
var key = (KeyGesture)converter.ConvertFromString(Settings.PreviewHotkey);
|
||||
TogglePreviewHotkey = key.Key;
|
||||
TogglePreviewModifiers = key.Modifiers;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
|
|
|||
Loading…
Reference in a new issue