Simplify hotkey initialization by using the null-coalescing
assignment operator (`??=`) to ensure `metadata.PluginHotkeys`
is initialized to an empty collection if null. Add a call to
`Clear()` to reset the collection before reuse. Replace
`List<PluginHotkey>()` with shorthand `[]` syntax for creating
empty collections, improving code readability and consistency.
Simplified `PluginManager.cs` by removing unused `using`
directives, including `System.Windows.Input` and several
Flow Launcher-specific namespaces. Eliminated the
instantiation of `KeyGestureConverter` in the
`ChangePluginHotkey` method, reflecting a change in how
hotkeys are processed. These changes reduce dependencies
and streamline the codebase.
- Added `PluginHotkeyInitialized` event in `PluginManager` to notify when plugin hotkeys are initialized.
- Replaced `List` with `ConcurrentBag` for `_windowPluginHotkeys` to ensure thread-safe operations.
- Enhanced `GetWindowPluginHotkeys` to support filtering by plugin ID.
- Updated `HotKeyMapper` to handle `PluginHotkeyInitialized` and register hotkeys dynamically.
- Refactored `WindowPluginHotkeyPair` and `GetRegisteredHotkeyData` to use `ConcurrentBag`.
- Improved debug logging for hotkey initialization.
- Refactored initialization of ActionContext hotkeys using modern C# collection syntax.
- General code cleanup for readability and maintainability.
Enhanced the plugin management system by adding the `pair` object to the `_hotkeyPlugins` collection in `PluginManager.cs`. This ensures that hotkey-enabled plugins are properly tracked and managed within the `Flow.Launcher.Core.Plugin` namespace.
Previously, `UpdatePluginHotkeyInfoTranslations` was called for all plugins, even those without hotkey support. This commit adds a conditional check to ensure the method is only invoked for plugins implementing the `IPluginHotkey` interface.
Additionally, comments were added to clarify the purpose of the hotkey update logic. These changes improve robustness by preventing unnecessary or invalid calls for non-hotkey plugins.
Refactored hotkey management to improve thread safety by replacing `Dictionary` with `ConcurrentDictionary` and introducing a lock for updates. Added new methods for hotkey initialization, validation, and translation updates. Enhanced plugin initialization by integrating hotkey checks and removing redundant calls.
Refactored action keyword management with new methods for adding and removing keywords, ensuring thread safety with `TryAdd`, `AddOrUpdate`, and `TryRemove`. Introduced the `PluginHotkeyChangedEvent` class to encapsulate hotkey change events.
Improved thread safety and performance by using thread-safe collections and LINQ. Cleaned up code by removing deprecated methods, redundant comments, and outdated TODOs. Fixed concurrency issues and ensured consistent updates to plugin metadata and hotkey information.
Removed the `Score = -100` property from multiple result objects
in `PluginManager.cs` to simplify the code and improve clarity.
Adjusted the formatting and structure to ensure proper syntax
and maintain code consistency. This includes changes to result
objects that handle re-querying and exception handling.
Updated the log level for the plugin constructor cost message
from `LogInfo` to `LogDebug` to reduce verbosity in production
logs and make this information available primarily during
debugging sessions.
Updated the `catch` block in the `ResultHelper` class to explicitly catch `System.Exception` and log the error using `App.API.LogException`. The log includes the class name, a failure message for querying results, and the exception details. This improves error visibility and debugging.
The tooltip text for the key `historyStyleTooltip` was updated to improve capitalization and consistency. "History" and "Home Page" were capitalized to align with the formatting of other keys in the file.
Moved `_userSelectedRecord.Add(result)` outside the `if (queryResultsSelected)` block to ensure all user-selected results are recorded, regardless of their source (query results, context menu, or history). Added a comment to clarify that only query results are added to history.
Added logic to record user-selected results in `_userSelectedRecord`
before executing both synchronous and asynchronous actions. This
enables tracking of user interactions for result ranking or analytics.
Comments were added to clarify the purpose of the new logic.