Skip to content

feat: add running page keyboard shortcuts - #1298

Open
m-altaifi wants to merge 2 commits into
GyulyVGC:mainfrom
m-altaifi:feat/running-page-shortcuts
Open

feat: add running page keyboard shortcuts#1298
m-altaifi wants to merge 2 commits into
GyulyVGC:mainfrom
m-altaifi:feat/running-page-shortcuts

Conversation

@m-altaifi

Copy link
Copy Markdown

Summary

  • adds Ctrl+1, Ctrl+2, and Ctrl+3 shortcuts for the Overview, Inspect, and Notifications pages
  • keeps the shortcuts scoped to the running view so settings and modals are not changed behind overlays
  • adds unit coverage for direct page switching and unread notification reset behavior

Testing

  • cargo fmt --check
  • cargo check
  • cargo test test_correctly_switch_running_page_with_shortcut (blocked locally: link.exe cannot find wpcap.lib)

Refs #97

@GyulyVGC GyulyVGC added the enhancement New feature, request, or improvement label Aug 31, 2026
Comment thread src/gui/types/message.rs
/// Hides the current setting page
CloseSettings,
/// Permits to change the current running page
ChangeRunningPage(RunningPage),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have the ChangeRunningPage message. Why not reusing it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call — done in 7e89d0a. Dropped RunningPageShortcut entirely; Ctrl+1/2/3 now emit ChangeRunningPage directly.

Comment thread src/gui/sniffer.rs Outdated
}
}

fn running_page_shortcut(&mut self, running_page: RunningPage) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can update change_running_page with these side-effects guard?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — the guard is now an early return in change_running_page, so running_page_shortcut is gone and the tab-bar click path gets the same protection.

One thing to flag: test_conf and test_toggle_thumbnail were driving ChangeRunningPage from states the guard now rejects (no running page, or settings open), so I added explicit setup to both. Those states are unreachable from the real UI, but shout if you'd rather the guard were narrower.

Address review feedback: drop the RunningPageShortcut message and emit
the existing ChangeRunningPage from the Ctrl+1/2/3 shortcuts. The
side-effect guard moves into change_running_page so the tab-bar path is
covered too.

Two existing tests drove ChangeRunningPage from states the guard now
rejects (no running page / settings open); they set the state explicitly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, request, or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants