Prototype slide jumps, windowed slide browser and mirrored display roles

This commit is contained in:
Dandaedre 2026-11-19 16:41:17 +01:00
parent 7a2ad988b5
commit 9f79ba1c15
9 changed files with 168 additions and 16 deletions

View File

@ -17,3 +17,5 @@
- [Picture folders and notes requirements](docs/interfaces/picture-folders.md) (planned).
- [Interactive presenter menu concept](docs/design/presenter-menu.html) (browser mockup, not native UI).
- [Slide browser and mirrored display concept](docs/design/slide-browser.md).

2
Cargo.lock generated
View File

@ -921,7 +921,7 @@ dependencies = [
[[package]]
name = "pdf-presenter"
version = "0.1.9"
version = "0.1.10"
dependencies = [
"font8x8",
"softbuffer",

View File

@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
resolver = "3"
[workspace.package]
version = "0.1.9"
version = "0.1.10"
edition = "2024"
license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"

View File

@ -2,6 +2,17 @@
## Unreleased
### 0.1.10
- Add number + Enter slide jumps and a separate windowed thumbnail browser to the
HTML concept. Preview size is adjustable; clicks select without changing output
unless Change on click is enabled. Explicit Show selected changes the slide.
- Allow several simulated monitors per presenter/presentation role, with group swap
and missing-monitor fallback. The slide browser has a simulated monitor preference,
defaulting to presenter; actual monitor routing and native implementation are pending.
Validation: JavaScript syntax, real Firefox popup inspection, 24 navigation/popup/
mirrored-display checks and 24 existing layout/persistence regression checks.
### 0.1.9
- Allow hiding the current-slide preview in the HTML concept and saved layouts.

View File

@ -12,15 +12,16 @@ main{display:flex;flex-direction:column;min-height:430px;max-width:none}.preview
.slide-stage{flex:1;min-height:0;display:grid;place-items:center;container-type:size;background:#121c1f;border-radius:10px}.previews .slide-stage .slide{flex:none;width:min(100cqw,calc(100cqh * 16 / 9));height:auto;aspect-ratio:16/9;padding:7%;container-type:inline-size}.slide-stage .slide h1{font-size:clamp(12px,8cqw,64px)}
.layout-save{position:sticky;bottom:-24px;background:#192528;padding:16px 0 24px;border-top:1px solid var(--line);margin-top:18px;display:grid;gap:8px}.layout-save button{font-size:12px}.layout-save p{margin:0;font-size:12px}.project-picker{display:flex;gap:8px;align-items:center}.project-picker select{max-width:180px}
.no-previews .notes{flex:1 1 0!important;margin-top:0}footer #outputBadge{font-size:11px;color:var(--accent)}
.screen-roles{display:grid;gap:10px;margin:18px 0}.screen-role{display:flex;align-items:center;justify-content:space-between;gap:12px}.jump-indicator{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#243e39;color:#dffff5;border:1px solid #67e2cd;border-radius:12px;padding:18px 28px;z-index:20;box-shadow:0 12px 40px #0008}
</style>
</head>
<body>
<div class="concept"><span><strong>INTERACTIVE CONCEPT</strong> · Mock slides and screens. No real display or system settings change.</span><label class="project-picker">Demo project <select id="demoProject"><option value="ideas">Making room for ideas</option><option value="workshop">Workshop</option></select></label><label>Test setup <select id="topology"><option value="3">3 screens</option><option value="4">4 screens</option><option value="2">Projector disconnected</option><option value="1">Laptop only</option></select></label></div>
<header><span class="brand">P</span><button id="menuButton" aria-expanded="false" aria-controls="menu">☰ Menu</button><div class="doc"><b id="projectTitle">Making room for ideas</b><small>demo.pdf · 12 slides</small></div><div class="toolbar"><button id="displayButton">Displays · 1 → 3</button><button id="blankButton">Blank presentation</button><button id="layoutButton" class="layout-button" aria-controls="layoutPanel" aria-expanded="false">Layout</button><div id="elapsedWidget" class="clock-widget"><small>Elapsed</small><span class="timer" id="timer">00:00</span></div><div id="clockWidget" class="clock-widget"><small>Time</small><span class="timer" id="wallClock">00:00</span></div></div></header>
<header><span class="brand">P</span><button id="menuButton" aria-expanded="false" aria-controls="menu">☰ Menu</button><div class="doc"><b id="projectTitle">Making room for ideas</b><small>demo.pdf · 12 slides</small></div><div class="toolbar"><button id="displayButton">Displays · 1 → 3</button><button id="blankButton">Blank presentation</button><button id="slidesButton">All slides</button><button id="layoutButton" class="layout-button" aria-controls="layoutPanel" aria-expanded="false">Layout</button><div id="elapsedWidget" class="clock-widget"><small>Elapsed</small><span class="timer" id="timer">00:00</span></div><div id="clockWidget" class="clock-widget"><small>Time</small><span class="timer" id="wallClock">00:00</span></div></div></header>
<nav id="menu" class="menu" aria-label="Presenter menu" hidden><button disabled>Open PDF… <small>Planned</small></button><button disabled>Open picture folder… <small>Planned</small></button><hr><button id="menuDisplays">Displays <small>Assign screens</small></button><button id="menuLayout">Layout <small>Show, hide & resize</small></button><button id="menuSettings">Settings <small>Preview</small></button><hr><button id="resetTimer">Reset timer</button><button id="resetDemo">Reset demo</button></nav>
<main><div class="previews" id="previews"><section id="previousPreview" class="previous-preview"><div class="caption"><span>PREVIOUS</span><span id="previousCount"></span></div><div class="slide"><span class="eyebrow">LOOKING BACK</span><h1 id="previousTitle">Start of presentation</h1><div class="orb"></div></div></section><section id="currentPreview"><div class="caption"><span>CURRENT · <span id="currentCount">1 / 12</span></span></div><div class="slide"><span class="eyebrow">BEFFROI / FIELD NOTES</span><h1 id="currentTitle">Making room<br>for ideas.</h1><p id="currentSubtitle">A clear view. A little space. A better presentation.</p><div class="orb"></div><span class="slide-foot">DESIGN SESSION · NOVEMBER 2026</span></div></section><section class="next" id="nextPreview"><div class="caption"><span>NEXT</span><span id="nextCount">2 / 12</span></div><div class="slide"><span class="eyebrow">THE STARTING POINT</span><h1 id="nextTitle">Keep the<br>focus.</h1><div class="orb"></div></div><div class="next-hint">Your slides go to <strong id="destination">Screen 3 · Epson projector</strong>.<br>Menus and notes stay on the presenter screen.</div></section></div>
<section class="notes" id="notesWidget"><div class="caption"><span>PRESENTER NOTES <small> · auto-fit</small></span><div class="notes-tools"><button id="longNotes">Try long notes</button><button id="notesLayout">Resize & visibility</button></div></div><div class="note-box" id="noteBox"><p class="note-text" id="noteText"></p></div></section>
<footer><button id="previous">← Previous</button><button class="primary" id="next">Next →</button><span class="kbd">← → slides · B blank · Esc close menu</span><b id="outputBadge">PRESENTATION VISIBLE</b><span class="status" id="routeStatus">Presenter 1 · Presentation 3</span></footer><div id="toast" role="status" aria-live="polite"></div></main>
<footer><button id="previous">← Previous</button><button class="primary" id="next">Next →</button><span class="kbd">← → slides · number + Enter to jump · B blank</span><b id="outputBadge">PRESENTATION VISIBLE</b><span class="status" id="routeStatus">Presenter 1 · Presentation 3</span></footer><div id="toast" role="status" aria-live="polite"></div></main>
<aside id="layoutPanel" class="layout-panel" aria-labelledby="layoutTitle" hidden>
<div class="heading"><div><h2 id="layoutTitle">Your presenter view</h2><span class="pill">LIVE LAYOUT</span></div><button id="closeLayout" class="close" aria-label="Close layout">✕</button></div>
<p>Keep what helps you speak. Hidden items give their space to the rest. Presentation output stays unchanged.</p>
@ -30,14 +31,20 @@ main{display:flex;flex-direction:column;min-height:430px;max-width:none}.preview
<small>Project layouts override the default for all projects. Saved layouts persist in this browser; native configuration remains planned.</small>
<div class="layout-save"><button class="primary" id="saveProjectLayout">Save layout · This project</button><button id="saveGlobalLayout">Save layout · All projects</button><button id="useGlobalLayout">Use all-projects default</button><p id="layoutSaveStatus" role="status" aria-live="polite"></p></div>
</aside>
<dialog id="displayDialog" aria-labelledby="displayTitle"><div class="dialog-head"><div><h2 id="displayTitle">Where should each view go?</h2><small>Presenter = your controls and notes. Presentation = slides for viewers.</small></div><button aria-label="Close displays" data-close="displayDialog">✕</button></div><div class="dialog-body"><div style="display:flex;justify-content:space-between;align-items:center"><span class="pill">CONNECTED SCREENS · SIMULATED</span><button id="identify">Identify screens</button></div><div class="map" id="screenMap"></div><div class="assignments"><div class="field"><label for="presenterSelect">Presenter screen</label><select id="presenterSelect"></select></div><button id="swap">⇄ Swap</button><div class="field"><label for="presentationSelect">Presentation screen</label><select id="presentationSelect"></select></div></div><div class="checks"><label><input id="presenterFull" type="checkbox" checked> Presenter fullscreen</label><label><input id="presentationFull" type="checkbox" checked> Presentation fullscreen</label><label><input id="remember" type="checkbox" checked> Remember this setup</label></div><div class="notice" id="displayNotice">Choose destinations, then Apply. Unused screens stay untouched.</div></div><div class="dialog-actions"><small>Changes apply together.</small><button data-close="displayDialog">Cancel</button><button class="primary" id="apply">Apply setup</button></div></dialog>
<dialog id="displayDialog" aria-labelledby="displayTitle"><div class="dialog-head"><div><h2 id="displayTitle">Where should each view go?</h2><small>Presenter = your controls and notes. Presentation = slides for viewers.</small></div><button aria-label="Close displays" data-close="displayDialog">✕</button></div><div class="dialog-body"><div style="display:flex;justify-content:space-between;align-items:center"><span class="pill">CONNECTED SCREENS · SIMULATED</span><button id="identify">Identify screens</button></div><div class="map" id="screenMap"></div><div id="screenRoles" class="screen-roles"></div><button id="swap">⇄ Swap presenter and presentation groups</button><div class="checks"><label><input id="presenterFull" type="checkbox" checked> Presenter fullscreen</label><label><input id="presentationFull" type="checkbox" checked> Presentation fullscreen</label><label><input id="remember" type="checkbox" checked> Remember this setup</label></div><div class="notice" id="displayNotice">Choose destinations, then Apply. Unused screens stay untouched.</div></div><div class="dialog-actions"><small>Changes apply together.</small><button data-close="displayDialog">Cancel</button><button class="primary" id="apply">Apply setup</button></div></dialog>
<dialog id="settingsDialog" aria-labelledby="settingsTitle"><div class="dialog-head"><div><h2 id="settingsTitle">Settings</h2><small>Proposed app behavior · not operating-system settings</small></div><button aria-label="Close settings" data-close="settingsDialog">✕</button></div><div class="dialog-body"><div class="settings-row"><b>Remember your screens</b><br><span class="muted">Keep preferred screen identities, fullscreen choices and notes layout in a per-user configuration. Temporary fallback does not replace your preferred setup.</span></div><div class="settings-row"><b>Configuration location</b><br><code>Linux: $XDG_CONFIG_HOME/pdf-presenter/settings.toml</code><br><small>Defaults to ~/.config/pdf-presenter/settings.toml</small><br><code>Windows: %APPDATA%\Beffroi\PdfPresenter\settings.toml</code><br><code>macOS: ~/Library/Application Support/Beffroi/PdfPresenter/settings.toml</code></div><div class="settings-row"><b>Keep screens awake during presentation</b><br><span class="muted">Planned native feature. Includes paused and blanked output; this HTML does not inhibit sleep.</span></div><div class="notice">Saved layouts persist in this browser, with project overrides above the all-projects default. Screen assignments remain session-only. The native app's global configuration is not implemented yet.</div></div><div class="dialog-actions"><button class="primary" data-close="settingsDialog">Done</button></div></dialog>
<div id="jumpIndicator" class="jump-indicator" role="status" hidden></div>
<template id="galleryTemplate">
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>All slides · PDF Presenter</title><style>
:root{color-scheme:dark;font-family:system-ui,sans-serif;background:#11191b;color:#edf4f4}*{box-sizing:border-box}body{margin:0}button,select,input{font:inherit}button,select{background:#263638;color:inherit;border:1px solid #536468;border-radius:7px;padding:9px 12px;cursor:pointer}button:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid #67e2cd;outline-offset:3px}header{position:sticky;top:0;background:#192528;z-index:2;padding:16px 20px;display:flex;align-items:center;flex-wrap:wrap;gap:16px;border-bottom:1px solid #435458}h1{font-size:20px;margin:0;margin-right:auto}label{font-size:13px;display:flex;gap:8px;align-items:center}input{accent-color:#67e2cd}#galleryGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--thumb,220px)),1fr));gap:20px;padding:24px}.thumbnail{background:none;border:2px solid transparent;text-align:left;padding:5px;color:#c8d6d7}.thumbnail.selected{border-color:#e6b66b}.thumbnail.live .thumb-art{box-shadow:inset 0 0 0 3px #67e2cd}.thumb-art{aspect-ratio:16/9;display:flex;align-items:center;padding:18px;background:#daeae2;color:#153730;font-size:clamp(16px,2vw,27px);font-weight:700;border-radius:5px;overflow:hidden}.thumbnail:nth-child(even) .thumb-art{background:#294d44;color:#e1eee7}.thumb-caption{display:flex;justify-content:space-between;font-size:12px;margin:8px 2px}.live-tag{color:#67e2cd}footer{position:sticky;bottom:0;background:#192528;border-top:1px solid #435458;padding:14px 20px;display:flex;gap:14px;align-items:center;flex-wrap:wrap}#showSelected{background:#67e2cd;color:#102824;font-weight:700}#galleryStatus{flex:1;font-size:13px}#placementHint{font-size:12px;color:#acbec0;margin:12px 24px}#jumpIndicator{position:fixed;bottom:80px;left:50%;transform:translateX(-50%);padding:16px;background:#31564d;border-radius:10px;z-index:5}[hidden]{display:none!important}
</style></head><body><header><h1>All slides</h1><label>Preview size <input id="thumbnailSize" type="range" min="130" max="380" value="220"></label><label><input id="changeOnClick" type="checkbox"> Change on click</label><label>Open on <select id="galleryMonitor"></select></label></header><p id="placementHint">Windowed by default. Monitor selection is simulated in this HTML prototype.</p><main id="galleryGrid" aria-label="Slide thumbnails"></main><footer><span id="galleryStatus" role="status"></span><button id="showSelected">Show selected slide</button><button id="closeGallery">Close</button></footer><div id="jumpIndicator" role="status" hidden></div></body></html>
</template>
<script>
'use strict';
const $=id=>document.getElementById(id);
const screens=[{id:1,name:'Built-in display',size:'1920 × 1200'},{id:2,name:'Dell U2720Q',size:'3840 × 2160'},{id:3,name:'Epson projector',size:'1920 × 1080'},{id:4,name:'Side monitor',size:'2560 × 1440'}];
const titles=['Making room for ideas.','Keep the focus.','A shared perspective.','Less friction.','Space to think.','One clear message.','From idea to action.','Make it tangible.','Keep moving.','A wider view.','What comes next?','Thank you.'];
let count=3,page=0,blank=false,long=false,start=Date.now(),active={presenter:1,presentation:3,presenterFull:true,presentationFull:true},preferred={...active},draft={...active};
let count=3,page=0,blank=false,long=false,start=Date.now(),active={presenter:[1],presentation:[3],presenterFull:true,presentationFull:true},preferred=structuredClone(active),draft=structuredClone(active);
const message=text=>$('toast').textContent=text;
document.querySelectorAll('.previews .slide').forEach(slide=>{const stage=document.createElement('div');stage.className='slide-stage';slide.before(stage);stage.append(slide);});
const layoutDefaults={previous:{show:true,size:60},current:{show:true,size:130},next:{show:true,size:75},notes:{show:true,size:28},elapsed:{show:true,size:28},clock:{show:true,size:28}};
@ -96,18 +103,70 @@ function fitNotes(){const box=$('noteBox'),text=$('noteText');if(!box.clientWidt
const shortNotes=['Welcome everyone. Give the room a moment to settle.\n\nIntroduce the idea: fewer distractions, more room for the message.','Keep attention on the main point. Let the slide support the story, rather than competing with it.'];
function render(){ $('previousTitle').textContent=titles[page-1]||'Start of presentation';$('previousCount').textContent=page>0?`${page} / 12`:''; $('currentTitle').textContent=titles[page];$('nextTitle').textContent=titles[page+1]||'End of presentation';$('currentCount').textContent=`${page+1} / 12`;$('nextCount').textContent=page<11?`${page+2} / 12`:'';$('previous').disabled=page===0;$('next').disabled=page===11;
$('noteText').textContent=long?Array.from({length:8},(_,i)=>`${i+1}. ${shortNotes[(page+i)%2]} Discuss the practical example, pause for questions, and connect this point to the next slide.`).join('\n\n'):shortNotes[page%2];
$('outputBadge').textContent=!active.presentation?'PRESENTATION SUSPENDED':blank?'PRESENTATION BLANKED':'PRESENTATION VISIBLE';$('blankButton').textContent=blank?'Show presentation':'Blank presentation';$('blankButton').disabled=!active.presentation;$('destination').textContent=active.presentation?`Screen ${active.presentation} · ${screens[active.presentation-1].name}`:'No screen · rehearsal only';$('displayButton').textContent=`Displays · ${active.presenter} → ${active.presentation||'—'}`;$('routeStatus').textContent=`Presenter ${active.presenter} · Presentation ${active.presentation||'suspended'}`;fitNotes();}
$('outputBadge').textContent=!active.presentation.length?'PRESENTATION SUSPENDED':blank?'PRESENTATION BLANKED':'PRESENTATION VISIBLE';$('blankButton').textContent=blank?'Show presentation':'Blank presentation';$('blankButton').disabled=!active.presentation.length;$('destination').textContent=active.presentation.length?`Screens ${active.presentation.join(', ')}`:'No screen · rehearsal only';$('displayButton').textContent=`Displays · ${active.presenter} → ${active.presentation.join(', ')||'—'}`;$('routeStatus').textContent=`Presenter ${active.presenter} · Presentation ${active.presentation.join(', ')||'suspended'}`;fitNotes();syncGallery();}
function move(delta){page=Math.max(0,Math.min(11,page+delta));render();}
$('previous').onclick=()=>move(-1);$('next').onclick=()=>move(1);$('blankButton').onclick=()=>{blank=!blank;render();};$('longNotes').onclick=()=>{long=!long;$('longNotes').textContent=long?'Use short notes':'Try long notes';render();};new ResizeObserver(fitNotes).observe($('noteBox'));
function drawMap(){ $('screenMap').replaceChildren();for(const screen of screens.slice(0,count)){const role=screen.id===draft.presenter?'Presenter':screen.id===draft.presentation?'Presentation':'Unused';const el=document.createElement('div');el.className='monitor '+role.toLowerCase();el.innerHTML=`<div class="monitor-face"><b>${screen.id}</b><small>${role}</small></div><div class="monitor-name">${screen.name}<br>${screen.size}</div>`;$('screenMap').append(el);} $('presenterSelect').value=String(draft.presenter);$('presentationSelect').value=String(draft.presentation);$('swap').disabled=!draft.presentation;$('displayNotice').textContent=count===1?'Only one screen is connected. Keep the presenter fullscreen and suspend presentation output.': 'Choose destinations, then Apply. Unused screens stay untouched.';}
function openDisplays(){closeMenu();draft={...active};for(const id of ['presenterSelect','presentationSelect']){$(id).replaceChildren();if(id==='presentationSelect')$(id).add(new Option('Off · rehearsal only','0'));for(const s of screens.slice(0,count))$(id).add(new Option(`${s.id} — ${s.name}`,String(s.id)));}$('presenterFull').checked=draft.presenterFull;$('presentationFull').checked=draft.presentationFull;drawMap();if(!$('displayDialog').open)$('displayDialog').showModal();}
function drawMap(){
$('screenMap').replaceChildren();$('screenRoles').replaceChildren();
for(const screen of screens.slice(0,count)){
const role=draft.presenter.includes(screen.id)?'Presenter':draft.presentation.includes(screen.id)?'Presentation':'Unused';
const el=document.createElement('div');el.className='monitor '+role.toLowerCase();el.innerHTML=`<div class="monitor-face"><b>${screen.id}</b><small>${role}</small></div><div class="monitor-name">${screen.name}<br>${screen.size}</div>`;$('screenMap').append(el);
const row=document.createElement('label');row.className='screen-role';row.textContent=`${screen.id} · ${screen.name}`;const select=document.createElement('select');select.id='screenRole'+screen.id;select.setAttribute('aria-label',`Screen ${screen.id} role`);for(const name of ['Unused','Presenter','Presentation'])select.add(new Option(name,name.toLowerCase()));select.value=role.toLowerCase();select.onchange=()=>{for(const key of ['presenter','presentation'])draft[key]=draft[key].filter(id=>id!==screen.id);if(select.value!=='unused')draft[select.value].push(screen.id);drawMap();};row.append(select);$('screenRoles').append(row);
}
$('swap').disabled=!draft.presentation.length;$('apply').disabled=!draft.presenter.length;
$('displayNotice').textContent=!draft.presenter.length?'Choose at least one presenter screen before applying.':'Assign the same role to several screens to mirror it. Each screen has one role. Presentation may be off for rehearsal.';
}
function openDisplays(){closeMenu();draft=structuredClone(active);$('presenterFull').checked=draft.presenterFull;$('presentationFull').checked=draft.presentationFull;drawMap();if(!$('displayDialog').open)$('displayDialog').showModal();}
$('displayButton').onclick=openDisplays;$('menuDisplays').onclick=openDisplays;
$('presenterSelect').onchange=()=>{const old=draft.presenter;draft.presenter=Number($('presenterSelect').value);if(draft.presenter===draft.presentation)draft.presentation=count>1?old:0;drawMap();};
$('presentationSelect').onchange=()=>{const old=draft.presentation;draft.presentation=Number($('presentationSelect').value);if(draft.presentation===draft.presenter){if(count===1)draft.presentation=0;else draft.presenter=old||screens.slice(0,count).find(s=>s.id!==draft.presentation).id;}drawMap();};
$('swap').onclick=()=>{[draft.presenter,draft.presentation]=[draft.presentation,draft.presenter];drawMap();};
$('identify').onclick=()=>{$('screenMap').classList.add('identify');$('displayNotice').textContent='Native app: briefly overlay these numbers on the physical screens. Here: simulated labels only.';setTimeout(()=>$('screenMap').classList.remove('identify'),1800);};
$('apply').onclick=()=>{draft.presenterFull=$('presenterFull').checked;draft.presentationFull=$('presentationFull').checked;active={...draft};if($('remember').checked)preferred={...active};$('displayDialog').close();render();message($('remember').checked?'Setup applied and remembered for this demo session.':'Setup applied for this session without changing your preferred setup.');};
$('topology').onchange=()=>{count=Number($('topology').value);const available=id=>id>0&&id<=count;const p=available(preferred.presenter)?preferred.presenter:1;const output=available(preferred.presentation)&&preferred.presentation!==p?preferred.presentation:screens.slice(0,count).find(s=>s.id!==p)?.id||0;active={...preferred,presenter:p,presentation:output};blank=true;render();message('Simulated display change: presentation blanked. Review the fallback in Displays; your preferred setup is retained.');if($('displayDialog').open)openDisplays();};
$('menuSettings').onclick=()=>{closeMenu();$('settingsDialog').showModal();};$('menuLayout').onclick=openLayout;$('resetTimer').onclick=()=>{start=Date.now();closeMenu();};$('resetDemo').onclick=()=>location.reload();document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).close());document.addEventListener('pointerdown',e=>{if(!$('menu').contains(e.target)&&!$('menuButton').contains(e.target))closeMenu();});document.addEventListener('keydown',e=>{if(e.key==='Escape'){closeMenu();if(!$('layoutPanel').hidden){setLayoutOpen(false);$('layoutButton').focus();}return;}if(document.querySelector('dialog[open]')||['INPUT','SELECT','BUTTON'].includes(document.activeElement.tagName)||!$('menu').hidden)return;if(e.key==='ArrowRight'||e.key===' '){e.preventDefault();move(1);}if(e.key==='ArrowLeft'){e.preventDefault();move(-1);}if(e.key.toLowerCase()==='b'&&active.presentation){blank=!blank;render();}});function updateClocks(){const seconds=Math.floor((Date.now()-start)/1000);$('timer').textContent=String(Math.floor(seconds/60)).padStart(2,'0')+':'+String(seconds%60).padStart(2,'0');const now=new Date();$('wallClock').textContent=String(now.getHours()).padStart(2,'0')+':'+String(now.getMinutes()).padStart(2,'0');}setInterval(updateClocks,1000);updateClocks();restoreLayout();render();
$('apply').onclick=()=>{if(!draft.presenter.length)return;draft.presenterFull=$('presenterFull').checked;draft.presentationFull=$('presentationFull').checked;active=structuredClone(draft);if($('remember').checked)preferred=structuredClone(active);$('displayDialog').close();render();message('Screen groups applied'+($('remember').checked?' and remembered for this demo session.':'.'));};
$('topology').onchange=()=>{count=Number($('topology').value);const available=id=>id>0&&id<=count;const p=preferred.presenter.filter(available);if(!p.length)p.push(1);let output=preferred.presentation.filter(id=>available(id)&&!p.includes(id));if(!output.length&&preferred.presentation.length){const spare=screens.slice(0,count).find(s=>!p.includes(s.id));if(spare)output=[spare.id];}active={...preferred,presenter:p,presentation:output};blank=true;render();message('Simulated display change: presentation blanked. Surviving screen assignments retained; preferred setup unchanged.');if($('displayDialog').open)openDisplays();};
let galleryWindow=null;
const gallery={selected:0,size:220,changeOnClick:false,monitor:'presenter'};
function galleryTarget(){const id=Number(gallery.monitor);return id>0&&id<=count?id:active.presenter[0];}
function syncGallery(){
if(!galleryWindow||galleryWindow.closed)return;const doc=galleryWindow.document;
if(!doc.getElementById('galleryGrid'))return;
doc.querySelectorAll('.thumbnail').forEach((el,index)=>{el.classList.toggle('selected',index===gallery.selected);el.classList.toggle('live',index===page);el.setAttribute('aria-pressed',String(index===gallery.selected));el.querySelector('.live-tag').textContent=index===page?(blank?'CURRENT · BLANKED':'CURRENT'):'';});
doc.getElementById('galleryStatus').textContent=`Selected ${gallery.selected+1} · Current ${page+1} / ${titles.length} · ${gallery.changeOnClick?'Click changes presentation':'Browse safely — click only selects'}`;
const monitor=doc.getElementById('galleryMonitor');monitor.replaceChildren(new Option(`Presenter screen (${active.presenter[0]})`,'presenter'));for(const screen of screens.slice(0,count))monitor.add(new Option(`${screen.id} — ${screen.name}`,String(screen.id)));if(gallery.monitor!=='presenter'&&Number(gallery.monitor)>count)monitor.add(new Option(`${gallery.monitor} — disconnected (using presenter)`,gallery.monitor));monitor.value=gallery.monitor;
doc.getElementById('placementHint').textContent=`Windowed · Requested screen ${galleryTarget()}. HTML cannot route this window to the simulated monitors; drag it to position. Native placement will follow this choice.`;
}
function selectThumbnail(index){gallery.selected=index;if(gallery.changeOnClick)goToSlide(index+1);else syncGallery();}
function openGallery(){
closeMenu();if(galleryWindow&&!galleryWindow.closed){galleryWindow.focus();return;}
gallery.selected=page;gallery.changeOnClick=false;
galleryWindow=window.open('','pdf-presenter-slide-browser',`popup=yes,width=1000,height=700,left=${window.screenX+60},top=${window.screenY+60}`);
if(!galleryWindow){message('Slide browser was blocked. Allow popups for this page, then click All slides again.');return;}
const doc=galleryWindow.document;doc.open();doc.write($('galleryTemplate').innerHTML);doc.close();
const grid=doc.getElementById('galleryGrid');grid.style.setProperty('--thumb',gallery.size+'px');
titles.forEach((title,index)=>{const button=doc.createElement('button');button.className='thumbnail';button.setAttribute('aria-label',`Slide ${index+1}: ${title}`);const art=doc.createElement('div');art.className='thumb-art';art.textContent=title;const caption=doc.createElement('div');caption.className='thumb-caption';caption.innerHTML=`<span>${index+1}</span><span class="live-tag"></span>`;button.append(art,caption);button.onclick=()=>selectThumbnail(index);grid.append(button);});
doc.getElementById('thumbnailSize').value=gallery.size;doc.getElementById('thumbnailSize').oninput=e=>{gallery.size=Number(e.target.value);grid.style.setProperty('--thumb',gallery.size+'px');};
doc.getElementById('changeOnClick').onchange=e=>{gallery.changeOnClick=e.target.checked;syncGallery();};
doc.getElementById('galleryMonitor').onchange=e=>{gallery.monitor=e.target.value;syncGallery();};
doc.getElementById('showSelected').onclick=()=>goToSlide(gallery.selected+1);doc.getElementById('closeGallery').onclick=()=>galleryWindow.close();
doc.addEventListener('keydown',e=>{if(handleNumberJump(e,doc))return;if(e.key==='Escape')galleryWindow.close();});
doc.addEventListener('focusin',e=>{if(e.target.matches('input,select,textarea'))clearJump(doc);});syncGallery();galleryWindow.focus();
}
$('slidesButton').onclick=openGallery;
window.addEventListener('pagehide',()=>{if(galleryWindow&&!galleryWindow.closed)galleryWindow.close();});
const numberJumps=new WeakMap();
function clearJump(doc){numberJumps.delete(doc);const indicator=doc.getElementById('jumpIndicator');if(indicator)indicator.hidden=true;}
function goToSlide(number){if(!Number.isInteger(number)||number<1||number>titles.length)return false;page=number-1;render();return true;}
function handleNumberJump(e,doc){
if(e.ctrlKey||e.metaKey||e.altKey||e.isComposing||e.target.isContentEditable||e.target.closest('input,select,textarea'))return false;
let digits=numberJumps.get(doc)||'';
if(/^\d$/.test(e.key)){e.preventDefault();digits=(digits+e.key).slice(0,6);numberJumps.set(doc,digits);}
else if(e.key==='Backspace'&&digits){e.preventDefault();digits=digits.slice(0,-1);if(!digits){clearJump(doc);return true;}numberJumps.set(doc,digits);}
else if(e.key==='Escape'&&digits){e.preventDefault();clearJump(doc);return true;}
else if(e.key==='Enter'&&digits){e.preventDefault();if(goToSlide(Number(digits)))clearJump(doc);else{const indicator=doc.getElementById('jumpIndicator');indicator.hidden=false;indicator.textContent=`Choose a slide from 1 to ${titles.length}. Backspace to edit · Esc to cancel.`;}return true;}
else return false;
const indicator=doc.getElementById('jumpIndicator');indicator.hidden=false;indicator.textContent=`Go to slide ${digits} · Enter to show · Esc to cancel`;return true;
}
$('menuSettings').onclick=()=>{closeMenu();$('settingsDialog').showModal();};$('menuLayout').onclick=openLayout;$('resetTimer').onclick=()=>{start=Date.now();closeMenu();};$('resetDemo').onclick=()=>location.reload();document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).close());document.addEventListener('pointerdown',e=>{if(!$('menu').contains(e.target)&&!$('menuButton').contains(e.target))closeMenu();});document.addEventListener('focusin',e=>{if(e.target.matches('input,select,textarea'))clearJump(document);});
document.addEventListener('keydown',e=>{if(document.querySelector('dialog[open]'))return;if(handleNumberJump(e,document))return;if(e.key==='Escape'){closeMenu();if(!$('layoutPanel').hidden){setLayoutOpen(false);$('layoutButton').focus();}return;}if(e.ctrlKey||e.metaKey||e.altKey||e.isComposing||e.target.isContentEditable||['INPUT','SELECT','TEXTAREA','BUTTON'].includes(document.activeElement.tagName)||!$('menu').hidden)return;if(e.key==='ArrowRight'||e.key===' '){e.preventDefault();clearJump(document);move(1);}if(e.key==='ArrowLeft'){e.preventDefault();clearJump(document);move(-1);}if(e.key.toLowerCase()==='b'&&active.presentation.length){blank=!blank;render();}});
function updateClocks(){const seconds=Math.floor((Date.now()-start)/1000);$('timer').textContent=String(Math.floor(seconds/60)).padStart(2,'0')+':'+String(seconds%60).padStart(2,'0');const now=new Date();$('wallClock').textContent=String(now.getHours()).padStart(2,'0')+':'+String(now.getMinutes()).padStart(2,'0');}setInterval(updateClocks,1000);updateClocks();restoreLayout();render();
</script>
</body></html>

View File

@ -0,0 +1,39 @@
# Slide navigation and mirrored displays concept
Implemented for review in [the HTML mockup](presenter-menu.html), not the native app.
- Type a 1-based slide number, then Enter to show it. The pending number is visible;
Backspace edits, Escape cancels, invalid numbers do not navigate. Text fields,
selectors, modifiers and input composition are excluded. Blanking is preserved.
- All slides opens one reusable, resizable popup, requesting 1000×700 and never
fullscreen. The browser may choose a tab instead or block the popup; report blocking.
The popup closes with its parent. It contains mock slide art, not the reference
image's copyrighted slides. Current and selected slides have separate markers.
- Clicking a thumbnail selects only by default. Show selected explicitly navigates.
Change on click enables immediate navigation; turning it on does not navigate
the existing selection. Every new popup starts with this option off. Number+Enter
remains an explicit navigation action in either window. Preview size is adjustable.
- The popup monitor preference defaults to the first assigned presenter monitor.
An unavailable selected monitor falls back to presenter without erasing preference.
The HTML selector is simulated; physical placement remains a native acceptance task.
- Displays assigns each connected screen one of Presenter, Presentation or Unused.
Multiple screens may share either role. At least one presenter is required; no
presentation screens is valid rehearsal. Swap exchanges entire role groups.
Apply commits together; Cancel leaves assignments untouched. Missing displays are
filtered while surviving assignments remain; fallback stays blanked for review.
- The mock retains browser size/monitor preferences and screen groups in memory only.
Layout-save buttons still save widget layout only. The native settings schema must
define stable monitor IDs, role arrays and browser preferences before persistence.
Native requirements: synchronized navigation/blanking across outputs, shared prepared
frames with bounded per-output work, no duplicate PDF rendering for identical frames,
no output stalled by another screen, and controls/notes kept off presentation screens.
Thumbnail preparation must be asynchronous and virtualized for large decks. Test
window placement and hotplug with mirrored roles on Windows, macOS, X11 and Wayland.
Validation harness: append `tests/browser/slide-browser.js` as a script to a temporary
copy of the HTML and run in an isolated Firefox profile allowing popups. Wait for the
PASS/FAIL report after popup open/close; a one-shot screenshot can capture too early.
The 24 checks cover buffered navigation, safe browsing, thumbnail sizing, role groups,
missing monitors and reopening. Run `tests/browser/layout-storage.js` separately for
24 existing layout/persistence checks. Neither test proves native monitor placement.

View File

@ -104,8 +104,8 @@ engineering gates; validate them against reference hardware and user testing. No
## Scope after the core requirements
Multiple audience outputs beyond the required pair of presenter/audience roles,
independent decks per display, remote control, annotations, embedded media and
Mirroring either role onto several monitors and a windowed slide browser are now
required presenter workflow (see the task list). Independent decks per display, remote control, annotations, embedded media and
transitions are later scope. Native PPTX playback is not implied. No network service
or presentation-switcher integration is required. Preserve source PDFs and never
show a wrong or stale slide to achieve a lower latency measurement.

View File

@ -16,6 +16,9 @@ that an API was identified. Do not mark physical acceptance from unit tests.
No PDF dependency on shell startup. Implement monitor enumeration/identification,
explicit presenter and audience selection, swapping, fullscreen and emergency blank.
Default both roles to fullscreen; retain explicit windowed rehearsal.
Support several monitors per role (e.g. presenter 1+2, presentation 3, or vice versa).
One role per monitor; shared slide/blank/navigation state across mirrored views.
Preserve surviving assignments and isolate each output's rendering/backpressure.
- [ ] T03: Test both assignments on Windows and macOS, then Linux X11 and Wayland
(GNOME/KDE). Add native adapters where required. Verify actual output placement;
an unsupported placement call is a defect, not a completed task.
@ -95,6 +98,12 @@ Depends on usable PDF output and acknowledged displayed-slide state.
default, with an action to remove the current project override. Keep complete
notes fitted, and persist layout visibility/sizes in the global settings contract.
Review the [interactive layout concept](../design/presenter-menu.html) before implementation.
Add digit-buffer + Enter direct slide navigation (1-based), with visible pending
number, Backspace editing, Escape cancellation and range checks; preserve blanking.
Add a separate windowed all-slides browser with adjustable thumbnail size and
Change on click disabled by default. Selection and live slide are separate; provide
explicit Show selected. Place it on a chosen monitor or presenter by default,
falling back to presenter if missing. Bound/virtualize thumbnail loading.
- [ ] T17: Extract available notes asynchronously and support explicit notes-page
interpretation/cropping. Load image sidecar `.txt` notes and global `notes.json` or
`notes.toml`; test precedence, invalid files and missing notes. Always word-wrap and

View File

@ -0,0 +1,32 @@
// Append to a temporary HTML concept copy. Use an isolated Firefox profile allowing popups.
window.addEventListener('load', () => {
const results = [];
const check = (value, label) => { if (!value) throw Error(label); results.push(label); };
const key = (value, doc = document, target = doc.body, options = {}) => target.dispatchEvent(new KeyboardEvent('keydown', {key:value,bubbles:true,cancelable:true,...options}));
const role = (id, value) => { $('screenRole'+id).value=value; $('screenRole'+id).dispatchEvent(new Event('change')); };
try {
key('1'); key('2'); check(page === 0, 'Typing does not navigate'); key('Enter'); check(page === 11, 'Number + Enter jumps to slide 12');
key('9'); key('9'); key('Enter'); check(page === 11 && !$('jumpIndicator').hidden, 'Invalid number keeps current slide');
key('Escape'); check($('jumpIndicator').hidden, 'Escape cancels pending jump');
key('1'); key('2'); key('Backspace'); key('Enter'); check(page === 0, 'Backspace edits pending number');
key('2',document,$('topology')); key('Enter'); check(page === 0, 'Input controls do not trigger jumps');
key('2',document,document.body,{ctrlKey:true}); key('Enter'); check(page === 0, 'Modified keys do not trigger jumps');
blank=true;key('3');key('Enter');check(page===2 && blank, 'Direct jump preserves blanking');
openGallery(); check(galleryWindow && !galleryWindow.closed, 'Separate popup opens');
const doc=galleryWindow.document;
check(doc.querySelectorAll('.thumbnail').length===12 && !doc.fullscreenElement, 'All thumbnails in a non-fullscreen popup');
doc.querySelectorAll('.thumbnail')[7].click();check(gallery.selected===7 && page===2, 'Default click browses without navigation');
doc.getElementById('changeOnClick').checked=true;doc.getElementById('changeOnClick').dispatchEvent(new Event('change'));check(page===2, 'Enabling click change does not activate selection');
doc.querySelectorAll('.thumbnail')[8].click();check(page===8 && blank, 'Opt-in click changes slide and preserves blanking');
doc.getElementById('changeOnClick').checked=false;doc.getElementById('changeOnClick').dispatchEvent(new Event('change'));doc.querySelectorAll('.thumbnail')[1].click();doc.getElementById('showSelected').click();check(page===1, 'Show selected explicitly navigates');
key('1',doc);key('0',doc);key('Enter',doc);check(page===9, 'Number shortcut works in popup');
doc.getElementById('thumbnailSize').value='350';doc.getElementById('thumbnailSize').dispatchEvent(new Event('input'));check(gallery.size===350 && doc.getElementById('galleryGrid').style.getPropertyValue('--thumb')==='350px', 'Thumbnail size adjustable');
openDisplays();role(2,'presenter');$('apply').click();check(active.presenter.join(',')==='1,2' && active.presentation.join(',')==='3', 'Two presenter screens and one presentation');
openDisplays();$('swap').click();$('apply').click();check(active.presenter.join(',')==='3' && active.presentation.join(',')==='1,2', 'Group swap mirrors presentation instead');
openDisplays();role(3,'presentation');check($('apply').disabled, 'Cannot apply without a presenter');$('displayDialog').close();check(active.presenter.join(',')==='3', 'Cancel retains applied groups');
gallery.monitor='3';$('topology').value='2';$('topology').dispatchEvent(new Event('change'));check(active.presenter.join(',')==='1' && active.presentation.join(',')==='2' && blank, 'Missing presenter falls back without role overlap');check(galleryTarget()===1 && gallery.monitor==='3', 'Missing browser monitor falls back without erasing preference');
$('topology').value='3';$('topology').dispatchEvent(new Event('change'));check(active.presenter.join(',')==='3' && active.presentation.join(',')==='1,2', 'Preferred groups survive reconnect');
galleryWindow.close();openGallery();check(!gallery.changeOnClick, 'Reopened browser defaults to safe browsing');galleryWindow.close();
const report=document.createElement('pre');report.style='position:fixed;inset:0;background:#102820;color:white;padding:24px;z-index:100;font:16px monospace;overflow:auto';report.textContent=`PASS · ${results.length} browser checks\n\n${results.join('\n')}`;document.body.append(report);
} catch(error) { if(galleryWindow&&!galleryWindow.closed)galleryWindow.close();document.body.textContent='FAIL: '+error.message; }
});