using System;
namespace Flow.Launcher.Plugin;
///
/// Represents a base plugin hotkey model.
///
///
/// Do not use this class directly. Use or instead.
///
public class BasePluginHotkey
{
///
/// Initializes a new instance of the class with the specified hotkey type.
///
///
public BasePluginHotkey(HotkeyType type)
{
HotkeyType = type;
}
///
/// The unique identifier for the hotkey, which is used to identify and rank the hotkey in the settings page.
///
public int Id { get; set; } = 0;
///
/// The name of the hotkey, which will be displayed in the settings page.
///
public string Name { get; set; } = string.Empty;
///
/// The description of the hotkey, which will be displayed in the settings page.
///
public string Description { get; set; } = string.Empty;
///
/// The glyph information for the hotkey, which will be displayed in the settings page.
///
public GlyphInfo Glyph { get; set; }
///
/// The default hotkey that will be used if the user does not set a custom hotkey.
///
public string DefaultHotkey { get; set; } = string.Empty;
///
/// The type of the hotkey, which can be either global or search window specific.
///
public HotkeyType HotkeyType { get; } = HotkeyType.Global;
///
/// Indicates whether the hotkey is editable by the user in the settings page.
///
public bool Editable { get; set; } = false;
}
///
/// Represent a global plugin hotkey model.
///
public class GlobalPluginHotkey : BasePluginHotkey
{
///
/// Initializes a new instance of the class.
///
public GlobalPluginHotkey() : base(HotkeyType.Global)
{
}
///
/// An action that will be executed when the hotkey is triggered.
///
public Action Action { get; set; } = null;
}
///
/// Represents a plugin hotkey that is specific to the search window.
///
public class SearchWindowPluginHotkey : BasePluginHotkey
{
///
/// Initializes a new instance of the class.
///
public SearchWindowPluginHotkey() : base(HotkeyType.SearchWindow)
{
}
///
/// An action that will be executed when the hotkey is triggered.
///
public Func Action { get; set; } = null;
}
///
/// Represents the type of hotkey for a plugin.
///
public enum HotkeyType
{
///
/// A hotkey that will be trigged globally, regardless of the active window.
///
Global,
///
/// A hotkey that will be triggered only when the search window is active.
///
SearchWindow
}
///
/// Represents a plugin hotkey model which is used to store the hotkey information for a plugin.
///
public class PluginHotkey
{
///
/// The unique identifier for the hotkey.
///
public int Id { get; set; } = 0;
///
/// The default hotkey that will be used if the user does not set a custom hotkey.
///
public string DefaultHotkey { get; set; } = string.Empty;
///
/// The current hotkey that the user has set for the plugin.
///
public string Hotkey { get; set; } = string.Empty;
}