Skip to content

IPluginHotkey Interface for Global Hotkey & Window Hotkey / Support Rename File & Folder by Hotkey or Context Menu #3770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 167 commits into
base: dev
Choose a base branch
from

Conversation

Koisu-unavailable
Copy link

@Koisu-unavailable Koisu-unavailable commented Jun 24, 2025

Context

Windows system has a default context menu for doing some operations to one specific object like exe file, pdf file, etc. And some operations can have some hotkeys like ctrl-c for copy, etc. Since Flow provides many results like them, we should add context menu for them.

Flow designed context menu is good, but currently, for hotkey event binding in context menu, Flow introduces action context (ActionContext parameter in Action and AsyncAction in Result class) like ctrl, alt, win key with the enter hotkey event (this is the key to open the action in one result) which means Flow need to regard ctrl+enter key event as enter event so that ctrl key will be passed with enter key.

This can lead many possible problems:

  1. Code quality issue: All events will be put in one action delegate with if sentences to check the action context.
  2. Window hotkey binding complexity: Flow needs to bind many preset hotkeys like ctrl-enter which can lead to complexity to hotkey management.
  3. Plugin hotkey registration difficulty: Plugin can only register hotkeys to one results with enter key, and it cannot register other hotkeys like F2 or something else.
  4. Plugin result confusion: Using alt+enter or ctrl+enter will trigger enter event for those results without specific handler for action context.

Considering these issues, I would like to deprecate the action context API and introduce IPluginHotkey interface which can help plugins to register any hotkeys for their results. Additionally, plugins can return results with their supported hotkeys. And we need to find a workaround to ensure the compatibility for action context and I think we can fully deprecate it in future.

In future, if plugins can register their hotkeys and specific supported hotkeys for their results. And we can look forward to a command bar like what does as Raycast. It will tell users what commands are available for the selected result. And it looks very nice for me, and I really enjoy this design.

Changes:

  • New Interface IPluginHotkey to register global & search window hotkeys for one plugins.
/// <summary>
/// Represent plugins that support global hotkey or search window hotkey.
/// </summary>
public interface IPluginHotkey : IFeatures
{
    /// <summary>
    /// Get the list of plugin hotkeys which will be registered in the settings page.
    /// </summary>
    /// <returns></returns>
    List<BasePluginHotkey> GetPuginHotkeys();
}
  • Plugin hotkey setting UI
image
  • Add an item to the context menu for the explorer plugin that allow you to rename files/directories. It opens a dialog.
image
  • Add a hotkey (defaults to F2) that also opens the dialog when a file is selected
image
  • Hotkey registration refactor for both global hotkeys and main window hotkeys (KeyBinding): Now we are using call back function to register / unregister global and main window hotkeys which can improve code quality (Put all codes related to hotkey in HotkeyMapper.cs)

  • Redesign welcome page 3: Removed Ctrl+Enter & Ctrl+Shift+Enter hotkeys since it will be deprated API and added more preset hotkeys.

image
  • Redesign hotkey page: Removed Ctrl+Enter & Ctrl+Shift+Enter hotkeys since it will be deprated API and added all Flow hotkeys.
image

Resolve #1614.

TODOS:

Future:

  • Command bar like Raycast with those commands (Not sure, need discussion)

Test:

  • Welcome page hotkey can be changed.
  • All preset hotkeys in Hotkey page can be changed.
  • Result modifier can work.
  • Custom Query Hotkey can be added, deleted and edited.
  • Plugin global and window hotkey can be registered and edited.
  • Original API ActionContext can work.
  • Dialog Jump hotkey can be changed / enabled / disabled.

@Koisu-unavailable Koisu-unavailable marked this pull request as ready for review June 24, 2025 03:59
Copy link

gitstream-cm bot commented Jun 24, 2025

🥷 Code experts: Jack251970, onesounds

Jack251970, onesounds have most 👩‍💻 activity in the files.
Jack251970, onesounds have most 🧠 knowledge in the files.

