Skip to content
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

Support the use of Windows key & four-combination hotkey #3157

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

jjw24
Copy link
Member

@jjw24 jjw24 commented Jan 1, 2025

Changes:
Support for query window & Custom Query Hotkeys to:

  • use the left or right Windows key without triggering the Windows Start menu
  • use the Windows key in combination with other keys to trigger actions
  • use any two, three, four key combinations to trigger actions

Context:

  • Currently hotkey control is separated into 1) WPF Control hotkeys 2) NHotkey. NHotkey controls query window and Custom Query Hotkeys triggering whilst WPF Control hotkeys is for all hotkey operations on the query window such as tab to autocomplete. This change only replaces the NHotkey part. WPF Control hotkeys whilst limited, is still sufficient for achieving query window operations.
  • Source code for ChefKeys that handles the hotkey operations in this change is available at https://github.com/jjw24/ChefKeys.

Tested:

  • Use LWin key to trigger query window + custom hotkeys
  • All key management operations (e.g. overwrite/cancelling existing hotkey) of query window
  • All key management operations (e.g. overwrite/cancelling existing hotkey) of custom query hotkeys
  • All key management operations (e.g. overwrite/cancelling existing hotkey) of WPF Control hotkeys (e.g. autocomplete, select next result)
  • Shell plugin replace Win+R functionality still works
  • Core hotkey management operations- registering, unregistering, adding, deleting hotkeys

Close #662, #2709, #1358,

@jjw24 jjw24 added this to the 1.20.0 milestone Jan 1, 2025

This comment has been minimized.

Copy link

gitstream-cm bot commented Jan 1, 2025

🥷 Code experts: Yusyuriv, onesounds

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

See details

Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:

Flow.Launcher.Infrastructure/KeyConstant.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC 5 additions & 3 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
onesounds: 25%
Yusyuriv: 15%

Flow.Launcher/CustomQueryHotkeySetting.xaml

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
onesounds: 57%
Yusyuriv: 40%

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Yusyuriv: 19%
onesounds: 15%

Flow.Launcher/Flow.Launcher.csproj

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
onesounds: 18%

Flow.Launcher/Helper/HotKeyMapper.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Yusyuriv: 64%

Flow.Launcher/HotkeyControl.xaml.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Yusyuriv: 35%

Flow.Launcher/HotkeyControlDialog.xaml.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Yusyuriv: 91%
onesounds: 2%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Yusyuriv
JAN
DEC 2 additions & 0 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
onesounds: 44%
Yusyuriv: 6%

Flow.Launcher/Resources/Pages/WelcomePage2.xaml

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
onesounds: 97%
Yusyuriv: 2%

Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
onesounds: 24%
Yusyuriv: 18%

Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Yusyuriv: 94%

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Activity based on git-commit:

Yusyuriv
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Yusyuriv: 87%
onesounds: 13%

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

Copy link

gitstream-cm bot commented Jan 1, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

@jjw24 jjw24 changed the title Enable Windows key Support for Windows key and four combination hotkeys Jan 1, 2025
@jjw24 jjw24 added the enhancement New feature or request label Jan 1, 2025
@jjw24 jjw24 changed the title Support for Windows key and four combination hotkeys Support for Windows key and four combination hotkey Jan 1, 2025
@jjw24 jjw24 changed the title Support for Windows key and four combination hotkey Support for Windows key & four combination hotkey Jan 1, 2025
@jjw24 jjw24 changed the title Support for Windows key & four combination hotkey Support for Windows key & four-combination hotkey Jan 1, 2025
Copy link
Contributor

coderabbitai bot commented Jan 1, 2025

📝 Walkthrough

Walkthrough

The pull request introduces a comprehensive overhaul of the hotkey management system in Flow Launcher. The changes involve transitioning from the NHotkey library to ChefKeys, refactoring the HotkeyModel struct, and updating various components to support more flexible hotkey handling. Key modifications include adding support for specific modifier keys like LeftAlt, enhancing key parsing logic, and improving hotkey validation across different parts of the application.

Changes

