Skip to content

fix: support custom keybindings for PR/Issue notifications#782

Merged
dlvhdr merged 4 commits intodlvhdr:mainfrom
sideshowbarker:fix/notification-custom-keybindings
Feb 21, 2026
Merged

fix: support custom keybindings for PR/Issue notifications#782
dlvhdr merged 4 commits intodlvhdr:mainfrom
sideshowbarker:fix/notification-custom-keybindings

Conversation

@sideshowbarker
Copy link
Contributor

@sideshowbarker sideshowbarker commented Feb 17, 2026

Problem: Custom keybindings defined under keybindings.prs or keybindings.issues in any user config unexpectedly do not work when viewing PR/Issue notifications in the Notifications dashboard.

Root cause: Both isUserDefinedKeybinding() and executeKeybinding() only handle PRsView, IssuesView, and RepoView — the NotificationsView case is missing entirely.

Fix: This PR adds NotificationsView handling that checks the notification’s subject type, and dispatches to the appropriate keybinding set.

Template variables

Template variables RepoName and PrNumber/IssueNumber are always available. When the sidebar is open (i.e., the user has pressed Enter to view the notification), additional fields are populated from the fetched PR/Issue data:

State PR template fields
Sidebar not open RepoName, PrNumber, RepoPath
Sidebar open + HeadRefName, BaseRefName, Author
State Issue template fields
Sidebar not open RepoName, IssueNumber, RepoPath
Sidebar open + Author

If a command template references a sidebar-only field before the sidebar is opened, the template engine’s missingkey=error option produces a clear error message.

@dlvhdr
Copy link
Owner

dlvhdr commented Feb 17, 2026

Yesss thank you!

@sideshowbarker sideshowbarker force-pushed the fix/notification-custom-keybindings branch 2 times, most recently from 5787089 to ff4bfcc Compare February 18, 2026 07:00
@dlvhdr
Copy link
Owner

dlvhdr commented Feb 18, 2026

I think we should also support overriding notification view specific keybinds, like - mark as done etc, as part of this pr.
This is done in https://github.com/dlvhdr/gh-dash/blob/main/internal/tui/keys/keys.go?plain=1#L224. WDYT?

…ations view

Both isUserDefinedKeybinding() and executeKeybinding() only handled
PRsView, IssuesView, and RepoView — the NotificationsView case was
missing entirely. Custom keybindings defined under keybindings.prs or
keybindings.issues were never recognized or executed when viewing
notifications.

Add NotificationsView handling that checks the notification's subject
type and dispatches to the appropriate keybinding set. Template variables
RepoName and PrNumber/IssueNumber are always available. When the sidebar
is open, HeadRefName, BaseRefName, and Author are also populated for PR
notifications, and Author for Issue notifications.
Fixes QF1012 staticcheck lint in branchsidebar.go.
Add keybindings.notifications config option, following the same pattern
as keybindings.prs, keybindings.issues, and keybindings.branches.

Users can now rebind built-in notification keys (view, markAsDone,
markAllAsDone, markAsRead, markAllAsRead, unsubscribe, toggleBookmark,
open, sortByRepo, switchToPRs, toggleSmartFiltering), and define custom
command bindings with RepoName and Number template variables.

Notification-specific custom commands are checked before the existing
PR/Issue subject-type custom commands, so they work regardless of what
type of notification is currently selected.
@sideshowbarker sideshowbarker force-pushed the fix/notification-custom-keybindings branch from ff4bfcc to 51e8a8a Compare February 19, 2026 02:11
@sideshowbarker
Copy link
Contributor Author

I think we should also support overriding notification view specific keybinds, like - mark as done etc, as part of this pr.
This is done in https://github.com/dlvhdr/gh-dash/blob/main/internal/tui/keys/keys.go?plain=1#L224. WDYT?

👍 Yes — made it so: sideshowbarker@51e8a8a

1 similar comment
@sideshowbarker
Copy link
Contributor Author

I think we should also support overriding notification view specific keybinds, like - mark as done etc, as part of this pr.
This is done in https://github.com/dlvhdr/gh-dash/blob/main/internal/tui/keys/keys.go?plain=1#L224. WDYT?

👍 Yes — made it so: sideshowbarker@51e8a8a

@dlvhdr dlvhdr merged commit e570fdc into dlvhdr:main Feb 21, 2026
3 of 4 checks passed
@sideshowbarker sideshowbarker deleted the fix/notification-custom-keybindings branch February 22, 2026 04:21
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.

2 participants