diff --git a/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs b/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs
index 54df72c70..b34974e48 100644
--- a/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs
+++ b/Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs
@@ -1,4 +1,6 @@
using System;
+using System.Windows.Input;
+using Flow.Launcher.Plugin;
namespace Flow.Launcher.Infrastructure.Hotkey;
@@ -11,6 +13,16 @@ namespace Flow.Launcher.Infrastructure.Hotkey;
///
public class RegisteredHotkeyData : BaseModel
{
+ ///
+ /// Type of this hotkey in the context of the application.
+ ///
+ public RegisteredHotkeyType RegisteredType { get; }
+
+ ///
+ /// Type of this hotkey.
+ ///
+ public HotkeyType Type { get; }
+
///
/// representation of this hotkey.
///
@@ -40,6 +52,16 @@ public class RegisteredHotkeyData : BaseModel
///
public object?[] DescriptionFormatVariables { get; } = Array.Empty();
+ ///
+ /// Command of this hotkey. If it's null , the hotkey is assumed to be registered by system.
+ ///
+ public ICommand? Command { get; }
+
+ ///
+ /// Command parameter of this hotkey.
+ ///
+ public object? CommandParameter { get; }
+
///
/// An action that, when called, will unregister this hotkey. If it's null , it's assumed that
/// this hotkey can't be unregistered, and the "Overwrite" option will not appear in the hotkey dialog.
@@ -51,6 +73,12 @@ public class RegisteredHotkeyData : BaseModel
/// descriptionResourceKey doesn't need any arguments for string.Format . If it does,
/// use one of the other constructors.
///
+ ///
+ /// The type of this hotkey in the context of the application.
+ ///
+ ///
+ /// Whether this hotkey is global or search window specific.
+ ///
///
/// The hotkey this class will represent.
/// Example values: F1 , Ctrl+Shift+Enter
@@ -59,14 +87,68 @@ public class RegisteredHotkeyData : BaseModel
/// The key in the localization dictionary that represents this hotkey. For example, ReloadPluginHotkey ,
/// which represents the string "Reload Plugins Data" in en.xaml
///
+ ///
+ /// The command that will be executed when this hotkey is triggered. If it's null , the hotkey is assumed to be registered by system.
+ ///
+ ///
+ /// The command parameter that will be passed to the command when this hotkey is triggered. If it's null , no parameter will be passed.
+ ///
///
/// An action that, when called, will unregister this hotkey. If it's null , it's assumed that this hotkey
/// can't be unregistered, and the "Overwrite" option will not appear in the hotkey dialog.
///
- public RegisteredHotkeyData(string hotkey, string descriptionResourceKey, Action? removeHotkey = null)
+ public RegisteredHotkeyData(
+ RegisteredHotkeyType registeredType, HotkeyType type, string hotkey, string descriptionResourceKey,
+ ICommand? command, object? parameter = null, Action? removeHotkey = null)
{
+ RegisteredType = registeredType;
+ Type = type;
Hotkey = new HotkeyModel(hotkey);
DescriptionResourceKey = descriptionResourceKey;
+ Command = command;
+ CommandParameter = parameter;
+ RemoveHotkey = removeHotkey;
+ }
+
+ ///
+ /// Creates an instance of RegisteredHotkeyData . Assumes that the key specified in
+ /// descriptionResourceKey doesn't need any arguments for string.Format . If it does,
+ /// use one of the other constructors.
+ ///
+ ///
+ /// The type of this hotkey in the context of the application.
+ ///
+ ///
+ /// Whether this hotkey is global or search window specific.
+ ///
+ ///
+ /// The hotkey this class will represent.
+ /// Example values: F1 , Ctrl+Shift+Enter
+ ///
+ ///
+ /// The key in the localization dictionary that represents this hotkey. For example, ReloadPluginHotkey ,
+ /// which represents the string "Reload Plugins Data" in en.xaml
+ ///
+ ///
+ /// The command that will be executed when this hotkey is triggered. If it's null , the hotkey is assumed to be registered by system.
+ ///
+ ///
+ /// The command parameter that will be passed to the command when this hotkey is triggered. If it's null , no parameter will be passed.
+ ///
+ ///
+ /// An action that, when called, will unregister this hotkey. If it's null , it's assumed that this hotkey
+ /// can't be unregistered, and the "Overwrite" option will not appear in the hotkey dialog.
+ ///
+ public RegisteredHotkeyData(
+ RegisteredHotkeyType registeredType, HotkeyType type, HotkeyModel hotkey, string descriptionResourceKey,
+ ICommand? command, object? parameter = null, Action? removeHotkey = null)
+ {
+ RegisteredType = registeredType;
+ Type = type;
+ Hotkey = hotkey;
+ DescriptionResourceKey = descriptionResourceKey;
+ Command = command;
+ CommandParameter = parameter;
RemoveHotkey = removeHotkey;
}
@@ -74,6 +156,12 @@ public class RegisteredHotkeyData : BaseModel
/// Creates an instance of RegisteredHotkeyData . Assumes that the key specified in
/// descriptionResourceKey needs exactly one argument for string.Format .
///
+ ///
+ /// The type of this hotkey in the context of the application.
+ ///
+ ///
+ /// Whether this hotkey is global or search window specific.
+ ///
///
/// The hotkey this class will represent.
/// Example values: F1 , Ctrl+Shift+Enter
@@ -85,17 +173,28 @@ public class RegisteredHotkeyData : BaseModel
///
/// The value that will replace {0} in the localized string found via description .
///
+ ///
+ /// The command that will be executed when this hotkey is triggered. If it's null , the hotkey is assumed to be registered by system.
+ ///
+ ///
+ /// The command parameter that will be passed to the command when this hotkey is triggered. If it's null , no parameter will be passed.
+ ///
///
/// An action that, when called, will unregister this hotkey. If it's null , it's assumed that this hotkey
/// can't be unregistered, and the "Overwrite" option will not appear in the hotkey dialog.
///
public RegisteredHotkeyData(
- string hotkey, string descriptionResourceKey, object? descriptionFormatVariable, Action? removeHotkey = null
+ RegisteredHotkeyType registeredType, HotkeyType type, string hotkey, string descriptionResourceKey, object? descriptionFormatVariable,
+ ICommand? command, object? parameter = null, Action? removeHotkey = null
)
{
+ RegisteredType = registeredType;
+ Type = type;
Hotkey = new HotkeyModel(hotkey);
DescriptionResourceKey = descriptionResourceKey;
DescriptionFormatVariables = new[] { descriptionFormatVariable };
+ Command = command;
+ CommandParameter = parameter;
RemoveHotkey = removeHotkey;
}
@@ -103,6 +202,12 @@ public class RegisteredHotkeyData : BaseModel
/// Creates an instance of RegisteredHotkeyData . Assumes that the key specified in
/// needs multiple arguments for string.Format .
///
+ ///
+ /// The type of this hotkey in the context of the application.
+ ///
+ ///
+ /// Whether this hotkey is global or search window specific.
+ ///
///
/// The hotkey this class will represent.
/// Example values: F1 , Ctrl+Shift+Enter
@@ -115,17 +220,87 @@ public class RegisteredHotkeyData : BaseModel
/// Array of values that will replace {0} , {1} , {2} , etc.
/// in the localized string found via description .
///
+ ///
+ /// The command that will be executed when this hotkey is triggered. If it's null , the hotkey is assumed to be registered by system.
+ ///
+ ///
+ /// The command parameter that will be passed to the command when this hotkey is triggered. If it's null , no parameter will be passed.
+ ///
///
/// An action that, when called, will unregister this hotkey. If it's null , it's assumed that this hotkey
/// can't be unregistered, and the "Overwrite" option will not appear in the hotkey dialog.
///
public RegisteredHotkeyData(
- string hotkey, string descriptionResourceKey, object?[] descriptionFormatVariables, Action? removeHotkey = null
+ RegisteredHotkeyType registeredType, HotkeyType type, string hotkey, string descriptionResourceKey, object?[] descriptionFormatVariables,
+ ICommand? command, object? parameter = null, Action? removeHotkey = null
)
{
+ RegisteredType = registeredType;
+ Type = type;
Hotkey = new HotkeyModel(hotkey);
DescriptionResourceKey = descriptionResourceKey;
DescriptionFormatVariables = descriptionFormatVariables;
+ Command = command;
+ CommandParameter = parameter;
RemoveHotkey = removeHotkey;
}
}
+
+public enum RegisteredHotkeyType
+{
+ CtrlShiftEnter,
+ CtrlEnter,
+ AltEnter,
+
+ Up,
+ Down,
+ Left,
+ Right,
+
+ Esc,
+ Reload,
+ SelectFirstResult,
+ SelectLastResult,
+ ReQuery,
+ IncreaseWidth,
+ DecreaseWidth,
+ IncreaseMaxResult,
+ DecreaseMaxResult,
+ ShiftEnter,
+ Enter,
+ ToggleGameMode,
+ CopyFilePath,
+ OpenResultN1,
+ OpenResultN2,
+ OpenResultN3,
+ OpenResultN4,
+ OpenResultN5,
+ OpenResultN6,
+ OpenResultN7,
+ OpenResultN8,
+ OpenResultN9,
+ OpenResultN10,
+
+ Toggle,
+
+ Preview,
+ AutoComplete,
+ AutoComplete2,
+ SelectNextItem,
+ SelectNextItem2,
+ SelectPrevItem,
+ SelectPrevItem2,
+ SettingWindow,
+ OpenHistory,
+ OpenContextMenu,
+ SelectNextPage,
+ SelectPrevPage,
+ CycleHistoryUp,
+ CycleHistoryDown,
+
+ CustomQuery,
+
+ PluginGlobalHotkey,
+
+ PluginWindowHotkey,
+}