Files
mediadeck/mediadeck/web/index.html
T
Denis 851b7681ff Add held mouse buttons (Left click / Right click toggles) to the Touchpad tab
Two toggle buttons in the free corners of the D-pad press and hold the PC's
left or right mouse button until tapped again, for drag and drop, text
selection and window moves, with the touchpad moving the pointer in between.

- New input action "button" ({button, pressed}); the state carries
  input.buttons. VirtualInput remembers which connection pressed each button.
- A click on a held button is ignored so a touchpad tap does not drop the
  drag; the other button stays usable. Repeating a state is a no-op.
- A held button is always released: when its client disconnects (only its own
  buttons), when the server stops, and in the client when the tab is left or
  the page is hidden.
- Incoming states are set aside for 500 ms after a local tap, so a state
  already in flight cannot undo the toggle for a moment.
- D-pad rows are equal-sized (minmax(0, 1fr)) so the corner buttons do not
  stretch the top row.

tests/test_input.py covers the device logic and the full server (disconnect,
several clients); tests/test_ui_mouse_hold.py drives a real Chromium. Also
checked through the real uinput device with its pointer grabbed exclusively.
README (fr/en) and CLAUDE.md are updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 09:02:19 +01:00

294 lines
24 KiB
HTML

<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, user-scalable=no">
<meta name="theme-color" content="#0e0f13">
<meta name="mobile-web-app-capable" content="yes">
<title>MediaDeck</title>
<link rel="manifest" href="/static/manifest.webmanifest">
<link rel="icon" href="/static/icon.svg" type="image/svg+xml">
<link rel="stylesheet" href="/static/style.css">
<script type="module" src="/static/app.js"></script>
</head>
<body>
<!-- Sprite d'icônes : référencé par <use href="#i-..."> -->
<svg class="sprite" aria-hidden="true">
<symbol id="i-play" viewBox="0 0 24 24"><path d="M8 5.5v13l10.5-6.5z" fill="currentColor"/></symbol>
<symbol id="i-pause" viewBox="0 0 24 24"><path d="M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" fill="currentColor"/></symbol>
<symbol id="i-next" viewBox="0 0 24 24"><path d="M6 6l8.5 6L6 18zM16 6h2.5v12H16z" fill="currentColor"/></symbol>
<symbol id="i-prev" viewBox="0 0 24 24"><path d="M18 6l-8.5 6 8.5 6zM5.5 6H8v12H5.5z" fill="currentColor"/></symbol>
<symbol id="i-shuffle" viewBox="0 0 24 24"><path d="M4 7h3.5c2 0 3 1 4.5 3.5S14.5 17 16.5 17H20M17 14l3 3-3 3M4 17h3.5c1.2 0 2-.4 2.8-1.3M14 8.3c.8-.9 1.6-1.3 2.5-1.3H20M17 4l3 3-3 3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-loop" viewBox="0 0 24 24"><path d="M17 3l3 3-3 3M4 11V9a3 3 0 0 1 3-3h13M7 21l-3-3 3-3M20 13v2a3 3 0 0 1-3 3H4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-volume" viewBox="0 0 24 24"><path d="M4 9.5h3.5L12 5.5v13l-4.5-4H4z" fill="currentColor"/><path d="M15.5 9a4 4 0 0 1 0 6M18 6.5a7.5 7.5 0 0 1 0 11" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></symbol>
<symbol id="i-mute" viewBox="0 0 24 24"><path d="M4 9.5h3.5L12 5.5v13l-4.5-4H4z" fill="currentColor"/><path d="M16 9.5l5 5M21 9.5l-5 5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></symbol>
<symbol id="i-music" viewBox="0 0 24 24"><path d="M9 18V5.5l11-2V16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><circle cx="6.5" cy="18" r="2.5" fill="currentColor"/><circle cx="17.5" cy="16" r="2.5" fill="currentColor"/></symbol>
<symbol id="i-speaker" viewBox="0 0 24 24"><rect x="6" y="3" width="12" height="18" rx="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="12" cy="14.5" r="3" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="12" cy="7" r="1.2" fill="currentColor"/></symbol>
<symbol id="i-touch" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="13" rx="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M9 20.5h6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></symbol>
<symbol id="i-power" viewBox="0 0 24 24"><path d="M12 3.5v8M7 6.5a7 7 0 1 0 10 0" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></symbol>
<symbol id="i-lock" viewBox="0 0 24 24"><rect x="5" y="10.5" width="14" height="10" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M8 10.5V8a4 4 0 0 1 8 0v2.5" fill="none" stroke="currentColor" stroke-width="1.8"/></symbol>
<symbol id="i-moon" viewBox="0 0 24 24"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></symbol>
<symbol id="i-restart" viewBox="0 0 24 24"><path d="M4.5 12a7.5 7.5 0 1 0 2.2-5.3M4.5 4v4.5H9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-app" viewBox="0 0 24 24"><rect x="4" y="4" width="7" height="7" rx="1.5" fill="currentColor"/><rect x="13" y="4" width="7" height="7" rx="1.5" fill="currentColor" opacity=".6"/><rect x="4" y="13" width="7" height="7" rx="1.5" fill="currentColor" opacity=".6"/><rect x="13" y="13" width="7" height="7" rx="1.5" fill="currentColor"/></symbol>
<symbol id="i-tv" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M8 20.5h8" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></symbol>
<symbol id="i-film" viewBox="0 0 24 24"><rect x="4" y="3.5" width="16" height="17" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M8 3.5v17M16 3.5v17M4 8h4M4 12h4M4 16h4M16 8h4M16 12h4M16 16h4" stroke="currentColor" stroke-width="1.5"/></symbol>
<symbol id="i-globe" viewBox="0 0 24 24"><circle cx="12" cy="12" r="8.5" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M3.5 12h17M12 3.5c2.5 2.5 3.5 5.5 3.5 8.5s-1 6-3.5 8.5c-2.5-2.5-3.5-5.5-3.5-8.5s1-6 3.5-8.5z" fill="none" stroke="currentColor" stroke-width="1.5"/></symbol>
<symbol id="i-screen-off" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M3 3l18 18" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></symbol>
<symbol id="i-up" viewBox="0 0 24 24"><path d="M6 15l6-6 6 6" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-down" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-left" viewBox="0 0 24 24"><path d="M15 6l-6 6 6 6" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-right" viewBox="0 0 24 24"><path d="M9 6l6 6-6 6" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-back" viewBox="0 0 24 24"><path d="M9 7L4 12l5 5M4.5 12H15a5 5 0 0 1 0 10h-2" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-mouse-left" viewBox="0 0 24 24"><rect x="6" y="2.5" width="12" height="19" rx="6" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M6 10.5h12M12 2.5v8" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 2.5v8H6V8.5a6 6 0 0 1 6-6z" fill="currentColor"/></symbol>
<symbol id="i-mouse-right" viewBox="0 0 24 24"><rect x="6" y="2.5" width="12" height="19" rx="6" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M6 10.5h12M12 2.5v8" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 2.5v8h6V8.5a6 6 0 0 0-6-6z" fill="currentColor"/></symbol>
<symbol id="i-keyboard" viewBox="0 0 24 24"><rect x="2.5" y="6" width="19" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M6.5 10h.01M10 10h.01M14 10h.01M17.5 10h.01M7.5 14h9" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></symbol>
<symbol id="i-expand" viewBox="0 0 24 24"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-folder" viewBox="0 0 24 24"><path d="M3.5 7.5a2 2 0 0 1 2-2h4l2 2.5h7a2 2 0 0 1 2 2v7.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></symbol>
<symbol id="i-image" viewBox="0 0 24 24"><rect x="3.5" y="4.5" width="17" height="15" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="9" cy="10" r="1.7" fill="currentColor"/><path d="M4 17l5-4.5 3.5 3 3-2.5 4.5 4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></symbol>
<symbol id="i-window" viewBox="0 0 24 24"><rect x="3.5" y="5" width="17" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M3.5 9h17" stroke="currentColor" stroke-width="1.8"/></symbol>
</svg>
<div class="app" id="app">
<header class="topbar">
<div class="status" id="status" data-state="connecting">
<span class="status-dot"></span>
<span class="status-text" id="status-text" data-i18n="status.connecting"></span>
</div>
<div class="topbar-actions">
<button class="chip" id="lang-toggle" type="button">EN</button>
<button class="icon-btn" id="fullscreen" type="button" data-i18n-label="action.fullscreen">
<svg><use href="#i-expand"/></svg>
</button>
</div>
</header>
<main class="panels">
<!-- Lecture : lecteur MPRIS, puis volume et sorties audio (PipeWire) sous le lecteur -->
<section class="panel panel-stack" id="panel-player" data-panel="player">
<div class="empty" id="player-empty">
<svg id="player-none-icon"><use href="#i-music"/></svg>
<!-- Dernier fichier ouvert depuis l'onglet Médias : titre et image, même sans lecteur MPRIS -->
<div class="last-media" id="last-media" hidden>
<p class="sub" data-i18n="player.last_opened"></p>
<div class="last-art">
<img id="last-img" alt="" hidden>
<svg id="last-icon"><use id="last-icon-use" href="#i-film"/></svg>
</div>
<h2 id="last-title"></h2>
</div>
<p data-i18n="player.none"></p>
</div>
<div class="now-playing" id="player-view" hidden>
<div class="cover" id="cover">
<img id="cover-img" alt="" hidden>
<svg class="cover-fallback"><use href="#i-music"/></svg>
</div>
<div class="track">
<div class="player-tabs" id="player-tabs" role="tablist"></div>
<h1 class="track-title" id="track-title"></h1>
<p class="track-artist" id="track-artist"></p>
<p class="track-album" id="track-album"></p>
<!-- Progression et commandes : restent visibles en bas de la zone du lecteur, quelle que soit la hauteur -->
<div class="controls">
<div class="progress">
<input type="range" id="seek" min="0" max="1000" value="0" step="1" data-i18n-label="player.seek">
<div class="times">
<span id="time-pos">0:00</span>
<span id="time-len">0:00</span>
</div>
</div>
<div class="transport">
<button class="icon-btn toggle" id="btn-shuffle" type="button" data-i18n-label="player.shuffle">
<svg><use href="#i-shuffle"/></svg>
</button>
<button class="icon-btn big" id="btn-prev" type="button" data-i18n-label="player.previous">
<svg><use href="#i-prev"/></svg>
</button>
<button class="play-btn" id="btn-play" type="button" data-i18n-label="player.play_pause">
<svg><use id="play-icon" href="#i-play"/></svg>
</button>
<button class="icon-btn big" id="btn-next" type="button" data-i18n-label="player.next">
<svg><use href="#i-next"/></svg>
</button>
<button class="icon-btn toggle" id="btn-loop" type="button" data-i18n-label="player.loop">
<svg><use href="#i-loop"/></svg>
<span class="badge" id="loop-badge" hidden>1</span>
</button>
</div>
</div>
<div class="player-extra">
<div class="slider-row" id="player-volume-row" hidden>
<svg><use href="#i-volume"/></svg>
<input type="range" id="player-volume" min="0" max="100" value="0" data-i18n-label="player.volume">
</div>
<button class="chip" id="btn-raise" type="button" hidden>
<svg><use href="#i-window"/></svg>
<span data-i18n="player.raise"></span>
</button>
</div>
</div>
</div>
<div class="audio-view" id="audio-view">
<div class="volume-bar">
<button class="mute-btn" id="master-mute" type="button" data-i18n-label="audio.mute">
<svg><use id="master-mute-icon" href="#i-volume"/></svg>
</button>
<input type="range" id="master-volume" class="thick" min="0" max="100" value="0" data-i18n-label="audio.master">
<span class="value" id="master-value">0 %</span>
<button class="chip" id="outputs-toggle" type="button" aria-expanded="false" aria-controls="sink-list" data-i18n-label="audio.outputs">
<svg><use href="#i-speaker"/></svg>
<span class="output-name" id="master-name"></span>
</button>
</div>
<ul class="sink-list" id="sink-list" hidden></ul>
</div>
<p class="sub audio-none" id="audio-empty" data-i18n="audio.none" hidden></p>
</section>
<!-- Médias : fichiers son, image et vidéo des dossiers du PC ; chaque icône ouvre le fichier sur le PC -->
<section class="panel" id="panel-media" data-panel="media" hidden>
<div class="media-bar">
<button class="icon-btn" id="media-up" type="button" data-i18n-label="media.up"><svg><use href="#i-left"/></svg></button>
<nav class="crumbs" id="media-crumbs" data-i18n-label="media.path"></nav>
<button class="icon-btn" id="media-refresh" type="button" data-i18n-label="media.refresh"><svg><use href="#i-restart"/></svg></button>
</div>
<div class="media-tools">
<div class="media-filters" id="media-filters" role="group" data-i18n-label="media.filter"></div>
<select class="media-sort" id="media-sort" data-i18n-label="media.sort"></select>
<input class="media-search" id="media-search" type="search" autocomplete="off" enterkeyhint="search" data-i18n-placeholder="media.search" data-i18n-label="media.search_label">
</div>
<div class="media-grid" id="media-grid"></div>
<p class="sub media-status" id="media-status" role="status" hidden></p>
</section>
<!-- Pavé tactile -->
<section class="panel" id="panel-remote" data-panel="remote" hidden>
<div class="empty" id="remote-empty" hidden>
<svg><use href="#i-touch"/></svg>
<p data-i18n="remote.none"></p>
<p class="sub" id="remote-reason"></p>
</div>
<div class="remote-view" id="remote-view">
<div class="touchpad" id="touchpad">
<span class="touchpad-hint" data-i18n="remote.hint"></span>
</div>
<div class="remote-side">
<div class="dpad">
<!-- Boutons de souris maintenus (bascule) : glisser-déposer, sélection -->
<button class="dpad-btn hold lmb" type="button" data-hold="left" aria-pressed="false" data-i18n-label="hold.left"><svg><use href="#i-mouse-left"/></svg><span data-i18n="hold.left_short"></span></button>
<button class="dpad-btn hold rmb" type="button" data-hold="right" aria-pressed="false" data-i18n-label="hold.right"><svg><use href="#i-mouse-right"/></svg><span data-i18n="hold.right_short"></span></button>
<button class="dpad-btn up" type="button" data-key="up" data-i18n-label="key.up"><svg><use href="#i-up"/></svg></button>
<button class="dpad-btn left" type="button" data-key="left" data-i18n-label="key.left"><svg><use href="#i-left"/></svg></button>
<button class="dpad-btn ok" type="button" data-key="enter">OK</button>
<button class="dpad-btn right" type="button" data-key="right" data-i18n-label="key.right"><svg><use href="#i-right"/></svg></button>
<button class="dpad-btn down" type="button" data-key="down" data-i18n-label="key.down"><svg><use href="#i-down"/></svg></button>
</div>
<div class="key-grid">
<button class="key" type="button" data-key="escape">Esc</button>
<button class="key" type="button" data-key="back"><svg><use href="#i-back"/></svg></button>
<button class="key" type="button" data-key="space" data-i18n="key.space"></button>
<button class="key" type="button" data-key="fullscreen">F</button>
<button class="key" type="button" data-key="f11">F11</button>
<button class="key" type="button" data-key="meta" data-i18n="key.meta"></button>
<button class="key" type="button" data-key="page_up" data-i18n="key.page_up"></button>
<button class="key" type="button" data-key="page_down" data-i18n="key.page_down"></button>
<button class="key" type="button" data-key="tab">Tab</button>
<button class="key wide" type="button" id="text-open">
<svg><use href="#i-keyboard"/></svg><span data-i18n="text.open"></span>
</button>
</div>
</div>
</div>
</section>
<!-- Lanceurs -->
<section class="panel" id="panel-launchers" data-panel="launchers" hidden>
<div class="section-head">
<h2 class="section-title" data-i18n="launchers.title"></h2>
<a class="chip" id="launchers-manage" href="/admin" data-i18n="launchers.manage" hidden></a>
</div>
<div class="launcher-grid" id="launcher-grid"></div>
<p class="sub" id="launchers-empty" data-i18n="launchers.empty" hidden></p>
</section>
<!-- Système : opérations délicates (verrouillage, veille, redémarrage, extinction) -->
<section class="panel" id="panel-system" data-panel="system" hidden>
<h2 class="section-title" data-i18n="system.session"></h2>
<div class="power-grid">
<button class="power-btn" type="button" data-system="lock">
<svg><use href="#i-lock"/></svg><span data-i18n="system.lock"></span>
</button>
<button class="power-btn hold" type="button" data-power="suspend">
<svg><use href="#i-moon"/></svg><span data-i18n="system.suspend"></span>
</button>
<button class="power-btn hold" type="button" data-power="reboot">
<svg><use href="#i-restart"/></svg><span data-i18n="system.reboot"></span>
</button>
<button class="power-btn hold danger" type="button" data-power="poweroff">
<svg><use href="#i-power"/></svg><span data-i18n="system.poweroff"></span>
</button>
</div>
<p class="sub" data-i18n="system.hold_hint"></p>
</section>
</main>
<nav class="tabbar" id="tabbar">
<button class="tab active" type="button" data-tab="player"><svg><use href="#i-music"/></svg><span data-i18n="tab.player"></span></button>
<button class="tab" type="button" data-tab="media" hidden><svg><use href="#i-folder"/></svg><span data-i18n="tab.media"></span></button>
<button class="tab" type="button" data-tab="remote"><svg><use href="#i-touch"/></svg><span data-i18n="tab.remote"></span></button>
<button class="tab" type="button" data-tab="launchers"><svg><use href="#i-app"/></svg><span data-i18n="tab.launchers"></span></button>
<button class="tab" type="button" data-tab="system"><svg><use href="#i-power"/></svg><span data-i18n="tab.system"></span></button>
</nav>
<!-- Saisie de texte : le clavier de la tablette remplit le champ, le PC reçoit des frappes -->
<dialog class="top" id="text-dialog" aria-labelledby="text-title">
<form id="text-form" novalidate>
<h2 id="text-title" data-i18n="text.title"></h2>
<input id="text-input" type="text" maxlength="500" enterkeyhint="send" autocomplete="off"
autocapitalize="off" autocorrect="off" spellcheck="false" data-i18n-placeholder="text.placeholder"
data-i18n-label="text.title">
<label class="check">
<input id="text-mask" type="checkbox">
<span data-i18n="text.mask"></span>
</label>
<div class="quick-keys">
<button class="key" type="button" data-text-key="tab">Tab</button>
<button class="key" type="button" data-text-key="back" data-i18n-label="key.back"><svg><use href="#i-back"/></svg></button>
<button class="key" type="button" data-text-key="enter">↵</button>
</div>
<p class="sub" data-i18n="text.hint"></p>
<div class="form-actions">
<button class="chip" id="text-close" type="button" data-i18n="text.close"></button>
<button class="chip" id="text-send" type="button" data-i18n="text.send"></button>
<button class="primary" type="submit" data-i18n="text.send_enter"></button>
</div>
</form>
</dialog>
<!-- Choix du lecteur d'un fichier (appui long sur une tuile du type qui a plusieurs lecteurs) -->
<div class="chooser" id="media-chooser" hidden>
<div class="chooser-backdrop" id="media-chooser-backdrop"></div>
<div class="chooser-sheet" role="dialog" aria-labelledby="media-chooser-heading">
<p class="sub" id="media-chooser-heading" data-i18n="media.chooser_title"></p>
<p class="chooser-file" id="media-chooser-file"></p>
<div class="chooser-list" id="media-chooser-list"></div>
<button class="chip" id="media-chooser-cancel" type="button" data-i18n="media.chooser_cancel"></button>
</div>
</div>
<div class="toast" id="toast" role="status" aria-live="polite" hidden></div>
<div class="overlay" id="no-token" hidden>
<svg><use href="#i-lock"/></svg>
<h1 data-i18n="token.title"></h1>
<p data-i18n="token.help"></p>
<code>python -m mediadeck --url</code>
</div>
</div>
</body>
</html>