File Change Summary
Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs Refactored hotkey parsing, added new properties HotkeyRaw and PreviousHotkey, enhanced key recognition and validation
Flow.Launcher.Infrastructure/KeyConstant.cs Added LeftAlt constant
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Updated default hotkey to use LeftAlt
Flow.Launcher/Helper/HotKeyMapper.cs Replaced NHotkey implementation with ChefKeys, simplified hotkey registration methods
Flow.Launcher/HotkeyControl.xaml.cs Added IsWPFHotkeyControl property, improved hotkey validation logic

Assessment against linked issues

Objective Addressed Explanation
Use Win key as hotkey Partial support added with enhanced key recognition, but explicit Win key trigger not fully demonstrated

Possibly related PRs

Suggested labels

enhancement, kind/ui, Explorer Plugin, bug

Suggested reviewers

  • taooceros
  • VictoriousRaptor

Poem

🐰 Hotkeys dancing, keys so bright,
ChefKeys brewing with delight!
Left Alt springs, Win key gleams,
Launcher's magic now supreme
Coding rabbits hop with glee! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 (12)
Flow.Launcher/Helper/HotKeyMapper.cs (1)

65-68: Exposing ChefKeys registration checks.
The CanRegisterHotkey method correctly delegates to ChefKeysManager. Consider surfacing reason codes if future debug is needed.

Flow.Launcher/HotkeyControl.xaml.cs (3)

77-79: Commented-out code.
These lines are now replaced by the approach in lines 80-82. If not needed, remove them to reduce confusion.


113-125: IsWPFHotkeyControl dependency property.
This property neatly segregates WPF hotkey handling from ChefKeys-only contexts. Good architectural choice for controlling flow based on environment.


159-159: Commented-out SetHotkey.
Remove this if no longer intended to avoid confusion for future maintainers.

Flow.Launcher/HotkeyControlDialog.xaml.cs (1)

45-50: Added isWPFHotkeyControl parameter.
Constructor now fully distinguishes WPF from ChefKeys usage, preventing conflicts in key handling.

Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs (1)

80-88: Removed older constructor.
Ensures no confusion between ChefKeys usage and WPF usage.

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs (1)

50-50: Maintain consistency when updating hotkeys.
After reassigning the hotkey, confirm that any references to updateCustomHotkey.Hotkey (such as in logs or other internal structures) are updated to avoid stale data.

Flow.Launcher/Resources/Pages/WelcomePage2.xaml (2)

116-116: Provide short help text for the default hotkey update.
Switching from “Alt+Space” to “LeftAlt+Space” adds clarity but might surprise existing users. Consider adding a short on-screen note or a release note describing this change.


120-120: Confirm that the window title label is localized if needed.
Using a dynamic resource for the window title is excellent for localization, but verify that translations exist for all preferred locales, so the label isn’t shown in English-only.

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

291-305: Ensure all relevant hotkeys are included or safely removed.

These lines add hotkeys to the RegisteredHotkeys collection only if they are not empty. Verify that any newly added custom hotkeys are tested for collision or duplication with other shortcuts in the system or externally managed by ChefKeys.

Do you want me to generate a script to detect collisions between these hotkeys and those commented out below, or any known system shortcuts?


337-364: Reassess commented-out hotkeys.

A significant block of preexisting hotkeys is now commented out. If they are legacy shortcuts no longer supported, consider removing them altogether to keep the codebase clean. If they are placeholders awaiting future reactivation, add a comment clarifying their intended usage to help maintain code clarity.

Flow.Launcher/Flow.Launcher.csproj (1)

86-86: Validate ChefKeys package stability and compatibility.

Introducing the ChefKeys package is a core dependency change. Confirm that version 0.1.1 is stable for production and that there are no known issues that could impact the hotkey functionality. If necessary, pin or range-limit the version to prevent inadvertent upgrades in the future.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fd3576d and 5dee66e.