See details

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Jack251970 onesounds
JUN 3 additions & 2 deletions
MAY 84 additions & 30 deletions 5 additions & 3 deletions
APR 34 additions & 83 deletions 104 additions & 38 deletions
MAR 142 additions & 94 deletions 10 additions & 0 deletions
FEB 10 additions & 4 deletions
JAN 17 additions & 4 deletions

Knowledge based on git-blame:
Jack251970: 31%
onesounds: 20%

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Activity based on git-commit:

Jack251970 onesounds
JUN 45 additions & 2 deletions
MAY 4 additions & 1 deletions 5 additions & 0 deletions
APR 228 additions & 27 deletions
MAR
FEB 38 additions & 28 deletions
JAN 21 additions & 3 deletions

Knowledge based on git-blame:
Jack251970: 50%
onesounds: 1%

Flow.Launcher/HotkeyControl.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 5 additions & 0 deletions
APR 11 additions & 15 deletions 3 additions & 0 deletions
MAR 150 additions & 37 deletions
FEB
JAN

Knowledge based on git-blame:
Jack251970: 44%
onesounds: 2%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN 8 additions & 0 deletions 7 additions & 6 deletions
MAY 14 additions & 3 deletions 15 additions & 2 deletions
APR 22 additions & 21 deletions 45 additions & 23 deletions
MAR 67 additions & 42 deletions 8 additions & 3 deletions
FEB 15 additions & 9 deletions
JAN 1 additions & 0 deletions

Knowledge based on git-blame:
onesounds: 43%
Jack251970: 12%

Flow.Launcher/MainWindow.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 3 additions & 3 deletions 4 additions & 4 deletions
APR
MAR 42 additions & 26 deletions
FEB 1 additions & 1 deletions
JAN

Knowledge based on git-blame:
onesounds: 85%
Jack251970: 7%

Flow.Launcher/PublicAPIInstance.cs

Activity based on git-commit:

Jack251970 onesounds
JUN 54 additions & 22 deletions
MAY 124 additions & 131 deletions 190 additions & 74 deletions
APR 165 additions & 61 deletions
MAR 21 additions & 19 deletions
FEB 28 additions & 11 deletions
JAN 45 additions & 47 deletions

Knowledge based on git-blame:
Jack251970: 53%
onesounds: 8%

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 1 additions & 1 deletions 4 additions & 1 deletions
APR
MAR 14 additions & 28 deletions
FEB
JAN

Knowledge based on git-blame:
onesounds: 11%
Jack251970: 3%

Flow.Launcher/ViewModel/MainViewModel.cs

Activity based on git-commit:

Jack251970 onesounds
JUN 25 additions & 13 deletions
MAY 529 additions & 316 deletions 4 additions & 0 deletions
APR 35 additions & 28 deletions
MAR 695 additions & 628 deletions 293 additions & 201 deletions
FEB 63 additions & 21 deletions 23 additions & 25 deletions
JAN 17 additions & 21 deletions

Knowledge based on git-blame:
Jack251970: 41%
onesounds: 9%

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 23 additions & 0 deletions 3 additions & 3 deletions
APR 13 additions & 18 deletions
MAR
FEB
JAN 1 additions & 0 deletions

Knowledge based on git-blame:
Jack251970: 7%
onesounds: 4%

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN 7 additions & 0 deletions 5 additions & 2 deletions
MAY 10 additions & 2 deletions
APR
MAR
FEB
JAN

Knowledge based on git-blame:
onesounds: 17%
Jack251970: 9%

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Activity based on git-commit:

Jack251970 onesounds
JUN 4 additions & 4 deletions
MAY 0 additions & 1 deletions
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 4%

To learn more about /:\ gitStream - Visit our Docs

@Jack251970
Copy link
Member

@onesounds I wonder if you can help me with UI improvement especially with plugin hotkey setting UI. Thanks!

image

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
Flow.Launcher/Helper/HotKeyMapper.cs (2)

45-144: Consider breaking down this large initialization method.

