Skip to content

[Repo Assist] Fix: notify user when global hotkey registration failsΒ #90

Description

@github-actions

πŸ€– This pull request was created by Repo Assist, an automated AI assistant.

Problem

RegisterHotKey() is called for Ctrl+Shift+L, Ctrl+Shift+↑, and Ctrl+Shift+↓ without checking the return value. If another application already holds one of these shortcuts (e.g. a screen-recording tool using Ctrl+Shift+L), the call silently returns false and the hotkey stops working with no feedback to the user.

Fix

Adds a RegisterHotKeyWithFeedback helper that:

  1. Checks the return value of RegisterHotKey
  2. On the first failure, shows a tray balloon notification (6 seconds) identifying the conflicting shortcut by name
  3. Sets _hotkeyWarningShown = true so only one balloon is shown per session β€” no spam

No new dependencies. Purely additive β€” existing behaviour is unchanged when hotkeys register successfully.

Closes #65

Test Status

Step Result
dotnet build /p:EnableWindowsTargeting=true βœ… 0 errors, 0 warnings

Note

πŸ”’ Integrity filter blocked 3 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #68 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #26 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • Detect camera is being used by another application and automatically turn onΒ #21 list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Repo Assist Β· ● 2.2M Β· β—·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/fix-hotkey-feedback-pr-2026-06-27-18534a75b511a2e6.

Click here to create the pull request

To fix the permissions issue, go to Settings β†’ Actions β†’ General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (80 of 80 lines)
From 652ecca3bf69966351a8a5d53d31469d80461cf1 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
 <41898282+github-actions[bot]@users.noreply.github.com>
Date: Thu, 18 Jun 2026 14:02:17 +0000
Subject: [PATCH] fix: notify user when global hotkey registration fails

RegisterHotKey() is called for Ctrl+Shift+L, Ctrl+Shift+Up, and
Ctrl+Shift+Down without checking the return value. If another app
already owns one of these shortcuts the call silently fails and the
hotkey stops working with no feedback.

Add RegisterHotKeyWithFeedback() helper that:
- Checks the bool returned by RegisterHotKey
- Shows a tray balloon tip on the FIRST failure only (no spam)
- Identifies the conflicting shortcut by name in the tip text
- Logs subsequent failures to Debug only

Build: 0 errors, 0 warnings (net10.0-windows, EnableWindowsTargeting=true)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 WindowsEdgeLight/MainWindow.xaml.cs | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/WindowsEdgeLight/MainWindow.xaml.cs b/WindowsEdgeLight/MainWindow.xaml.cs
index c24a3c7..6435ddf 100644
--- a/WindowsEdgeLight/MainWindow.xaml.cs
+++ b/WindowsEdgeLight/MainWindow.xaml.cs
@@ -134,6 +134,8 @@ public partial class MainWindow : Window
     private IntPtr mouseHookHandle = IntPtr.Zero;
     private LowLevelMouseProc? mouseHookCallback;
 
+    private bool _hotkeyWarningShown = false;
+
     private Rect? frameOuterRect;
     private Rect? frameInnerRect;
     private readonly Ellipse? hoverCursorRing;
@@ -298,10 +300,10 @@ Version {version}";
         int extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
         SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT | WS_EX_LAYERED);
         
-        // Register global hotkeys
-        RegisterHotKey(hwnd, HOTKEY_TOGGLE, MOD_CONTROL | MOD_SHIFT, VK_L);
-        RegisterHotKey(hwnd, HOTKEY_BRIGHTNESS_UP, MOD_CONTROL | MOD_SHIFT, VK_UP);
-        RegisterHotKey(hwn
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions