Skip to content

feat: adapt authorization dialogs for multi-monitor setups - #11

Merged
Hureru merged 1 commit into
mainfrom
feature/multiscreen-auth-dialog
Jun 5, 2026
Merged

feat: adapt authorization dialogs for multi-monitor setups#11
Hureru merged 1 commit into
mainfrom
feature/multiscreen-auth-dialog

Conversation

@Hureru

@Hureru Hureru commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Close #5

Summary by CodeRabbit

  • New Features

    • Improved dialog window placement for multi-monitor setups; dialogs now center on the active monitor (or mouse display on Windows).
  • Documentation

    • Updated architecture documentation to reflect enhanced window positioning and focus behavior for authorization dialogs.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0b88420-8d53-4d75-b5f7-8cbd60af25ba

📥 Commits

Reviewing files that changed from the base of the PR and between 406bbd2 and 8865c92.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • crates/sshwarden-ui/Cargo.toml
  • crates/sshwarden-ui/src/bind_hosts/slint_dialog.rs
  • crates/sshwarden-ui/src/lib.rs
  • crates/sshwarden-ui/src/notify/slint_dialog.rs
  • crates/sshwarden-ui/src/unlock/slint_dialog.rs
  • crates/sshwarden-ui/src/window_placement.rs
  • llmdoc/architecture/slint-authorization-dialog.md
  • llmdoc/architecture/sshwarden-windows-hello-unlock.md
  • llmdoc/index.md
  • llmdoc/overview/project-overview.md

📝 Walkthrough

Walkthrough

This PR implements multi-monitor dialog support by extracting window positioning logic into a dedicated utility module. The implementation detects the active monitor on Windows using cursor position and Win32 APIs, falls back to generic winit monitor selection, then centers dialogs within the selected monitor's bounds before focusing the window.

Changes

Multi-Monitor Dialog Placement

Layer / File(s) Summary
Window placement utility implementation
crates/sshwarden-ui/src/lib.rs, crates/sshwarden-ui/Cargo.toml, crates/sshwarden-ui/src/window_placement.rs
Introduce center_on_active_monitor_and_focus() entry point that attempts Windows-specific cursor-based active monitor detection using MONITORINFO and Win32 APIs, falls back to winit monitor selection (current, primary, or first available), and centers the dialog window using saturating arithmetic within the detected monitor bounds. The ScreenBounds struct validates monitor geometry with safe i32 conversions. Remove slint-center-win dependency and add Win32_Graphics_Gdi feature.
Dialog file integration
crates/sshwarden-ui/src/bind_hosts/slint_dialog.rs, crates/sshwarden-ui/src/notify/slint_dialog.rs, crates/sshwarden-ui/src/unlock/slint_dialog.rs
Replace slint_center_win::center_window and manual winit window focus calls with crate::window_placement::center_on_active_monitor_and_focus() in all three dialog implementations.
Architecture and project documentation
llmdoc/architecture/slint-authorization-dialog.md, llmdoc/architecture/sshwarden-windows-hello-unlock.md, llmdoc/overview/project-overview.md, llmdoc/index.md
Document the new window placement strategy describing Windows cursor-based active monitor detection with winit fallback, monitor work-area centering, and dialog focus behavior. Update project overview Tech Stack and Key Design Decisions sections. Add new documentation index query entry for multi-screen placement and synchronized update log entry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The PR introduces a sizable new utility module (145 lines) with platform-specific branching and Win32 API integration that requires careful review of bounds computation and monitor selection logic. The integration across three dialog files is straightforward and repetitive. Documentation updates are consistent and low-complexity, with one moderate-complexity architecture section describing the new flow.

Poem

🐰 From cursor's dance on multi-screens bright,
A dialog finds its rightful sight—
No more displaced to a distant pane,
Windows and fallbacks, a focused chain!
Centered at last, where the user can see,
This rabbit hops forward with UI glee! 🎪

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.54% 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: adapting authorization dialogs to work across multiple monitors, which is the core objective of this pull request.
Linked Issues check ✅ Passed The pull request successfully implements multi-monitor support for authorization dialogs by introducing a new window_placement module that centers dialogs on the active monitor and provides appropriate fallback behavior.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing multi-monitor dialog placement: removing the old slint_center_win dependency, creating the new window_placement module, updating dialog centering logic across three dialog types, and documenting the architectural changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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 and usage tips.

@Hureru

Hureru commented Jun 5, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Hureru
Hureru merged commit 0e047b7 into main Jun 5, 2026
6 checks passed
@Hureru
Hureru deleted the feature/multiscreen-auth-dialog branch June 5, 2026 09:08
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.

[Feature] 弹窗多屏幕支持

1 participant