While the method is well-organized, its ~100 lines suggest it could benefit from refactoring into smaller, focused methods for each hotkey category (e.g., InitializeSystemHotkeys(), InitializeFlowLauncherHotkeys(), InitializePluginHotkeys()). This would improve maintainability and testability.

 private static void InitializeRegisteredHotkeys()
 {
-    // Fixed hotkeys & Editable hotkeys
-    var list = new List<RegisteredHotkeyData>
-    {
-        // System default window hotkeys
-        new(RegisteredHotkeyType.Up, HotkeyType.SearchWindow, "Up", "HotkeyLeftRightDesc", null),
-        // ... (all other hotkey definitions)
-    };
+    var list = new List<RegisteredHotkeyData>();
+    
+    list.AddRange(InitializeSystemDefaultHotkeys());
+    list.AddRange(InitializeFlowLauncherHotkeys());
+    list.AddRange(InitializeResultModifierHotkeys());
+    list.AddRange(InitializeCustomQueryHotkeys());
+    list.AddRange(InitializePluginHotkeys());

23-826: Consider architectural improvements for this large coordinator class.

While the centralized hotkey management is beneficial, this 800+ line class handles multiple concerns (registration, event handling, UI commands, legacy support). Consider extracting some responsibilities into separate classes (e.g., HotkeyRegistrationService, PluginHotkeyManager) while keeping this as a coordinator.

Flow.Launcher/Resources/Pages/WelcomePage3.xaml (1)

109-163: All DynamicResource Keys Are Defined
Verified that HotkeySelectLastResult, HotkeyRequery, ToggleGameModeHotkey, CopyFilePathHotkey, QuickWidthHotkey, and QuickHeightHotkey are present in every Flow.Launcher/Languages/*.xaml resource dictionary (the project doesn’t use .resx files for localization).

Please also consider:

  • Grouping or collapsing related hotkey cards (e.g., basic vs. advanced) to prevent overwhelming new users
  • Reviewing the new combinations (e.g., Ctrl+Shift+C) for potential conflicts with common OS or application shortcuts
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96bf445 and ada2af8.

📒 Files selected for processing (4)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (3 hunks)
  • Flow.Launcher/Helper/HotKeyMapper.cs (4 hunks)
  • Flow.Launcher/Resources/Pages/WelcomePage3.xaml (1 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: Koisu-unavailable
PR: Flow-Launcher/Flow.Launcher#3770
File: Flow.Launcher/ViewModel/MainViewModel.cs:0-0
Timestamp: 2025-06-24T19:06:48.344Z
Learning: In Flow.Launcher's Explorer plugin results, the SubTitle property always contains the directory containing the file. For file results, Title contains the filename and SubTitle contains the parent directory. For directory results, SubTitle contains the directory path itself.
Flow.Launcher/Resources/Pages/WelcomePage3.xaml (1)
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Flow.Launcher/Helper/HotKeyMapper.cs (3)
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3572
File: Flow.Launcher/App.xaml.cs:214-216
Timestamp: 2025-07-06T12:21:37.947Z
Learning: In Flow Launcher, the UpdatePluginManifestAsync method in PluginsManifest.cs already has comprehensive internal try-catch handling that logs exceptions and returns false on failure rather than throwing, making external try-catch wrappers unnecessary.
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (3)
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
🪛 GitHub Actions: Check Spelling
Flow.Launcher/Helper/HotKeyMapper.cs

[warning] 419-419: Spell check warning: LWin is not a recognized word. (unrecognized-spelling)


[warning] 419-419: Spell check warning: RWin is not a recognized word. (unrecognized-spelling)


[warning] 517-517: Spell check warning: LWin is not a recognized word. (unrecognized-spelling)


[warning] 517-517: Spell check warning: RWin is not a recognized word. (unrecognized-spelling)


[warning] 683-683: Spell check warning: nullability is not a recognized word. (unrecognized-spelling)


[warning] 16-16: Spell check warning: NHotkey is not a recognized word. (unrecognized-spelling)


[warning] 670-670: Spell check warning: nullability is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
🔇 Additional comments (12)
Flow.Launcher/Helper/HotKeyMapper.cs (5)

32-44: LGTM! Well-structured initialization approach.

The initialization properly sets up dependencies, separates concerns between legacy ActionContext hotkeys and the new registered hotkey system, and establishes event handlers for dynamic hotkey management.


150-308: Excellent event-driven hotkey management.

The event handlers comprehensively manage hotkey changes across different sources (settings, custom plugin hotkeys, plugin manager). The dynamic registration/unregistration ensures hotkeys stay synchronized with configuration changes.


466-509: Robust window hotkey registration with good conflict detection.

The implementation properly checks for existing hotkey bindings and includes special handling for ActionContext compatibility. The error handling provides both logging and user feedback.


641-697: Well-implemented command handlers with proper state validation.

The commands include comprehensive state checks (plugin enabled/modified state, hotkey ignore conditions) and handle different hotkey types appropriately. The fallback to ActionContext events maintains backward compatibility.


724-794: Good deprecation strategy for ActionContext support.

The obsolete ActionContext functionality is properly marked with clear deprecation messages pointing to IPluginHotkey. Maintaining backward compatibility while encouraging migration to the new interface is the right approach.

Flow.Launcher.Infrastructure/UserSettings/Settings.cs (3)

42-268: Excellent property change notification implementation.

The conversion of hotkey properties to full properties with change notifications enables the new event-driven hotkey management system. The consistent pattern (backing field, value comparison, OnPropertyChanged) follows proper MVVM practices and allows HotKeyMapper to respond dynamically to setting changes.


573-646: Good modernization with target-typed new expressions.

The simplified collection initialization using target-typed new() expressions reduces verbosity while maintaining type safety. This is a clean code improvement.


649-649: Architectural improvement: delegated hotkey management.

Changing RegisteredHotkeys from a computed property to a simple ObservableCollection properly delegates hotkey management to HotKeyMapper while maintaining UI binding capabilities. This separation of concerns improves the architecture.

Flow.Launcher/Resources/Pages/WelcomePage3.xaml (4)

86-92: LGTM: Consistent title update for context menu hotkey.

The title change from "HotkeyShiftEnterDesc" to "OpenContextMenuHotkey" aligns with the new hotkey naming conventions while maintaining the same key combination.


94-100: LGTM: Hotkey change from Ctrl+Enter to F5 for plugin reload.

The change from "CTRL+ENTER" to "F5" for the reload plugin hotkey is more intuitive and follows common application conventions where F5 is used for refresh/reload operations.


102-108: LGTM: Clear hotkey change for first result selection.

The change from "CTRL+SHIFT+ENTER" to "Alt+Home" for selecting the first result is more intuitive and follows navigation conventions where Home/End keys are used for first/last positioning.


141-163: Good UX pattern for related hotkey pairs.

The QuickWidthHotkey and QuickHeightHotkey cards effectively demonstrate the pattern of showing multiple related hotkeys in a single card. The margin spacing between the hotkey displays provides good visual separation.

@onesounds
Copy link
Contributor

@onesounds I wonder if you can help me with UI improvement especially with plugin hotkey setting UI. Thanks!

image

It looks generally fine. I think just having a title in the plugin list section should be enough. I’ll handle that part in a separate PR after this one is merged.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs (1)

700-700: Fix typo in log message

There's a typo in the log message that was flagged by the pipeline spelling check.

-                    Log.Debug(ClassName, $"Destory dialog: {hwnd}");
+                    Log.Debug(ClassName, $"Destroy dialog: {hwnd}");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15e4a4f and b88e2e9.

📒 Files selected for processing (18)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (8 hunks)
  • Flow.Launcher.Core/Resource/Internationalization.cs (1 hunks)
  • Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs (2 hunks)
  • Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs (7 hunks)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (4 hunks)
  • Flow.Launcher/Helper/HotKeyMapper.cs (4 hunks)
  • Flow.Launcher/HotkeyControl.xaml.cs (4 hunks)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (1 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml (5 hunks)
  • Flow.Launcher/ViewModel/MainViewModel.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Helper/RenameThing.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Main.cs (3 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs (6 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Main.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • Flow.Launcher.Core/Resource/Internationalization.cs
  • Flow.Launcher/Languages/en.xaml
  • Flow.Launcher/ViewModel/MainViewModel.cs
  • Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs
  • Plugins/Flow.Launcher.Plugin.Program/Main.cs
  • Flow.Launcher/HotkeyControl.xaml.cs
  • Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
  • Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml
  • Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
  • Plugins/Flow.Launcher.Plugin.Explorer/Helper/RenameThing.cs
  • Flow.Launcher.Infrastructure/Hotkey/RegisteredHotkeyData.cs
  • Flow.Launcher.Core/Plugin/PluginManager.cs
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: Koisu-unavailable
PR: Flow-Launcher/Flow.Launcher#3770
File: Flow.Launcher/ViewModel/MainViewModel.cs:0-0
Timestamp: 2025-06-24T19:06:48.344Z
Learning: In Flow.Launcher's Explorer plugin results, the SubTitle property always contains the directory containing the file. For file results, Title contains the filename and SubTitle contains the parent directory. For directory results, SubTitle contains the directory path itself.
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (2)
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Plugins/Flow.Launcher.Plugin.Explorer/Main.cs (9)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3572
File: Flow.Launcher/App.xaml.cs:214-216
Timestamp: 2025-07-06T12:21:37.947Z
Learning: In Flow Launcher, the UpdatePluginManifestAsync method in PluginsManifest.cs already has comprehensive internal try-catch handling that logs exceptions and returns false on failure rather than throwing, making external try-catch wrappers unnecessary.
Learnt from: Koisu-unavailable
PR: Flow-Launcher/Flow.Launcher#3770
File: Flow.Launcher/ViewModel/MainViewModel.cs:0-0
Timestamp: 2025-06-24T19:06:48.344Z
Learning: In Flow.Launcher's Explorer plugin results, the SubTitle property always contains the directory containing the file. For file results, Title contains the filename and SubTitle contains the parent directory. For directory results, SubTitle contains the directory path itself.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: taooceros
PR: Flow-Launcher/Flow.Launcher#2616
File: Flow.Launcher/Flow.Launcher.csproj:7-7
Timestamp: 2024-10-08T15:52:58.573Z
Learning: In the Flow Launcher project, the version number in the `Flow.Launcher.csproj` file is dynamically updated during the CI/CD process.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.
Learnt from: jjw24
PR: Flow-Launcher/Flow.Launcher#2448
File: Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs:16-20
Timestamp: 2025-01-18T10:10:18.414Z
Learning: In Flow Launcher's plugin system, the PluginInitContext parameter passed to plugin constructors is guaranteed to be non-null by the plugin initialization system, making null checks unnecessary.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs (6)
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#0
File: :0-0
Timestamp: 2025-04-23T15:14:49.986Z
Learning: In WPF applications like Flow.Launcher, font styling should be applied using implicit styles instead of setting the FontFamily property on individual controls. Define implicit styles in a ResourceDictionary using <Style TargetType="{x:Type Button}"> format and merge it into App.xaml, which automatically applies the font to all instances of the control type while still allowing explicit overrides where needed.
Flow.Launcher/Helper/HotKeyMapper.cs (3)
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3572
File: Flow.Launcher/App.xaml.cs:214-216
Timestamp: 2025-07-06T12:21:37.947Z
Learning: In Flow Launcher, the UpdatePluginManifestAsync method in PluginsManifest.cs already has comprehensive internal try-catch handling that logs exceptions and returns false on failure rather than throwing, making external try-catch wrappers unnecessary.
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (3)
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#3394
File: Flow.Launcher/Themes/Darker Glass.xaml:134-141
Timestamp: 2025-03-28T21:12:13.386Z
Learning: In Flow.Launcher, hotkey styling is implemented with a two-component structure: a Border element with style `ItemHotkeyBGStyle` that provides background and border styling, containing a TextBlock with style `ItemHotkeyStyle` that handles the text styling.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
🪛 GitHub Check: Check Spelling
Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

[failure] 21-21:
Settings Settings matches a line_forbidden.patterns entry: \s([A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})\s\g{-1}\s. (forbidden-pattern)

🪛 GitHub Actions: Check Spelling
Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

[warning] 138-138: opencontainingfolder is not a recognized word. (unrecognized-spelling)


[warning] 139-139: opencontainingfolder is not a recognized word. (unrecognized-spelling)


[warning] 227-227: opendir is not a recognized word. (unrecognized-spelling)


[error] 21-21: Settings Settings matches a line_forbidden.patterns entry: \s([A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})\s\g{-1}\s. (forbidden-pattern)

Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs

[warning] 165-165: PInvoke is not a recognized word. (unrecognized-spelling)


[warning] 170-170: PInvoke is not a recognized word. (unrecognized-spelling)


[warning] 175-175: PInvoke is not a recognized word. (unrecognized-spelling)


[warning] 180-180: PInvoke is not a recognized word. (unrecognized-spelling)


[warning] 321-321: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 160-160: PInvoke is not a recognized word. (unrecognized-spelling)


[warning] 314-314: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 700-700: Destory is not a recognized word. (unrecognized-spelling)

Flow.Launcher/Helper/HotKeyMapper.cs

[warning] 432-432: LWin is not a recognized word. (unrecognized-spelling)


[warning] 432-432: RWin is not a recognized word. (unrecognized-spelling)


[warning] 530-530: LWin is not a recognized word. (unrecognized-spelling)


[warning] 530-530: RWin is not a recognized word. (unrecognized-spelling)


[warning] 696-696: nullability is not a recognized word. (unrecognized-spelling)


[warning] 17-17: NHotkey is not a recognized word. (unrecognized-spelling)


[warning] 683-683: nullability is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: gitStream.cm
🔇 Additional comments (23)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (4)

74-86: LGTM: Hotkey property refactoring follows consistent pattern

The conversion from auto-implemented to full properties with backing fields and OnPropertyChanged() calls enables proper change notification for reactive UI updates. This pattern is consistently applied across all hotkey properties.


671-673: LGTM: Target-typed new expressions improve readability

The use of target-typed new() expressions for collection properties is a good modernization that reduces redundancy while maintaining type safety.


744-744: LGTM: Target-typed new expression for PluginSettings

Consistent with the other collection property updates, this improves readability.


747-747: RegisteredHotkeys population verified in HotKeyMapper
The empty RegisteredHotkeys initializer in Settings.cs is intentional—all hotkey entries are added centrally in Flow.Launcher/Helper/HotKeyMapper.cs. No further changes are required.

Key locations where items are added/removed:

  • HotKeyMapper.InitializeRegisteredHotkeys() – adds default and editable hotkeys
  • CustomPluginHotkeys_CollectionChanged handler – handles Add/Remove/Replace for custom plugin hotkeys
  • PluginManager_PluginHotkeyChanged handler – updates plugin window/global hotkeys
  • Various NotifyCollectionChangedAction cases – maintain _settings.RegisteredHotkeys and call SetHotkey/RemoveHotkey accordingly
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (1)

150-161: LGTM: Simplified hotkey management delegation

The removal of direct HotKeyMapper.SetHotkey and HotKeyMapper.RemoveHotkey calls simplifies the setter and properly delegates all dialog jump setup to DialogJump.SetupDialogJump(). This aligns with the architectural shift to centralized hotkey management and command-based hotkey handling.

Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs (4)

15-15: LGTM: Added RelayCommand support for command-based hotkey handling

The addition of CommunityToolkit.Mvvm.Input import enables the new command-based hotkey architecture, replacing the previous event-driven approach.


456-478: LGTM: Well-implemented command-based hotkey system

The new DialogJumpCommand properly implements the command pattern:

  • Lazy initialization of the RelayCommand
  • Proper guard clause checking EnableDialogJump setting
  • Asynchronous execution with exception handling
  • Clean separation of concerns

This design aligns well with the architectural shift to centralized, command-based hotkey management.


160-180: Pipeline spelling warnings for PInvoke are false positives

The pipeline flagged "PInvoke" as an unrecognized word, but this is a legitimate API name in the Windows SDK. These warnings can be safely ignored as they represent proper Win32 API usage.


314-321: Pipeline spelling warnings for "Wnd" are false positives

The pipeline flagged "Wnd" as unrecognized, but this is part of standard Win32 API naming conventions (e.g., EnumWindows, hWnd). These warnings can be safely ignored.

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs (6)

1-23: LGTM! Clean interface implementation and imports.

The addition of the IPluginHotkey interface and supporting imports are well-structured. The ClassName field for logging follows good practices.


131-133: LGTM! Correct interface implementation.

The method signature correctly implements the IPluginHotkey interface requirement.


135-172: LGTM! Well-implemented open containing folder hotkey.

The implementation correctly handles both files and directories with appropriate error handling, logging, and user feedback. The type checking and return values are appropriate.


173-198: LGTM! Proper context menu hotkey implementation.

The implementation correctly excludes Volume types and includes appropriate error handling. Returning false is correct since showing a context menu shouldn't hide the main window.


199-236: LGTM! Correct run as administrator implementation.

The implementation properly handles elevated execution for files and normal opening for directories, with consistent error handling and appropriate return values.


237-272: LGTM! Excellent rename hotkey implementation.

The implementation uses the standard F2 hotkey and correctly handles different file system types. The use of ShowDialog() makes the rename operation modal, which addresses previous feedback and provides better UX by preventing multiple dialogs or conflicting actions.

Flow.Launcher/Helper/HotKeyMapper.cs (8)

21-151: LGTM! Well-architected hotkey management system.

The initialization is comprehensive and well-structured, covering all hotkey types (system, Flow Launcher, custom, and plugin hotkeys). The event-driven approach and dependency injection usage are appropriate for this complex system.


157-321: LGTM! Comprehensive event handling implementation.

The event handlers properly manage hotkey lifecycle changes across all supported scenarios. The logic correctly handles collection changes and plugin hotkey updates with appropriate cleanup and registration.


387-597: LGTM! Robust hotkey registration and removal system.

The implementation provides comprehensive error handling, supports multiple hotkey managers (HotkeyManager and ChefKeysManager), and includes proper duplicate prevention. The user feedback on registration failures is excellent.


645-710: LGTM! Well-implemented command pattern with proper state validation.

The command implementations correctly validate plugin states, handle result selection, and include appropriate checks for disabled/modified plugins. The logic for invoking plugin hotkey actions is sound.


737-807: LGTM! Excellent backward compatibility approach.

The ActionContext support is properly deprecated with clear migration guidance while maintaining existing functionality. The Obsolete attributes with descriptive messages guide developers toward the new IPluginHotkey interface.


603-641: LGTM! Well-designed helper methods for modularity.

The helper methods for changing and searching registered hotkeys improve code modularity and maintainability. The CheckAvailability method includes proper cleanup in the finally block.


809-838: LGTM! Appropriate data container classes.

The helper classes provide clean encapsulation for command parameters. The Obsolete attribute on the WindowPluginHotkeyPair.Hotkey property correctly aligns with the ActionContext deprecation strategy.


1-840: Excellent comprehensive hotkey management system.

This refactor establishes a robust, extensible hotkey management framework that handles system, application, and plugin hotkeys with proper event-driven updates, comprehensive error handling, and thoughtful backward compatibility. The architecture supports future enhancements while maintaining existing functionality.

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Let the user select a file/folder from search result and edit its name directly inside Flow; preferably by pressing F2.
6 participants