Commit graph

569 commits

Author SHA1 Message Date
Jack251970
f8e588b4e1 Refactor: Remove unused namespaces and hotkey converter
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.
2025-10-16 22:10:11 +08:00
Jack251970
811239b158 Refactor hotkey handling and improve thread safety
- 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.
2025-10-16 22:07:13 +08:00
Jack251970
8c95ddc7be Add plugin to _hotkeyPlugins collection for tracking
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.
2025-10-16 21:14:06 +08:00
Jack251970
79b0385336 Refactor plugin hotkey and action keyword management
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.
2025-10-16 20:30:17 +08:00
Jack Ye
8e71130831
Merge branch 'dev' into rename-file 2025-10-16 20:07:02 +08:00
Jack251970
fbeaafa8d3 Remove Score = -100 from result objects in PluginManager
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.
2025-10-16 18:47:15 +08:00
Jack251970
68454a8a6e Change log level for plugin constructor timing message
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.
2025-10-16 18:43:19 +08:00
Jeremy Wu
386737acac
update method parameter style 2025-10-16 20:20:51 +11:00
Jack Ye
922feb488e
Merge branch 'dev' into rename-file 2025-10-14 21:53:48 +08:00
Jack Ye
adfd5425f0
Merge branch 'dev' into plugin_initialization 2025-10-14 21:53:43 +08:00
Jack251970
6f6292494c Use ContainsKey(id) for O(1) lookup instead of O(n) iteration 2025-10-03 16:13:24 +08:00
Jack251970
54e693d0e2 Add functions in Check Initializing & Init Failed region 2025-10-03 16:03:54 +08:00
Jack251970
8a2edf274a Add AutoCompleteText property for results 2025-10-03 15:36:32 +08:00
Jack251970
171eb2dd8b Data race on _allLoadedPlugins (List) across threads 2025-10-03 15:28:11 +08:00
Jack251970
76cc22d5af Use TryRemove and discard out var to clean up action keywords 2025-10-03 15:21:11 +08:00
Jack251970
2be10eb4ca Add translation for plugin failed to respond & Improve translations for plugin stil initializing 2025-10-02 22:26:28 +08:00
Jack251970
297cb5c3ef Return results to tell users that this plugin is still initializing 2025-10-02 22:23:07 +08:00
Jack251970
9a20b0e0de Expose initialized plugins via PublicAPI 2025-10-02 21:59:05 +08:00
Jack251970
66fb1d7c60 Register plugin action keywords when plugins are loaded 2025-10-02 21:52:31 +08:00
Jack251970
5ed94c8abc Resolve conflicts 2025-10-02 20:25:45 +08:00
Jack Ye
6213193cda
Merge branch 'dev' into plugin_initialization 2025-10-02 20:22:20 +08:00
Jack251970
e206f4f31c Fix build issue 2025-09-28 11:48:44 +08:00
Jack251970
ca94ef58e8 Fix build issue 2025-09-28 11:46:55 +08:00
Jack Ye
83c2edf7c8
Merge branch 'dev' into rename-file 2025-09-28 11:40:42 +08:00
Jack Ye
b34851bd12
Merge branch 'dev' into squirrel_upgrade 2025-09-28 11:37:18 +08:00
Jack251970
0e366a6269 Use PublicApi.Instance instead of private one 2025-09-23 17:40:54 +08:00
Jack251970
7350c1d4d5 Use Flow.Launcher.Localization to improve code quality 2025-09-23 17:14:30 +08:00
Jack251970
d6bc053950 Revert changes 2025-09-21 16:46:43 +08:00
Jack251970
fbb9e09237 Improve code quality 2025-09-21 16:19:13 +08:00
Jack251970
89d726de2a Use getter to fix data location issue 2025-09-21 14:03:43 +08:00
Jack Ye
3116f3d363
Merge branch 'dev' into plugin_initialization 2025-09-21 13:22:31 +08:00
Jack Ye
542d1eb3be
Merge branch 'dev' into rename-file 2025-09-21 13:15:44 +08:00
Jack251970
55f9857dec Remove SystemParameters.VerticalScrollBarWidth 2025-09-15 18:59:01 +08:00
Jack251970
e571204a84 No need to initialize max width 2025-09-15 18:48:09 +08:00
Jack251970
988db485a2 Merge branch 'json_plugin_setting' of https://github.com/Flow-Launcher/Flow.Launcher into json_plugin_setting 2025-09-15 18:46:53 +08:00
Jack251970
f3cb85ea59 Remove unnecessary check 2025-09-15 18:46:47 +08:00
Jack Ye
5695200940
Fix typos
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-15 18:46:05 +08:00
Jack251970
44ca9c3480 Use wrap text warpping & set max width of all children 2025-09-15 18:40:16 +08:00
Jack251970
b5c860db1d Add max width constrain 2025-09-15 18:27:19 +08:00
Jack Ye
cf8096f276
Merge branch 'dev' into plugin_initialization 2025-09-05 20:35:05 +08:00
Jack Ye
9733da7205
Merge branch 'dev' into rename-file 2025-09-05 19:52:26 +08:00
Jeremy Wu
e1cc50c579 Merge remote-tracking branch 'origin/master' into resolve_conflicts 2025-08-31 17:53:21 +10:00
Jack251970
007c0897b1 Merge branch 'rename-file' of https://github.com/Koisu-unavailable/Flow.Launcher into rename-file 2025-08-30 16:59:05 +08:00
Jack251970
b84c6ec333 Use an event, not a settable delegate property, for PluginHotkeyChanged 2025-08-30 16:58:57 +08:00
Jack Ye
11dbce65c4
Merge branch 'dev' into rename-file 2025-08-30 16:29:30 +08:00
Jack251970
556dce9bed Remove unnecessary Task.Run 2025-08-14 19:22:03 +08:00
Jack251970
7264f5493f Use ShowMsgError for plugin load fail message 2025-08-14 18:34:03 +08:00
Jack251970
fb8daa4ed9 Potential race condition in action keyword management 2025-08-12 18:12:15 +08:00
Jack Ye
04bd9ddc2c
Verify File.Delete exception handling
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-08-12 18:09:59 +08:00
Jack251970
9221435bad Remove plugin from _allLoadedPlugins when one plugin is uninstalled 2025-08-12 18:07:10 +08:00