diff --git a/DESIGN.md b/DESIGN.md index 544bdf6..7cf8c6d 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -223,7 +223,7 @@ No UI text below 11px. Counts and numbers use tabular figures. Folder paths in t - Proton builds: one row per build, by a readable name where the folder name allows ("Proton-CachyOS 11.0 (v3)", `protonName` in `format.ts`), with an accent "in use" tag on the build games run with, a "Steam" tag on Steam's, its size once measured, and Remove with an inline confirm for Guild's own only. The last row, Install another build, folds out one panel with a GE-Proton / Proton-CachyOS segmented control and that source's releases, each with Install (its percent while it runs) or Installed. - Prefixes: the heading carries the count and total size on the right. One row per game prefix with its name (the copy key and "Game no longer in your library" once the game is gone), its size once measured, and a ⋯ menu with Open folder, winecfg, winetricks (disabled when neither the system nor any Proton build has it; a note under the group says why) and Remove…, which asks in the row that saves in it are lost unless cloud saves are on, with focus on Cancel. - Rows in these two lists are one height, with or without a button. -- **Game page:** covers the content area while the library stays mounted underneath, so its scroll position survives. A column up to 1360px: the 300px hero, a tab row (Overview, DLC, Saves, Launch options, Installation); on Linux, Launch options adds a Proton menu chip (Default follows Settings), also for added games, where it is the only row, and never for a native Linux GOG build. A Windows game's first launch on Linux shows Setting up… in the busy pill, the card badge and Continue until its program runs. Once a Windows game has run on Linux, Installation gets a Wine prefix row with Open, winecfg and winetricks (disabled with the same reason as in Settings); never for a native Linux build, and never Remove, which stays in Settings and the uninstall confirm. Its uninstall confirm offers an Also remove its Wine prefix checkbox, off by default, then three fact tiles and an About / Details grid (1.7fr / 1fr). +- **Game page:** covers the content area while the library stays mounted underneath, so its scroll position survives. A column up to 1360px: the 300px hero, a tab row (Overview, DLC, Saves, Launch options, Installation); on Linux, Launch options adds a Proton menu chip (Default follows Settings), also for added games, where it is the only row, and never for a native Linux GOG build. A Windows game's first launch on Linux shows Setting up… in the busy pill, the card badge and Continue until its program runs, with the percent while its Play downloads umu-launcher or GE-Proton first. Once a Windows game has run on Linux, Installation gets a Wine prefix row with Open, winecfg and winetricks (disabled with the same reason as in Settings); never for a native Linux build, and never Remove, which stays in Settings and the uninstall confirm. Its uninstall confirm offers an Also remove its Wine prefix checkbox, off by default, then three fact tiles and an About / Details grid (1.7fr / 1fr). ## Elevation and shapes diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 85db294..d2260d8 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -10,7 +10,7 @@ You need [Node.js](https://nodejs.org) 24 or later, [Rust](https://rustup.rs) st sudo apt install libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libxdo-dev libssl-dev patchelf build-essential ``` -On Arch: `webkit2gtk-4.1 libayatana-appindicator librsvg xdotool base-devel`. At runtime Linux also needs `python3` (the Linux builds of Legendary and gogdl run on it), `xdg-open`, and a Secret Service provider such as GNOME Keyring or KWallet for the saved secrets. Windows games run through `umu-run` (from PATH, or downloaded in Settings) and a Proton build: GE-Proton in Steam's `compatibilitytools.d`, Steam's own Proton, or GE-Proton and Proton-CachyOS installed from Settings → Wine. Each game gets its own Wine prefix under `/prefixes/`; uninstalling a game keeps it unless the owner ticks the option to remove it, since its saves live there. Settings → Wine lists and removes prefixes. The pinned umu-launcher version and hash are in `src-tauri/src/wine.rs`. +On Arch: `webkit2gtk-4.1 libayatana-appindicator librsvg xdotool base-devel`. At runtime Linux also needs `python3` (the Linux builds of Legendary and gogdl run on it), `xdg-open`, and a Secret Service provider such as GNOME Keyring or KWallet for the saved secrets. Windows games run through `umu-run` (from PATH, or downloaded in Settings or by the first Play that needs it) and a Proton build: GE-Proton in Steam's `compatibilitytools.d`, Steam's own Proton, or GE-Proton and Proton-CachyOS installed from Settings → Wine; with none, Play installs the newest GE-Proton. Each game gets its own Wine prefix under `/prefixes/`; uninstalling a game keeps it unless the owner ticks the option to remove it, since its saves live there. Settings → Wine lists and removes prefixes. The pinned umu-launcher version and hash are in `src-tauri/src/wine.rs`. ```bash npm install diff --git a/README.md b/README.md index 3714c38..dd50d8d 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Your library, settings and play history stay on your computer, in `%LOCALAPPDATA - GOG GamesDB, to match games across stores and for some covers - the stores' image servers, for covers and screenshots - IGDB and SteamGridDB, only if you add their keys -- GitHub, to check for Guild updates, and to download a store tool, umu-launcher or a Proton build when you ask for it +- GitHub, to check for Guild updates, and to download a store tool, umu-launcher or a Proton build when you ask for it, and umu-launcher and GE-Proton the first time you play a Windows game on Linux without them Some of these connections aren't official and can break when a store changes something. When a store login stops working, a dot shows on the Settings button. diff --git a/src-tauri/src/commands/library.rs b/src-tauri/src/commands/library.rs index 8fe766c..6a3283d 100644 --- a/src-tauri/src/commands/library.rs +++ b/src-tauri/src/commands/library.rs @@ -1222,6 +1222,8 @@ pub struct Poll { /// The running game is a Windows game on Linux whose first launch still sets up (umu fetching the Steam Linux /// Runtime or making its prefix); it ends once the game's program runs. setting_up: bool, + /// The running game's Play is downloading umu-launcher or Proton first: how far, in percent. + setup_percent: Option, progress: HashMap, /// The library changed (a Steam download finished), so the UI should re-ask `library`. changed: bool, @@ -1341,9 +1343,18 @@ fn poll_blocking(app: &AppHandle) -> Poll { // The session starts when the game does, not while umu sets it up. w.since = Instant::now(); } + // A Play installing umu or Proton first shows as that game setting up, with the download's percent. + let preparing = crate::platform::preparing(); + let running = steam_running + .or(watched) + .or(preparing.as_ref().map(|p| p.0.clone())); + let setup_percent = preparing + .filter(|p| running.as_ref() == Some(&p.0)) + .map(|p| p.1); Poll { - setting_up, - running: steam_running.or(watched), + setting_up: setting_up || setup_percent.is_some(), + setup_percent, + running, progress, changed, queue, @@ -1908,6 +1919,7 @@ mod tests { let poll = Poll { running: Some("steam-635320".into()), setting_up: false, + setup_percent: None, progress: HashMap::from([("epic-Pumpkin".to_string(), progress)]), changed: false, queue: crate::downloads::view(&queue, |key| titles.get(key).map(|t| t.to_string())), diff --git a/src-tauri/src/commands/snapshots/launcher__commands__library__tests__poll_payload_snapshot.snap b/src-tauri/src/commands/snapshots/launcher__commands__library__tests__poll_payload_snapshot.snap index 67aa62c..61452a5 100644 --- a/src-tauri/src/commands/snapshots/launcher__commands__library__tests__poll_payload_snapshot.snap +++ b/src-tauri/src/commands/snapshots/launcher__commands__library__tests__poll_payload_snapshot.snap @@ -5,6 +5,7 @@ expression: poll { "running": "steam-635320", "settingUp": false, + "setupPercent": null, "progress": { "epic-Pumpkin": { "fraction": 0.5, diff --git a/src-tauri/src/platform.rs b/src-tauri/src/platform.rs index e57cef0..c7ab2a3 100644 --- a/src-tauri/src/platform.rs +++ b/src-tauri/src/platform.rs @@ -586,6 +586,17 @@ pub fn windows_game( crate::wine::game_command(game, key, proton) } +/// The copy whose Play installs umu-launcher or Proton first, and the download's percent; never on Windows. +#[cfg(windows)] +pub fn preparing() -> Option<(String, u8)> { + None +} + +#[cfg(target_os = "linux")] +pub fn preparing() -> Option<(String, u8)> { + crate::wine::preparing() +} + /// Whether a launched game still waits on its first-run setup; never on Windows. #[cfg(windows)] pub fn setting_up(_key: &str) -> bool { diff --git a/src-tauri/src/wine.rs b/src-tauri/src/wine.rs index 8a5cd32..4c078ea 100644 --- a/src-tauri/src/wine.rs +++ b/src-tauri/src/wine.rs @@ -272,6 +272,7 @@ fn wrap(game: &Command, key: &str, proton: Option<&str>) -> Result<(Command, Pro /// A game's launch through `wrap`. When umu still has to fetch the Steam Linux Runtime or set the prefix up, the copy /// counts as setting up (`setting_up`) until the game's own program runs. pub fn game_command(game: Command, key: &str, proton: Option<&str>) -> Result { + install_runner(key)?; let (mut command, proton) = wrap(&game, key, proton)?; match fs_err::File::create(crate::log::game_output(key)) { Ok(file) => _ = command.stderr(file.into_file()), @@ -295,6 +296,56 @@ pub fn game_command(game: Command, key: &str, proton: Option<&str>) -> Result Result<(), Msg> { + let need_umu = umu().is_none(); + let need_proton = protons().is_empty(); + if !need_umu && !need_proton { + return Ok(()); + } + let _preparing = Preparing::start(key); + if need_umu { + tauri::async_runtime::block_on(install_umu(Preparing::report))?; + } + if need_proton { + let newest = releases(ProtonKind::GeProton) + .and_then(|r| r.into_iter().next()) + .ok_or(msg!(noProton))?; + let install = install_proton(ProtonKind::GeProton, newest.tag, Preparing::report); + tauri::async_runtime::block_on(install)?; + } + Ok(()) +} + +static PREPARING: Mutex> = Mutex::new(None); + +struct Preparing; + +impl Preparing { + fn start(key: &str) -> Self { + *PREPARING.lock().unwrap_or_else(|e| e.into_inner()) = Some((key.to_owned(), 0)); + Self + } + + fn report(percent: u8) { + if let Some(p) = PREPARING.lock().unwrap_or_else(|e| e.into_inner()).as_mut() { + p.1 = percent; + } + } +} + +impl Drop for Preparing { + fn drop(&mut self) { + *PREPARING.lock().unwrap_or_else(|e| e.into_inner()) = None; + } +} + +/// The copy whose Play is installing umu or Proton, and the download's percent. +pub fn preparing() -> Option<(String, u8)> { + PREPARING.lock().unwrap_or_else(|e| e.into_inner()).clone() +} + /// A launch waiting on setup: the game's program file name and its prefix. struct Setup { exe: String, diff --git a/src/App.svelte b/src/App.svelte index bad8b69..da70efe 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -81,6 +81,7 @@ let version = $state(0) let running = $state(null) let settingUp = $state(false) + let setupPercent = $state(null) let progress = $state>({}) let queue = $state(api.emptyQueue) let open = $state(null) @@ -373,6 +374,7 @@ const p = await commands.poll() running = p.running settingUp = p.settingUp + setupPercent = p.setupPercent progress = p.progress queue = p.queue if (p.failed) error = api.message(p.failed) @@ -584,6 +586,7 @@ {running} {launching} {settingUp} + {setupPercent} {progress} {queue} onopen={openGame} @@ -604,6 +607,7 @@ running={running !== null && featured.copyKeys.includes(running)} launching={launching.has(featured.chosen)} {settingUp} + {setupPercent} onplay={(key) => act('play', key)} onopen={openGame} /> @@ -669,6 +673,7 @@ gameKey={open} runningKey={running} {settingUp} + {setupPercent} progressByKey={progress} {queue} oncancel={cancelDownload} diff --git a/src/lib/Card.svelte b/src/lib/Card.svelte index 6fbe16b..ac35bf0 100644 --- a/src/lib/Card.svelte +++ b/src/lib/Card.svelte @@ -4,6 +4,7 @@ import { cover, prefetch, type QueueState } from './api' import type { Card, Cover, Progress } from './bindings' import { t } from './i18n' + import { settingUpLabel } from './format' let { game, @@ -12,6 +13,7 @@ running, launching = false, settingUp = false, + setupPercent = null, progress, queued, onopen, @@ -32,6 +34,8 @@ launching?: boolean /** Running, but its first launch on Linux still sets up. */ settingUp?: boolean + /** Its Play is downloading umu or Proton first. */ + setupPercent?: number | null progress: Progress | undefined /** Where this game is in the download queue; null when it isn't. */ queued: QueueState | null @@ -154,7 +158,7 @@ {#if running} - {settingUp ? t('busy.settingUp') : t('play.playing')} + {settingUp ? settingUpLabel(setupPercent) : t('play.playing')} {:else if waiting} {waiting.state === 'paused' ? t('downloads.paused') : t('card.queued')} {:else if progress} diff --git a/src/lib/Continue.svelte b/src/lib/Continue.svelte index 7d76d34..ba0edba 100644 --- a/src/lib/Continue.svelte +++ b/src/lib/Continue.svelte @@ -1,12 +1,14 @@