Skip to content

Show: Presenter View only with a second display - #1156

Merged
FredApps merged 7 commits into
storytold:mainfrom
melandur:main
Nov 5, 2026
Merged

FredApps merged 7 commits into
storytold:mainfrom
melandur:main

Conversation

@melandur

@melandur melandur commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

With one display the presenter window opened on the same screen as the show. Under Hyprland's focus-follows-mouse, whichever window the pointer was over took full screen, and the hidden one stalled every frame: the show lagged, dropped key presses or froze.

One display now shows only the slides; Presenter View needs a second display. PowerPoint does the same: on one display, SlideShowSettings.Run() with ShowPresenterView = True opens only the slide show (tested by Harrison-Booth on #433).

  • Services::displays lets the host report how many displays are connected; SlideApp::start_show asks it once per show. Hosts that can't tell (web, a failed query) keep Presenter View.
  • On Linux the desktop app counts winit's available_monitors() for its window, counting a display Wayland lists twice once (as Better dual screen and Wayland handling #1184 does). No new dependencies: winit is already a direct dependency there.
  • macOS and Windows are unchanged. The same callback would cover them; I left them out because I haven't checked PowerPoint for Mac and can't test either.
  • The Presenter View setting still turns it off on two displays.

This is the one-display part of #1184 on its own, without its window placement or the switch to Wayland. If #1184 lands first, I'll close this.

Test: presenter_view_needs_a_second_display (1, 2 and unknown displays, setting off). cargo test -p deckcraft-ui-egui -p deckcraft passes; clippy and fmt are clean.

Summary by CodeRabbit

  • Bug Fixes
    • Presenter View stays off when Linux or BSD reports exactly one display. When the display count is unavailable, the presenter setting is retained; reading mode and a disabled presenter setting still prevent Presenter View from opening.
  • Documentation
    • Updated slideshow and hardware compatibility guidance to clarify how Presenter View behaves when Linux or BSD reports one display or cannot determine the display count.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

DeckCraft reports an optional display count on non-macOS Unix platforms. The UI uses this count when deciding whether to enable Presenter View. Tests cover one display, two displays, an unknown count, and a disabled presenter setting.

Changes: Display-aware Presenter View

Layer / File(s) Summary
Display count service
crates/ui-egui/src/services.rs, apps/deckcraft/src/main.rs
Services adds an optional display-count callback. On non-macOS Unix platforms, DeckCraft assigns a callback that counts distinct available monitors.
Presenter View display gate
crates/ui-egui/src/app/playback.rs, crates/ui-egui/src/presenter_tests.rs, ROADMAP.md, docs/hardware-parity.md, docs/slideshow-parity.md
Presenter View is disabled when fewer than two displays are reported. It remains enabled when the count is at least two or unavailable, if presenter mode is enabled and Reading mode is off. Tests cover these conditions. The roadmap and parity documents record the Linux and BSD behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant SlideApp
  participant Services
  participant DeckCraft
  participant winitWindow
  SlideApp->>Services: Read display-count callback
  Services->>DeckCraft: Invoke callback
  DeckCraft->>winitWindow: Read available monitors
  winitWindow-->>DeckCraft: Return monitor list
  DeckCraft-->>Services: Return distinct count or None
  Services-->>SlideApp: Provide display count
  SlideApp->>SlideApp: Enable Presenter View if count is at least two or unknown
Loading

Possibly related issues

Suggested reviewers: fredapps, faabyy

Merge Risk: Minimal · previous review 1e975

Presenter View stays off when one display is reported and retains its setting when the display count is unavailable. No merge-blocking issue was identified.

Security architecture risk: Minimal · up to 412ad

The display count only narrows when Presenter View opens. It does not add remote access, privileges, or access to presentation data. Failed or unavailable counts preserve existing behavior. Display discovery is synchronous, so an unresponsive display server could delay starting a show.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new callback's effective scope is Presenter View selection in the calling desktop application. Its result supplies a count, not an identity, credential, file destination, or executable action.

Trust Boundaries and Controls

  • observed — The callback is installed by desktop initialization and reads display-server state, rather than slide content or control-request parameters. Existing control requests still call start_show or start_custom_show and cannot replace the callback through those request parameters.

Resilience and Maintainability Implications

  • inferred — The synchronous query introduces a possible stall between clearing preview/editor-owned playback and creating the new Show. Returned failures continue normally through the unknown-count fallback, but a nonreturning display-server request would delay the UI transition. The inspected path does not establish a new attacker with authority independent of the application's existing display-server dependency.
Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: Presenter View opens only when a second display is available.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 4 files. (3 skipped: 3 unsupported.)

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 487bdec and 1e975da.

Files selected for processing: 3

  • ROADMAP.md
  • docs/hardware-parity.md
  • docs/slideshow-parity.md
Files skipped from review as they are similar to previous changes: 3

  • ROADMAP.md
  • docs/hardware-parity.md
  • docs/slideshow-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@pick2510

Copy link
Copy Markdown
Contributor

This overlaps with #433 (NikitkaRa, slide show on the other display). The two answer different questions: #433 decides where the show and Presenter View go, and this PR decides whether Presenter View opens at all. But they each learn about the displays in their own way:

  • Present: put the slide show on the other display #433 gets the full monitor list from winit every frame (available_monitors(), primary_monitor() → SlideApp::displays), on all desktop platforms.
  • This PR adds a separate count through Services::displays, only on Linux (wl_output / RandR).

If both land as they are, DeckCraft has two independent display queries. Once #433 is in, the check here could be self.displays.len() >= 2. That would also cover macOS and Windows with no extra code. Or is there a reason winit's list isn't reliable on Hyprland?

Both PRs also change the same line in start_show and add a field to SlideApp/Services next to each other, so whichever lands second needs a small rebase.

On the behaviour itself: I tested #433 on a Mac (results in #433 (comment)). With one display, Presenter View opens there as a floating window next to the full-screen show. The description says that with one display PowerPoint shows only the slides. I haven't checked that against PowerPoint for Mac, so it would be good to confirm before this rule applies beyond Linux.

@melandur

Copy link
Copy Markdown
Contributor Author

Thanks, agreed. I tested a version on top of #433 locally (main + #433 + self.displays.len() != 1; != 1 because #433 leaves the list empty in the browser and tests, where Presenter View should stay). I'll drop displays.rs, the wayland-client/x11rb deps and Services::displays.

On one display under Hyprland, with a real deck: with #433 alone, Presenter View opens on the same screen and every slide change takes up to ~1 s; with the gate, only the show opens and keys respond in ~1 ms. The new test and #433's display tests pass.

winit's list is reliable here: with a virtual second monitor, both RandR and winit (X11 backend via XWayland) reported 2 displays with the right primary every time, and SlideApp::displays had both when the show started. What doesn't work on Hyprland is the placement in #433: the show doesn't move to the other display and Presenter View isn't maximised, so both windows still end up on the same screen with the same ~1 s lag (as the #433 description notes, Wayland ignores window positions). I couldn't test with a physical second monitor.

Once #433 lands I'll rebase this PR. I haven't checked PowerPoint for Mac's single-display behaviour, so I'll drop that claim from the description.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: Presenter View is offered only with a second display. The application adds wayland-client 0.31 and x11rb 0.13 (with randr) as direct dependencies for counting displays in displays.rs ("both already come with winit"). Making the count depend on direct protocol clients is a new direct dependency pair in the application on the Wayland and X11 side, and counting monitors is something winit offers itself (available_monitors), so the suite should prefer the winit call unless there is a documented reason. The Wayland question (suite-wide) applies. The macOS and Windows paths are separate. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

With one display the presenter window opened on the same screen as the show. Under Hyprland's
focus-follows-mouse, whichever window the pointer was over took full screen, and the hidden one
stalled every frame: the show lagged, dropped key presses or froze.

One display now shows only the slides, as in PowerPoint. The host counts displays through winit's
monitor list when a show starts; hosts that can't tell keep Presenter View.
@melandur

melandur commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Reworked as suggested (thanks @pick2510, @FredApps): the count now comes from winit's available_monitors(), and displays.rs and the wayland-client/x11rb dependencies are gone. Rebased on current main (now +48/−1, 4 files).

#433 needs a larger rebase since show.rs was split, and #1184 has since added the same one-display rule, so I didn't wait for either. The callback has the same shape as #1184's Services::screens, so whichever lands second is a small change; if #1184 lands first I'll close this.

On PowerPoint: Harrison-Booth's test on #433 (PowerPoint 16 through COM, one display) opened only the slide show. I dropped the Mac claim and left macOS and Windows unchanged.

Tested on Hyprland with a 20 MB deck, Presenter View on, timing Right-arrow presses through the control port.

One 3440×1440 monitor:

Build Backend Windows Per slide change
main X11 / Wayland show + Presenter View on top of it ~1700 / ~200 ms
this PR X11 / Wayland show only, full screen ~1 / ~0 ms

Two 3440×1440 monitors:

Build Backend Windows Per slide change
this PR X11 / Wayland both open, same monitor (unchanged from main) ~1700 / ~200 ms
#1184 Wayland (its default) show on the 2nd monitor, Presenter View on the 1st ~0 ms
#1184 X11 (DECKCRAFT_X11=1) both on the same monitor ~1700 ms

So this PR fixes one display; two displays on Hyprland still need placement, which only #1184 managed here, and only on native Wayland.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread apps/deckcraft/src/main.rs Resolved
Comment thread apps/deckcraft/src/main.rs Resolved
@echelon

echelon commented Nov 2, 2026

Copy link
Copy Markdown
Member

Thanks for the update. #1607 also opens Presenter View only when a second display is connected, so I'm holding both until one is chosen.

Wayland lists one output twice under the same wl_output id, so comparing handles counts it once, and two separate displays with the same name and geometry still count as two.
slideshow-parity and hardware-parity note that on Linux one display shows only the slides, with status lines and revision history; ROADMAP progress log. display_count collects into a BTreeSet (MonitorHandle's Ord matches its Eq).
@melandur

melandur commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

#1607 is closed in favour of this one (thanks @Moryavendil). As measured there, this also fixes #1567: with the presenter window gone on one display, video went from ~1 fps to 25 fps.

Since the last update: displays are now counted by MonitorHandle (CodeRabbit), and docs/slideshow-parity.md, docs/hardware-parity.md and the ROADMAP.md progress log describe the change.

Known limitation: on Wayland, a display unplugged after DeckCraft started is still counted. The pinned winit's new_output adds every display connected at startup a second time, and output_destroyed removes only one copy, so the count stays at 2 and Presenter View opens as it does on main today. The fix belongs in storytold/winit (skip an output that is already listed); I can open that separately.

Ready for review whenever you get to it.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread docs/slideshow-parity.md Resolved
Presenter View stays off when winit lists exactly one display; if it lists none, the setting is kept. The host callback covers Unix other than macOS, so the docs say Linux and the BSDs.
@melandur

melandur commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

The winit side of the unplug limitation is already open as storytold/winit#22 (thanks @Moryavendil). I tested it on Hyprland: an unplugged display is no longer counted. Once it lands, a winit rev bump here picks it up.

@aiongg aiongg added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 4, 2026

@aiongg aiongg left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI-generated review (Opus). Not a maintainer decision.

No blocking problems found (not certain).

Presenter View now opens only when winit lists at least two displays on Linux and the BSDs. Hosts that cannot count displays keep the setting as it was.

  • apps/deckcraft/src/main.rs:149-152 collects available_monitors() into a set, so an output Wayland lists twice counts once, and an empty list returns None.
  • crates/ui-egui/src/app/playback.rs:49-51 keeps Presenter View when the count is unknown (is_none_or), so the browser and tests are unaffected.
  • crates/ui-egui/src/app/playback.rs:35 still applies the Presenter View setting and reading mode before the display check, so the setting still turns it off on two displays.
  • start_show is the only place that creates a show with Presenter View, so menus, keys and the control channel all go through the new check.
  • With one display there is no way to switch to Presenter View by hand during the show; docs/slideshow-parity.md:44 records this.
  • On Wayland, a display unplugged after start-up is still counted, so in that case Presenter View can still open with only one display connected.

Claims checked:

  • verified: On Linux and the BSDs, Presenter View stays off when exactly one display is reported as the show starts (crates/ui-egui/src/app/playback.rs:35 ANDs second_display(); playback.rs:50 is true only for None or n >= 2; apps/deckcraft/src/main.rs:292-295 installs the callback only under cfg(all(unix, not…
  • verified: Hosts that can't tell (web, a failed query) keep Presenter View (crates/ui-egui/src/app/playback.rs:50 is_none_or keeps it when there is no callback or it returns None; apps/deckcraft/src/main.rs:151 returns None for an empty list)
  • verified: A display Wayland lists twice counts once (apps/deckcraft/src/main.rs:150 collects MonitorHandle values into a BTreeSet before counting)
  • verified: No new dependencies; winit is already a direct dependency on Linux (apps/deckcraft/Cargo.toml:43-44 already lists winit for cfg(all(unix, not(target_os = "macos"))); the PR changes no Cargo.toml)
  • verified: macOS and Windows are unchanged (apps/deckcraft/src/main.rs:148 and 292 are cfg-gated to non-macOS unix; elsewhere services.displays stays None, so crates/ui-egui/src/app/playback.rs:50 returns true)
  • verified: The Presenter View setting still turns it off on two displays (crates/ui-egui/src/app/playback.rs:35 self.ui.presenter_view && !reading && self.second_display())
  • verified: Matches reference app behaviour: on one display only the slide show opens (crates/ui-egui/src/app/playback.rs:35-51 opens only the show on one display; there is no manual switch, and docs/slideshow-parity.md:44 says so)
  • verified: a claim of the description (docs/slideshow-parity.md:44 Notes column now includes 'There is not yet a way to switch to Presenter View by hand during a one-display show.')

Recommendation: merge, after a maintainer's decision.

Reviewed at df1c00c.

@aiongg aiongg self-assigned this Nov 4, 2026
@aiongg

aiongg commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

AI-generated comment (Sonnet). Not a maintainer decision.

Merged main into this branch to resolve the conflict.

@aiongg aiongg removed their assignment Nov 4, 2026
@aiongg aiongg self-assigned this Nov 5, 2026
@aiongg

aiongg commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

AI-generated comment (Sonnet). Not a maintainer decision.

Merged main into this branch to resolve the conflict.

- docs/slideshow-parity.md
@aiongg

aiongg commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

AI-generated comment (Sonnet). Not a maintainer decision.

Pushed the small fixes from review: docs/slideshow-parity.md.

@aiongg aiongg removed their assignment Nov 5, 2026
@melandur

melandur commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@FredApps thanks for the review. That was the first version (412ad6a). The branch was rewritten in 124b573: displays.rs, wayland-client and x11rb are gone, and the count now comes from winit's own Window::available_monitors(), collected into a set of MonitorHandles (apps/deckcraft/src/main.rs, display_count). No new dependencies, and no Cargo.toml changes in the PR. CI passes at the current head (df1c00c).

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed at df1c00c. My earlier point is fully addressed: displays.rs, wayland-client and x11rb are gone, and the count now comes from winit's own Window::available_monitors() (deduplicated through a BTreeSet<MonitorHandle>), with no Cargo.toml changes.

  • playback.rs: second_display() is ANDed after the setting and reading-mode checks, and is_none_or(|n| n >= 2) keeps Presenter View when the host can't count (web, tests, empty list), so nothing changes off Linux/BSD.
  • start_show is the only place a show gets a presenter window, so menus, keys and the control channel all go through the check.
  • presenter_view_needs_a_second_display covers 1, 2 and unknown displays and the setting being off; without the new check, the one-display case would fail.
  • Docs and ROADMAP rows match the behaviour, including the known Wayland unplug limitation (storytold/winit#22).

CI is green on this exact head, which already contains current main. Not tested by me: a real multi-monitor setup or Hyprland/X11 by hand; macOS and Windows aren't affected by this change.

@FredApps
FredApps merged commit 73de990 into storytold:main Nov 5, 2026
7 checks passed
@FredApps

FredApps commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Merged, thank you @melandur! 🎉

On Linux and the BSDs, a slide show on a single display now opens without Presenter View, as PowerPoint does, so the hidden presenter window no longer stalls the show (and video playback on one display goes back to full frame rate). The display count comes straight from winit's available_monitors() with no new dependencies, hosts that can't count keep the old behaviour, and the Presenter View setting still applies on two displays. Thanks as well for rewriting it after my first review and for chasing the unplug case into storytold/winit#22.

No changes were needed from our side; squash-merged as 73de990.

alosslessdev pushed a commit to alosslessdev/deckcraft that referenced this pull request Nov 5, 2026
Four conflicts, all keeping both intents: ROADMAP keeps main's Linux/BSD
Presenter View row below this branch's two Record rows; `Services` keeps the
microphone, camera and new `displays` fields; the hardware and slideshow headers
take this branch's 2026-11-03 change with storytold#1156 folded into their previous
chain, and the slideshow revision table keeps both rows.
scks1 added a commit to scks1/deckcraft that referenced this pull request Nov 5, 2026
Main at 73de990. ROADMAP.md was the only conflict: main's storytold#1156
progress-log row went in where this branch's row is. Both rows are
kept in the log's date order, this branch's 2026-11-03 row above
main's 2026-11-02 row.

AI assistance: written with Muse Árbol, an AI assistant, under
@scks1's direction.
scks1 added a commit to scks1/deckcraft that referenced this pull request Nov 5, 2026
Main at 73de990. ROADMAP.md was the only conflict: main's storytold#1156
progress-log row went in where this branch's row is. Both rows are
kept in the log's date order, this branch's 2026-11-03 row above
main's 2026-11-02 row.

AI assistance: written with Muse Árbol, an AI assistant, under
@scks1's direction.
RealRules added a commit to RealRules/deckcraft that referenced this pull request Nov 5, 2026
docs/slideshow-parity.md: upstream's status line folded into the strip's, and both revision rows kept (strip, then storytold#1156).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kbarni added a commit to kbarni/deckcraft that referenced this pull request Nov 5, 2026
main's Presenter View display count (storytold#1156: `Services::displays`, `second_display`) is
replaced by this branch's `Services::screens`, which already keeps Presenter View off on one
screen and keeps it when the host can't tell. main's test for that rule now runs on `screens`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nhdai111983 pushed a commit to nhdai111983/deckcraft that referenced this pull request Nov 9, 2026
…xusOffice host

Upstream storytold#1156 added `Services::displays` (winit counts displays) and checked it inside the
show-starting path, which also overrode the Nexus Alt+F5 "Presenter View on request" and left
`presenter` unused (clippy -D warnings). The rule now lives in `second_display`: the NexusOffice
host's `SlideApp::displays` wins, a counter that can't tell keeps Presenter View as upstream
does, and with neither the computer has one display (QC-SLD-02).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NQJvTQTLHW8xqCj4U8Pzcm
kinower pushed a commit to kinower/deckcraft that referenced this pull request Nov 21, 2026
…s with Displays

storytold#1156 on main added Services::displays (a display count, Linux/BSD only);
this branch adds Services::displays (the Displays list). Keep both: main's
becomes display_count. No behaviour change.

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

Labels

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants