forked from unom/punktfunk
UX polish batch 1 (clients/windows/ui-polish-plan.md, workstreams W0/A1/B/C/E):
- W0: the shell's duplicated trust/settings structs are gone — src/trust.rs
re-exports pf-client-core's, so the shell and the spawned session binary share
ONE Settings shape over client-windows-settings.json. Fixes real bugs: the
shell's saves no longer drop session-side fields; the stats-overlay toggle
(show_hud -> show_stats, serde alias migrates old files) and the forwarded-
controller pick now actually reach the spawned session. The "Streaming engine"
Settings combo is gone (PUNKTFUNK_BUILTIN_STREAM=1 stays as the dev A/B knob).
- Forwarded-controller pinning by stable key (vid:pid:name, pf-client-core's
format): persisted as forward_pad, applied by the shell's own service at
startup AND by the session binary in session_params (both OSes — the session
never applied the pin before).
- A1 single window: the shell hides itself when the spawned session window
presents its first frame ({"ready":true}) and restores + foregrounds on the
child's exit — exactly one visible Punktfunk window at any time. Restore runs
before the request-access cancel gate so a Ready/Cancel race can't strand the
shell hidden.
- C console UI: punktfunk-session --browse gains --json-status (ready when the
library window presents; error line on a failed start), and the shell
surfaces it — "Open console UI" on paired hosts' menus, plus a controller-
detected hint card targeting the most recent paired host (x64 only; aarch64
ships no skia ui feature). Browse spawns hide/restore the shell like streams.
- B responsive: minimum window size (420x360); the hosts header collapses to
icon-only buttons below 700 px; the session status card shrinks instead of
clipping (max_width); busy pages, help actions, licenses and long labels wrap.
- E polish: session exe gets the app icon (winresource + WM_SETICON via the new
pf-presenter win32.rs); both exes share an explicit AppUserModelID on
unpackaged runs (packaged identity wins) so the windows group as one taskbar
app across the visibility handoff; "Start streams fullscreen" toggle passes
--fullscreen (GTK parity); connects stamp KnownHost::last_used; the connect
target is stashed for every route so "Connecting to X" always names the host.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
92 lines
3.4 KiB
Rust
92 lines
3.4 KiB
Rust
//! The Help screen: a short note on the in-stream capture model plus a reference of the keyboard
|
|
//! shortcuts — reached from the Help button on the host list. The Windows counterpart of the GTK
|
|
//! client's Keyboard Shortcuts window; the bindings themselves live in [`crate::input`], so both
|
|
//! clients document the same set.
|
|
|
|
use super::style::*;
|
|
use super::Screen;
|
|
use windows_reactor::*;
|
|
|
|
/// The in-stream keyboard shortcuts, in the GTK Shortcuts window's order: the chord, then what it
|
|
/// does. Read-only — the bindings themselves live in the input hook ([`crate::input`]).
|
|
const STREAM_SHORTCUTS: &[(&str, &str)] = &[
|
|
("F11", "Toggle fullscreen"),
|
|
(
|
|
"Ctrl+Alt+Shift+Q",
|
|
"Release captured input (click the stream to recapture)",
|
|
),
|
|
("Ctrl+Alt+Shift+D", "Disconnect"),
|
|
("Ctrl+Alt+Shift+S", "Toggle the statistics overlay"),
|
|
];
|
|
|
|
/// A subtle key-cap chip for the shortcuts reference — the chord on a filled, bordered pill.
|
|
fn key_chip(keys: &str) -> Element {
|
|
border(text_block(keys).font_size(12.0).semibold())
|
|
.background(ThemeRef::SubtleFill)
|
|
.border_brush(ThemeRef::CardStroke)
|
|
.border_thickness(uniform(1.0))
|
|
.corner_radius(6.0)
|
|
.padding(edges(8.0, 3.0, 8.0, 3.0))
|
|
.horizontal_alignment(HorizontalAlignment::Left)
|
|
.into()
|
|
}
|
|
|
|
/// A read-only reference card listing the in-stream keyboard shortcuts. One grid, chord chip then
|
|
/// action, so the actions line up across rows.
|
|
fn shortcuts_reference() -> Element {
|
|
let mut children: Vec<Element> = Vec::new();
|
|
for (i, (keys, action)) in STREAM_SHORTCUTS.iter().enumerate() {
|
|
let row = i as i32;
|
|
children.push(key_chip(keys).grid_row(row).grid_column(0));
|
|
let action_cell: Element = text_block(*action)
|
|
.wrap()
|
|
.foreground(ThemeRef::SecondaryText)
|
|
.vertical_alignment(VerticalAlignment::Center)
|
|
.into();
|
|
children.push(action_cell.grid_row(row).grid_column(1));
|
|
}
|
|
let table = grid(children)
|
|
.columns([GridLength::Auto, GridLength::Star(1.0)])
|
|
.rows(vec![GridLength::Auto; STREAM_SHORTCUTS.len()])
|
|
.column_spacing(12.0)
|
|
.row_spacing(6.0);
|
|
card(vstack((
|
|
text_block("In-stream keyboard shortcuts")
|
|
.semibold()
|
|
.margin(edges(0.0, 0.0, 0.0, 8.0)),
|
|
table,
|
|
)))
|
|
.into()
|
|
}
|
|
|
|
/// The Help screen: a `page`-column with a Back button to the host list, an intro card on the
|
|
/// capture model, and the shortcuts reference. Hook-free — called inline from `root` like the
|
|
/// other static screens.
|
|
pub(crate) fn help_page(set_screen: &AsyncSetState<Screen>) -> Element {
|
|
let back_btn = button("Back").accent().icon(Symbol::Back).on_click({
|
|
let ss = set_screen.clone();
|
|
move || ss.call(Screen::Hosts)
|
|
});
|
|
|
|
let intro = card(
|
|
vstack((
|
|
text_block("During a stream").font_size(15.0).semibold(),
|
|
text_block(
|
|
"Click the stream to capture your mouse and keyboard \u{2014} the shortcuts below \
|
|
then work while you play. Release capture to hand the cursor back to this \
|
|
computer, and click the stream again to retake it.",
|
|
)
|
|
.font_size(12.0)
|
|
.wrap()
|
|
.foreground(ThemeRef::SecondaryText),
|
|
))
|
|
.spacing(8.0),
|
|
);
|
|
|
|
page(vec![
|
|
page_header("Help", back_btn),
|
|
intro.into(),
|
|
shortcuts_reference(),
|
|
])
|
|
}
|