📒 Files selected for processing (14)
  • Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs (5 hunks)
  • Flow.Launcher.Infrastructure/KeyConstant.cs (1 hunks)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (3 hunks)
  • Flow.Launcher/CustomQueryHotkeySetting.xaml (1 hunks)
  • Flow.Launcher/CustomQueryHotkeySetting.xaml.cs (2 hunks)
  • Flow.Launcher/Flow.Launcher.csproj (1 hunks)
  • Flow.Launcher/Helper/HotKeyMapper.cs (3 hunks)
  • Flow.Launcher/HotkeyControl.xaml.cs (7 hunks)
  • Flow.Launcher/HotkeyControlDialog.xaml.cs (7 hunks)
  • Flow.Launcher/Languages/en.xaml (0 hunks)
  • Flow.Launcher/Resources/Pages/WelcomePage2.xaml (1 hunks)
  • Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs (1 hunks)
  • Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs (2 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml (1 hunks)
💤 Files with no reviewable changes (1)
  • Flow.Launcher/Languages/en.xaml
🔇 Additional comments (65)
Flow.Launcher/Helper/HotKeyMapper.cs (8)

7-8: ChefKeys integration.
The addition of ChefKeys imports aligns with the new hotkey management system.


16-16: Blank line addition.
No functional impact.


22-24: Starting the ChefKeysManager early.
Registering the default hotkey and calling Start() here is logical. Just ensure _settings.Hotkey is valid on startup to avoid runtime errors.


28-28: ToggleHotkey method.
Logic appears correct: ignoring hotkeys when _mainViewModel.ShouldIgnoreHotkeys() is true and then toggling the launcher otherwise.


34-36: Registering hotkeys with collision checks.
Invoking ChefKeysManager.RegisterHotkey(...) directly is concise, but consider verifying collisions or handling potential exceptions.


39-42: Conditional unregistration.
Good safeguard for empty hotkey strings.


55-55: Registering custom plugin hotkey.
Well-structured callback to handle custom queries.


70-72: CheckHotkeyAvailability and CheckHotkeyValid.
Straightforward pass-through to ChefKeysManager.

Flow.Launcher/HotkeyControl.xaml.cs (11)

4-4: Added System.Globalization import.
Confirm usage. If unused, consider removing to keep dependencies lean.


16-17: Introducing a dialog field.
Storing the HotkeyControlDialog instance suggests repeated dialog usage.


80-82: Hotkey model creation.
Reading the hotkey string into a HotkeyModel and setting UI displays is clear and more maintainable than inline string parsing.


134-136: CheckHotkeyValid pass-through.
Delegating validity checks to HotKeyMapper.CheckHotkeyValid. Straightforward approach.


137-138: CheckWPFHotkeyAvailability method.
Calls ValidateForWpf. Keeps WPF-specific checks neatly encapsulated.


144-144: Defining CurrentHotkey.
Defaulting to an empty HotkeyModel on initialization ensures the remainder of the class can rely on a stable reference.


154-156: Instantiating HotkeyControlDialog.
Passing IsWPFHotkeyControl helps unify the logic for WPF vs. ChefKeys. Good to see ShowAsync usage for non-blocking UI.


172-191: SetHotkey logic.
• Checks for null or empty raw hotkey.
• Validates availability before assigning.
• Unregisters the old hotkey if WPF-based.
Overall, a clean approach to updating the hotkey while avoiding duplicates.


204-206: Delete flow.
Unregistering then resetting display is a sound pattern, preventing leftover registrations.


Line range hint 213-217: Handling empty or null hotkey.
Displays "none" if there's no key present—good for user clarity.


Line range hint 223-227: Availability check logic.
Selects the correct approach based on IsWPFHotkeyControl. Good handling for multi-environment hotkeys.

Flow.Launcher/HotkeyControlDialog.xaml.cs (18)

10-11: ChefKeys import.
Ensures the dialog can manipulate ChefKeysManager. Check whether all references to old hotkey libraries are safely removed or replaced.


23-31: New hotkey fields and flags.
CurrentHotkey and HotkeyToUpdate separation clarifies the difference between existing vs. pending changes. isWPFHotkeyControl further refines behavior.


52-53: ChefKeys Start Menu blocking.
Setting ChefKeysManager.StartMenuEnableBlocking = true indicates you’re blocking Windows key from opening Start. Verify no system-level side effects.


60-64: Synchronizing current and updated hotkey.
Assigning HotkeyToUpdate from CurrentHotkey ensures the dialog can revert or discard changes accurately.


66-68: Preloading display.
SetKeysToDisplay(CurrentHotkey) and resetting clearKeysOnFirstType to true is a clean approach for the initial dialog state.


71-72: Blocking Start Menu.
Confirm no user frustration arises from forcibly blocking the Start Menu while the dialog is open.


77-79: Reset action.
Directly overwriting HotkeyToUpdate with the default hotkey. Good for a full revert.


84-92: Delete action.
Clearing everything and returning the “none” display is consistent with a removed hotkey.


97-98: Disable blocking before cancel.
Correct to re-enable normal Windows key usage on cancel.


105-106: Disable blocking before save.
Similar application of re-enabling the Windows key once the user commits or discards changes.


114-116: Constructing ResultValue.
Combining new and old hotkeys with a colon format is a neat way to pass them back to the caller.


127-132: Handling first typed key.
Clearing keys for the first input is an intuitive approach—prevents leftover data from previous sessions.


134-135: Ignore StartMenuSimulatedKey.
Preventing a duplicated input from the simulated Windows key ensures cleaner user experience.


137-143: ChefKeys usage vs. WPF usage.
Splitting logic for isWPFHotkeyControl ensures that multi-key combos for ChefKeys do not conflict with the single-key WPF approach.


157-172: KeysToDisplay handling.
Properly clearing UI states and falling back to “none” if empty. The code consistently updates the list for user feedback.


Line range hint 183-207: Detecting registered hotkeys.
Displays a helpful message and toggles button availability if the key is already occupied. Great user feedback approach.


223-227: Combined WPF & ChefKeys validation.
Uses the appropriate check method, then toggles the UI depending on success or failure. Nicely integrated.


242-246: Distinguishing check methods.
Splitting availability checks for standard hotkeys vs. WPF gestures clarifies code flow.

Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs (17)

6-6: Optional plugin reference.
Flow.Launcher.Plugin might be used for Key enumeration or extended checks. Ensure no unintentional coupling.


17-19: New string properties.
HotkeyRaw and PreviousHotkey facilitate incremental or specialized changes.


56-61: SetHotkeyFromString method.
Separating parsing from the constructor is cleaner and more extensible.


64-73: WPF-specific hotkey assignment.
Accurately sets modifiers and re-derives HotkeyRaw. Good for bridging both ChefKeys and WPF usage.


75-78: String-based constructor.
Calls SetHotkeyFromString(hotkey). Straight to the point.


89-94: AddString for ChefKeys combos.
Allows incremental building of multi-key combos. Good design for repeated input flows.


95-96: MaxKeysReached check.
Prevents overly complex combos that might confuse users or exceed system constraints.


97-105: Clear method.
Resets the struct to a blank state, including HotkeyRaw and PreviousHotkey.


116-121: Handling LeftAlt/RightAlt.
Expanding to specific alt keys ensures granular control over hotkey usage.


124-129: Handling LeftShift/RightShift.
Similarly helps differentiate shift keys.


132-137: Handling LWin and RWin.
Matches PR objective to allow left or right Windows key usage independently.


140-145: Handling LeftCtrl/RightCtrl.
Completes the suite of side-specific modifiers.


170-174: ToChefKeysString.
Joins the enumerated display keys for consistent ChefKeys usage.


177-178: DisplayKeysRaw.
Returns the raw hotkey tokens to support dynamic UI updates.


179-207: EnumerateDisplayKeys.
Smart approach to unify how keys are displayed. Conditionals for hidden Key.LWin, etc., keep logic clean for different contexts.


209-225: Key string conversion for ChefKeys.
Mapping generic “Ctrl/Alt/Shift/Win” to side-specific forms is a good design choice.


230-234: ValidateForWpf.
Ensures that partial modifiers like LeftShift or RightShift are not used as the primary key, which avoids invalid gestures.

Flow.Launcher.Infrastructure/KeyConstant.cs (2)

6-7: Introducing LeftAlt constant.
Adds clarity by differentiating left vs. generic alt references.


10-10: File end blank line.
No issue identified.

Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs (1)

30-30: Validate hotkey uniqueness and potential conflicts.
While switching from SetHotkey to RegisterHotkey, ensure that HotkeyRaw is guaranteed to be unique or conflict-free in the rest of the system. If another component registers the same hotkey, that might cause unexpected behavior.

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs (2)

40-40: Confirm validation of user-supplied hotkey strings.
Using HotkeyControl.CurrentHotkey.HotkeyRaw directly may bypass validation if HotkeyRaw is not checked. Ensure that invalid or duplicate hotkeys are handled gracefully.


52-52: Cleanly handle unregistered hotkeys.
Unregistering the old hotkey is a good practice. Ensure that any side effects, like disposal events or callbacks, are also addressed to prevent memory leaks or leftover event handlers.

Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs (2)

36-36: Confirm thorough testing for custom toggling logic.
While using RegisterHotkey for toggle functionality can simplify code, double-check that toggling works correctly if the user rebinds the hotkey or uses multiple toggle hotkeys.


60-60: Prevent orphaned references when deleting hotkeys.
Unregistering the custom hotkey is essential, just confirm that the UI or internal references to the removed hotkey are also cleared so there's no inconsistent state left behind.

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

121-121: Ensure correct tool handling of IsWPFHotkeyControl.
Setting this property to False means the WPF input pipeline won't treat this hotkey control in the default WPF hotkey manner. Make sure the new approach is tested across different OS versions if possible.

Flow.Launcher/CustomQueryHotkeySetting.xaml (1)

110-111: Confirm consistency of IsWPFHotkeyControl usage across the codebase.

Marking IsWPFHotkeyControl="False" signals that this hotkey control uses the new ChefKeys approach rather than the WPF-based hotkey mechanism. This is appropriate if the rest of the newly introduced hotkey handling indeed covers all of this control’s needs. Verify that no logic relying on the old WPF hotkey handling is inadvertently bypassed.

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

18-18: Double-check conflicts with OS-level shortcuts.

Switching the default app hotkey to LeftAlt + Space might conflict with the Windows system menu shortcut. Ensure that this override is intentional and will not hamper standard user workflows.

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml (1)

36-41: Beware of potential Alt+Space conflicts outside WPF.

The new default hotkey "LeftAlt+Space" here matches the updated setting from Settings.cs. Confirm that this override does not intercept the normal behavior of Alt+Space (typically the system menu) unless that is the intended functionality. Also, setting IsWPFHotkeyControl="False" ensures ChefKeys handles it rather than typical WPF hotkey logic, so keep usage consistent throughout the solution.

@jjw24 jjw24 changed the title Support for Windows key & four-combination hotkey Support the use of Windows key & four-combination hotkey Jan 1, 2025
@jjw24 jjw24 marked this pull request as draft January 1, 2025 03:38

This comment has been minimized.

@Yusyuriv
Copy link
Member

Yusyuriv commented Jan 1, 2025

I found a few issues:

  1. After a quick glance at the code, I assume Left Alt and Right Alt are now different. When I select Left Alt + Space, it's still displayed as Alt + Space in settings:
    image
    image
    If I'm mistaken, disregard points 1 and 2.
  2. Here's what I saved:
    image
    Here's how it displays in settings:
    image
    Here's what's there when I open the hotkey change dialog again:
    image
  3. It seems to allow using the same key multiple times, but then displays the "Current hotkey is unavailable" message.
    image
  4. When holding Right Alt, this happens:
    image
    I have to press and release it to prevent this from happening:
    image
    This also happens when holding several keys at the same time:
    image
  5. I think it's incredibly confusing for the user that:
    • in most hotkey dialogs they need to hold all keys at the same time, and if they press a new key, it replaces the previous one
    • in "Open Flow Launcher" and custom query hotkeys they need to kind of type them one by one, and if they want to change what they typed, they need to press the "Reset" button.
  6. I would assume that if the user assigns a hotkey with Win button in it, they want to suppress Windows' native actions with the same hotkey. When it's just the Win button, it works, the Start menu doesn't open, but if I assign, for example, Win + R, Flow Launcher open for a fraction of a second and then hides again because Windows' native Win + R menu opened and took the focus.
    • This affects all hotkeys, not just the Win + Something. I can't properly use Alt + Space either because Flow let's those keys through to the currently focused program. For example, if I press Alt + Space in WebStorm, Flow does appear, but WebStorm also gets this sequence of key presses. It does the standard Windows thing with them, which is to open a context menu for the window with buttons to close it, minimize, maximize, etc.
      image

This comment has been minimized.

This comment has been minimized.

Copy link

github-actions bot commented Jan 5, 2025

@check-spelling-bot Report

🔴 Please review

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

❌ Errors Count
❌ forbidden-pattern 22
❌ ignored-expect-variant 1
⚠️ non-alpha-in-dictionary 19

See ❌ Event descriptions for more information.

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
Labels
30 min review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Win key as hotkey to trigger flow
2 participants