Skip to content

fix: allow clearing global hotkeys from UI and keyboard#308

Open
Kirtan-pc wants to merge 1 commit into
SamXop123:mainfrom
Kirtan-pc:fix/allow-clearing-hotkeys
Open

fix: allow clearing global hotkeys from UI and keyboard#308
Kirtan-pc wants to merge 1 commit into
SamXop123:mainfrom
Kirtan-pc:fix/allow-clearing-hotkeys

Conversation

@Kirtan-pc

@Kirtan-pc Kirtan-pc commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a mechanism to clear/disable global hotkeys directly from the settings panel.

Previously, there was no way to clear a configured hotkey back to "None" via UI controls or intuitive keyboard shortcuts. Furthermore, pressing Escape during key recording erroneously cleared the hotkey rather than cancelling/discarding the edit.

fixes Issue #283

Changes

  • Clear Buttons Added: Added a styled "Clear" button next to each hotkey row in settings.html.
  • Keyboard Handling Updated:
    • Pressing Backspace or Delete during hotkey edit mode clears the hotkey to "None" and saves immediately.
    • Pressing Escape during edit mode cancels the edit and restores the previous shortcut value (without saving).
  • Edit State Integration: Both "Edit" and "Clear" buttons are appropriately enabled/disabled when edit mode starts or ends to prevent UI race conditions.

Testing

  1. Open Settings → Hotkeys.
  2. Click Edit on a hotkey:
    • Press a key combination to customize it.
    • Click Cancel or press Escape → verification that it reverts to the original configuration.
  3. Click Edit on a hotkey:
    • Press Backspace or Delete → verification that the hotkey is set to "None", the UI displays "None", and the status message says ✓ [Hotkey Name] hotkey cleared.
  4. Click the Clear button directly → verification that it immediately sets the hotkey to "None", saves it, and displays the success toast.

Summary by CodeRabbit

  • New Features

    • Added a Clear option for each global hotkey, making it easier to remove an assigned shortcut.
    • Updated hotkey editing so Backspace or Delete clears a shortcut, while Escape now cancels editing without changes.
  • UI Improvements

    • Refined the Global Hotkeys section copy to explain the updated keyboard behavior.
    • Adjusted the layout to better fit the new controls and status messages.

Adds a mechanism to set a global hotkey to 'None' (disabled) from the
settings panel:
- Added 'Clear' buttons next to each hotkey row in settings.html.
- Pressing Backspace or Delete during edit mode now clears the hotkey
  to 'None' and saves immediately.
- Pressing Escape now correctly discards the edit and reverts to the
  previous hotkey value instead of clearing it.
- UI buttons are correctly disabled/enabled during edit mode to prevent
  conflicting clicks.
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@Kirtan-pc is attempting to deploy a commit to the Dot_NotSam's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c8fff7c8-8150-4d2c-8d32-de0ba3da5fbd

📥 Commits

Reviewing files that changed from the base of the PR and between c891a76 and 9cda136.

📒 Files selected for processing (2)
  • settings.html
  • settings.js

📝 Walkthrough

Walkthrough

Adds a Clear button for each configurable hotkey in the settings UI, updates the instructional paragraph to describe Backspace/Delete and Escape behavior, and reworks the keydown handler so Backspace/Delete clears a hotkey while Escape cancels edit mode without changes. Clear buttons are disabled alongside Edit buttons during active recording.

Changes

Hotkey Clear Button and Keyboard Shortcut Rework

Layer / File(s) Summary
HTML: Clear buttons and updated instructions
settings.html
Adds Clear buttons for each hotkey (Pause/Resume, Hide/Show, Cycle Active Theme), updates the instructional paragraph to mention Backspace/Delete and Escape behavior, and widens the controls container and status message.
JS: Clear handler, edit mode, and keydown logic
settings.js
Adds clearBtnId to hotkey definitions and wires click handlers that set the value to "None" and dispatch the update. Disables/re-enables clear buttons alongside edit buttons during edit mode. Changes Escape to cancel without clearing; Backspace/Delete now clear and exit edit mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

🐇 A button to clear, a key to erase,
Backspace and Delete now tidy the space.
Escape says "no changes, I'll leave it be,"
While Clear wipes the hotkey with rabbit-like glee.
The settings are tidier—hip hip hooray! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: clearing global hotkeys from both the UI and keyboard.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant