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

Draft
wants to merge 117 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 may find a workaround to ensure the compatibility for action context but I would like to fully deprecate it since it just looks like useless compared to new API, not sure and need discussion.

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

Resolve #1614.

TODOS:

Future:

  • Command bar like Raycast with those commands

@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

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

github-actions bot commented Jul 2, 2025

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors, Warnings, and Notices Count
ℹ️ candidate-pattern 1
❌ forbidden-pattern 1
⚠️ non-alpha-in-dictionary 2

See ❌ Event descriptions for more information.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Reject duplicate words

\s([A-Z]{3,}|[A-Z][a-z]{2,}|[a-z]{3,})\s\g{-1}\s
Pattern suggestions ✂️ (1)

You could add these patterns to .github/actions/spelling/patterns.txt:

# Automatically suggested patterns

# hit-count: 3 file-count: 1
# Non-English
[a-zA-Z]*[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*

Alternatively, if a pattern suggestion doesn't make sense for this project, add a #
to the beginning of the line in the candidates file with the pattern to stop suggesting it.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

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