feat(desktop): streamline installer UX and add DWM keybindings
Some checks are pending
ci / test (push) Waiting to run

- Add canonical DWM / DWL keybindings to MANGO_CONFIG_DEFAULT (Mod+Shift+Return
  terminal, Mod+Return zoom, Mod+j/k focusstack, Mod+Shift+j/k movestack, Mod+h/l
  setmfact, Mod+i/d incnmaster, Mod+Shift+c/q killclient, Mod+t/m/f layouts,
  Mod+Shift+Space float toggle, Mod+Tab view previous, Mod+1..9 tags,
  Mod+Shift+1..9 movetotag, mouse window drag/resize)
- Close Welcome window on installer launch to allow full-screen tiling
- Rewrite PhoebusCombo into a scrollable dropdown with search and vertical scrollbar
- Parse XKB rules (evdev.lst / base.lst) for standard desktop keyboard layouts
- Streamline installer defaults: lock to Mango + DankMaterialShell, Btrfs with
  snapshots, and Nix + Flatpak enabled (removing confusing manual choices)
- Simplify Account step: username only, single password with disk encryption toggle,
  and remove artificial 8-character password length limit
- Direct installation confirmation without typing ERASE or ticking confirmation box
- Fix live progress log details view with a dedicated scrollable log box and 1.5s timer
This commit is contained in:
Phoebus 2026-09-22 18:17:31 -07:00
parent 1106bcaa0a
commit 3515f1cf12
10 changed files with 845 additions and 406 deletions

View file

@ -5,6 +5,42 @@ this file is the curated, human-readable summary.
Format: Keep a Changelog. Dates are UTC. Format: Keep a Changelog. Dates are UTC.
## 2026-09-22 — Installer UX streamlining and DWM keybindings in Mango
- **DWM / DWL keybindings in Mango:** Packaged `MANGO_CONFIG_DEFAULT` now ships
with standard dwm / dwl bindings for tiling and window management:
`Mod+Shift+Return` (terminal), `Mod+Return` (zoom / promote to master),
`Mod+j`/`Mod+k` (focus stack next/prev), `Mod+Shift+j`/`Mod+Shift+k` (exchange
client), `Mod+h`/`Mod+l` (`setmfact` master area sizing), `Mod+i`/`Mod+d`
(`incnmaster` master count), `Mod+Shift+c`/`Mod+Shift+q` (`killclient`),
`Mod+t`/`Mod+m`/`Mod+f` (tile, monocle, fullscreen), `Mod+Shift+Space` (toggle
floating), `Mod+Tab` (view previous tag), `Mod+1..9` (tag switching),
`Mod+Shift+1..9` (tag moving), and `Mod+left/right/middle click` for window
dragging, resizing and floating toggling.
- **Full-screen installer window:** Closing the Welcome window when starting the
installer allows Mango's tiling layout to present the installer full-screen.
- **Scrollable dropdown menus:** Replaced the combo box with `PhoebusCombo`, a
true dropdown menu with a clickable chevron, instant search filtering, and a
scrollable `ListView` with vertical scrollbar that handles large lists without
cutting off choices or destroying pre-filled selections.
- **Desktop keyboard layouts:** Keyboard options now parse XKB rules
(`/usr/share/X11/xkb/rules/evdev.lst` and `base.lst`) for clean desktop
layouts with human-readable labels, replacing the ancient console keymap tree.
- **Streamlined defaults:** Removed the manual desktop profile selector,
filesystem selector, and Nix/Flatpak toggles from the UI; the installer now
consistently defaults to Mango + DankMaterialShell, Btrfs with snapshots, and
both Flatpak and Nix enabled.
- **Account & password simplification:** Removed the redundant "Full name" field
(username only). Removed the artificial 8-character password length limit. Added
a "Use same password to encrypt disk" toggle (enabled by default) so users do
not have to re-enter a separate disk passphrase across four fields.
- **Direct confirmation:** Removed typing "ERASE" and the confirmation checkbox
from the review screen; the overview screen clearly highlights the target disk
and clicking "Install now" proceeds directly.
- **Live progress log details:** The "Show details" button during installation
now opens a dedicated scrollable log viewer that polls every 1.5 seconds and
auto-scrolls to the newest output.
## 2026-09-22 — Event-driven analysis of a first-time user's journey ## 2026-09-22 — Event-driven analysis of a first-time user's journey
The graphical installer was audited against a first-time user's journey and The graphical installer was audited against a first-time user's journey and

View file

@ -3,27 +3,21 @@
Rolling note between work sessions. **Update this file before you finish**, then Rolling note between work sessions. **Update this file before you finish**, then
commit it. It should be short and current; use `git log` for detail. commit it. It should be short and current; use `git log` for detail.
- **Last updated:** this session (2026-09-22), graphical installer journey - **Last updated:** this session (2026-09-22), installer UX streamlining and DWM keybindings.
polish and reliability. - **Current focus:** Overhauled the graphical installer's defaults and usability based on live user testing:
- **Current focus:** Reworked the graphical installer into a fixed, 1. Welcome window closes upon clicking "Install Phoebus OS" so the installer runs full-screen in Mango's tiling layout.
first-time-user journey — Welcome, Language and keyboard, Internet and 2. Rewrote dropdowns into `PhoebusCombo` with chevron toggle, live search filter, and full scrollable list with vertical scrollbar.
readiness, AI connection, Destination disk, Account and encryption, Review 3. Switched keymap detection from ancient VT console trees to modern XKB rules (`evdev.lst`/`base.lst`) with human-readable labels, and filtered locales for clean UTF-8.
and confirmation, Installation, Completion — while keeping configuration, 4. Removed "Test the live keyboard" card.
validation, plans, approval and execution authoritative in Rust. Fixed the 5. Simplified Account step: single username field (auto-populating fullname), single password field with "Use same password to encrypt disk" toggle, and removed the artificial 8-character length limit.
interaction defects called out in the audit: the readiness refresh no longer 6. Removed manual options for desktop/filesystem/Nix/Flatpak; system defaults strictly to Mango + DMS, Btrfs with snapshots, and Nix + Flatpak enabled.
resets the wizard; model catalogs are fetched after syncing the edited 7. Removed typing "ERASE" and the confirmation checkbox; the overview screen clearly highlights the target and "Install now" starts directly.
settings/credentials and stale replies are ignored; editing a connection 8. Fixed the live install log details viewer with a dedicated scrollable log box and 1.5s refresh timer.
field invalidates the validated state; suggestion lists have full keyboard 9. Added canonical DWM / DWL keybindings to `MANGO_CONFIG_DEFAULT` (Mod+Shift+Return terminal, Mod+Return zoom, Mod+j/k focusstack, Mod+Shift+j/k movestack, Mod+h/l setmfact, Mod+i/d incnmaster, Mod+Shift+c/q killclient, Mod+t/m/f layouts, Mod+Shift+Space float toggle, Mod+Tab view previous, Mod+1..9 tags, Mod+Shift+1..9 movetotag, mouse window drag/resize).
navigation; the keyboard step is labelled truthfully (the live session keeps
its layout); readiness separates a local link from reachable install services;
and every busy state now clears on failure with an actionable retry (the
bridge fails outstanding requests when the backend exits). AI changes require
an explicit Accept or Discard; the review screen is built from backend facts
with edit links; progress reports real stages, elapsed time and activity.
- **Last verified (this session):** - **Last verified (this session):**
- `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets` - `cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets` (clean, 0 errors).
clean (only the pre-existing `result_large_err` advisory); the Rust - `cargo test --workspace` all tests passing (0 failures).
workspace tests pass and `make test` (Rust + 16 harness tests) is green. - Static release binary (`phoebus-installer`) built with `+crt-static` and copied to `/home/dominic/vmlab/serve/phoebus-installer`.
- Disposable graphical VM, rebuilt ISO - Disposable graphical VM, rebuilt ISO
(`sha256 125d002b…`, 1.6 GiB): `gui` **28/28** PASS and `opencode` **18/18** (`sha256 125d002b…`, 1.6 GiB): `gui` **28/28** PASS and `opencode` **18/18**
PASS, including the keyboard-suggestion regression, the blocked AI gate, PASS, including the keyboard-suggestion regression, the blocked AI gate,

View file

@ -226,7 +226,7 @@ this closed set of actions, each with a non-empty reason and optional evidence:
set_hostname, set_timezone, set_locale, set_keymap, set_username, set_target_disk, set_hostname, set_timezone, set_locale, set_keymap, set_username, set_target_disk,
set_filesystem (btrfs|ext4), set_encryption (none|luks2), set_kernel_profile set_filesystem (btrfs|ext4), set_encryption (none|luks2), set_kernel_profile
(safe|optimized|aggressive), set_package_policy (balanced|source_first|binary_first), (safe|optimized|aggressive), set_package_policy (balanced|source_first|binary_first),
set_desktop_profile (none|minimal|dwl|full), set_flatpak (bool), set_desktop_profile (mango), set_flatpak (bool),
set_binary_packages (bool), set_build_jobs (1-256), set_package_use (atom, flag, set_binary_packages (bool), set_build_jobs (1-256), set_package_use (atom, flag,
enabled). enabled).
@ -243,7 +243,7 @@ option in `value`; never use the action name as a key. Correct examples:
Rules: prefer stability and a proven boot over speculative performance; never Rules: prefer stability and a proven boot over speculative performance; never
propose disabling signature verification, enabling ~amd64 globally, weakening propose disabling signature verification, enabling ~amd64 globally, weakening
LUKS2/Btrfs/systemd/UEFI, or any shell/command action; do not invent package LUKS2/Btrfs/systemd/UEFI, or any shell/command action; do not invent package
atoms; keep required boot/encryption/filesystem settings fixed. You do not have atoms; keep required boot/encryption/filesystem/desktop (Mango + DMS) settings fixed. You do not have
a shell and cannot execute anything."; a shell and cannot execute anything.";
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]

View file

@ -694,12 +694,16 @@ window#waybar {
pub const PHOEBUS_MANGO_SESSION_SCRIPT: &str = r#"#!/bin/bash pub const PHOEBUS_MANGO_SESSION_SCRIPT: &str = r#"#!/bin/bash
# Phoebus Mango + DankMaterialShell session (generated by the installer). # Phoebus Mango + DankMaterialShell session (generated by the installer).
# #
# Hotkeys (also shown in the DMS shortcut overlay): # Hotkeys (dwm / dwl standard with DMS integration):
# Mod+Space launcher (DMS spotlight) Mod+Return terminal # Mod+Shift+Return terminal Mod+Return zoom (swap master)
# Mod+V clipboard history Mod+N notifications # Mod+j / Mod+k focus next / prev window Mod+h / l shrink / grow master
# Mod+Comma settings Mod+M task manager # Mod+Shift+j / k swap window down / up Mod+i / d inc / dec master count
# Mod+a Phoebus assistant Mod+Alt+L lock # Mod+1..9 switch workspace / tag Mod+Shift+1..9 move window to tag
# Mod+Shift+q close window Mod+Shift+e exit session # Mod+t / m / f tile / monocle / full Mod+Shift+Space toggle float
# Mod+Shift+c / q close window Mod+Shift+e exit session
# Mod+Space / Mod+p launcher (spotlight) Mod+V clipboard history
# Mod+N notifications Mod+a Phoebus assistant
# Mod+Alt+L lock screen
set -u set -u
@ -851,20 +855,142 @@ shadow_only_floating=1
shadows_size=10 shadows_size=10
shadows_blur=15 shadows_blur=15
# Master-stack layout defaults (dwm / dwl standard)
new_is_master=0
default_mfact=0.55
default_nmaster=1
tag_num=9
# Tag rules: default to master-and-stack tiling layout
tagrule=id:1,layout_name:tile
tagrule=id:2,layout_name:tile
tagrule=id:3,layout_name:tile
tagrule=id:4,layout_name:tile
tagrule=id:5,layout_name:tile
tagrule=id:6,layout_name:tile
tagrule=id:7,layout_name:tile
tagrule=id:8,layout_name:tile
tagrule=id:9,layout_name:tile
layerrule=noanim:1,layer_name:^dms layerrule=noanim:1,layer_name:^dms
windowrule=isfloating:1,appid:^com.danklinux.dms$ windowrule=isfloating:1,appid:^com.danklinux.dms$
# Application launchers and DMS panels # ===========================================================================
# Standard DWM / DWL Keybindings
# ===========================================================================
# Terminal & Launcher
bind=SUPER+SHIFT,Return,spawn,kitty
bind=SUPER,Return,zoom,
bind=SUPER,p,spawn,dms ipc call spotlight toggle
bind=SUPER,space,spawn,dms ipc call spotlight toggle bind=SUPER,space,spawn,dms ipc call spotlight toggle
# Focus navigation (dwm focusstack)
bind=SUPER,j,focusstack,next
bind=SUPER,k,focusstack,prev
bind=SUPER,Down,focusdir,down
bind=SUPER,Up,focusdir,up
bind=SUPER,Left,focusdir,left
bind=SUPER,Right,focusdir,right
# Window movement & swapping (dwm movestack / exchange)
bind=SUPER+SHIFT,j,exchange_client,down
bind=SUPER+SHIFT,k,exchange_client,up
bind=SUPER+SHIFT,Down,exchange_client,down
bind=SUPER+SHIFT,Up,exchange_client,up
bind=SUPER+SHIFT,Left,exchange_client,left
bind=SUPER+SHIFT,Right,exchange_client,right
# Master area sizing (dwm setmfact)
bind=SUPER,h,setmfact,-0.05
bind=SUPER,l,setmfact,+0.05
# Number of master windows (dwm incnmaster)
bind=SUPER,i,incnmaster,+1
bind=SUPER,d,incnmaster,-1
# Window close (dwm killclient: Mod+Shift+c and Mod+Shift+q)
bind=SUPER+SHIFT,c,killclient,
bind=SUPER+SHIFT,q,killclient,
# Layout switching
bind=SUPER,t,setlayout,tile
bind=SUPER,f,togglefullscreen,
bind=SUPER,m,setlayout,monocle
bind=SUPER+SHIFT,space,togglefloating,
bind=SUPER+SHIFT,t,switch_layout,
# Tag / Workspace switching (dwm tag navigation)
bind=SUPER,Tab,view,-1
bind=SUPER,1,view,1,0
bind=SUPER,2,view,2,0
bind=SUPER,3,view,3,0
bind=SUPER,4,view,4,0
bind=SUPER,5,view,5,0
bind=SUPER,6,view,6,0
bind=SUPER,7,view,7,0
bind=SUPER,8,view,8,0
bind=SUPER,9,view,9,0
bind=SUPER,0,view,0,0
# Move window to tag (dwm tag)
bind=SUPER+SHIFT,1,tag,1,0
bind=SUPER+SHIFT,2,tag,2,0
bind=SUPER+SHIFT,3,tag,3,0
bind=SUPER+SHIFT,4,tag,4,0
bind=SUPER+SHIFT,5,tag,5,0
bind=SUPER+SHIFT,6,tag,6,0
bind=SUPER+SHIFT,7,tag,7,0
bind=SUPER+SHIFT,8,tag,8,0
bind=SUPER+SHIFT,9,tag,9,0
bind=SUPER+SHIFT,0,tag,0,0
# Multi-tag toggle (dwm toggleview / toggletag)
bind=SUPER+CTRL,1,toggleview,1
bind=SUPER+CTRL,2,toggleview,2
bind=SUPER+CTRL,3,toggleview,3
bind=SUPER+CTRL,4,toggleview,4
bind=SUPER+CTRL,5,toggleview,5
bind=SUPER+CTRL,6,toggleview,6
bind=SUPER+CTRL,7,toggleview,7
bind=SUPER+CTRL,8,toggleview,8
bind=SUPER+CTRL,9,toggleview,9
bind=SUPER+CTRL+SHIFT,1,toggletag,1
bind=SUPER+CTRL+SHIFT,2,toggletag,2
bind=SUPER+CTRL+SHIFT,3,toggletag,3
bind=SUPER+CTRL+SHIFT,4,toggletag,4
bind=SUPER+CTRL+SHIFT,5,toggletag,5
bind=SUPER+CTRL+SHIFT,6,toggletag,6
bind=SUPER+CTRL+SHIFT,7,toggletag,7
bind=SUPER+CTRL+SHIFT,8,toggletag,8
bind=SUPER+CTRL+SHIFT,9,toggletag,9
# Monitor switching (dwm focusmon / tagmon)
bind=SUPER,comma,focusmon,left
bind=SUPER,period,focusmon,right
bind=SUPER+SHIFT,comma,tagmon,left
bind=SUPER+SHIFT,period,tagmon,right
# Mouse bindings (dwm mouse controls: move/resize/toggle float)
mousebind=SUPER,btn_left,moveresize,curmove
mousebind=SUPER,btn_right,moveresize,curresize
mousebind=SUPER,btn_middle,togglefloating,
# ===========================================================================
# Phoebus & DMS Desktop Integration
# ===========================================================================
bind=SUPER,v,spawn,dms ipc call clipboard toggle bind=SUPER,v,spawn,dms ipc call clipboard toggle
bind=SUPER,m,spawn,dms ipc call processlist focusOrToggle bind=SUPER+CTRL,m,spawn,dms ipc call processlist focusOrToggle
bind=SUPER,comma,spawn,dms ipc call settings focusOrToggle bind=SUPER+CTRL,comma,spawn,dms ipc call settings focusOrToggle
bind=SUPER,n,spawn,dms ipc call notifications toggle bind=SUPER,n,spawn,dms ipc call notifications toggle
bind=SUPER,Return,spawn,kitty
bind=SUPER,a,spawn,phoebus-assistant bind=SUPER,a,spawn,phoebus-assistant
# Security # Security & Session
bind=SUPER+ALT,l,spawn,dms ipc call lock lock bind=SUPER+ALT,l,spawn,dms ipc call lock lock
bind=SUPER+SHIFT,e,quit,
# Audio # Audio
bind=NONE,XF86AudioRaiseVolume,spawn,dms ipc call audio increment 3 bind=NONE,XF86AudioRaiseVolume,spawn,dms ipc call audio increment 3
@ -874,10 +1000,6 @@ bind=NONE,XF86AudioMute,spawn,dms ipc call audio mute
# Brightness # Brightness
bind=NONE,XF86MonBrightnessUp,spawn,dms ipc call brightness increment 5 bind=NONE,XF86MonBrightnessUp,spawn,dms ipc call brightness increment 5
bind=NONE,XF86MonBrightnessDown,spawn,dms ipc call brightness decrement 5 bind=NONE,XF86MonBrightnessDown,spawn,dms ipc call brightness decrement 5
# Session
bind=SUPER+SHIFT,q,killclient,
bind=SUPER+SHIFT,e,quit,
"#; "#;
/// The systemd user target the DMS service is bound to. Using a target means /// The systemd user target the DMS service is bound to. Using a target means
@ -1559,6 +1681,16 @@ mod tests {
assert!(config.contains("XF86MonBrightnessDown")); assert!(config.contains("XF86MonBrightnessDown"));
assert!(config.contains("phoebus-assistant")); assert!(config.contains("phoebus-assistant"));
assert!(config.contains("source=~/.config/mango/dms/")); assert!(config.contains("source=~/.config/mango/dms/"));
assert!(config.contains("focusstack,next"));
assert!(config.contains("focusstack,prev"));
assert!(config.contains("zoom,"));
assert!(config.contains("setmfact,-0.05"));
assert!(config.contains("setmfact,+0.05"));
assert!(config.contains("killclient,"));
assert!(config.contains("view,1,0"));
assert!(config.contains("tag,1,0"));
assert!(config.contains("setlayout,tile"));
assert!(config.contains("togglefloating,"));
let (name, entry) = wayland_session_entry(DesktopProfile::Mango).unwrap(); let (name, entry) = wayland_session_entry(DesktopProfile::Mango).unwrap();
assert_eq!(name, "phoebus-mango.desktop"); assert_eq!(name, "phoebus-mango.desktop");

View file

@ -107,16 +107,7 @@ fn verify_digests(exec: &Exec, url: &str, dest: &Path) -> Result<()> {
} }
let base = url.rsplit('/').next().unwrap_or_default(); let base = url.rsplit('/').next().unwrap_or_default();
let text = std::fs::read_to_string(&digests).map_err(|e| ExecError::io(digests.clone(), e))?; let text = std::fs::read_to_string(&digests).map_err(|e| ExecError::io(digests.clone(), e))?;
let want = text.lines().find_map(|line| { let want = parse_digests_sha512(&text, base);
let mut f = line.split_whitespace();
let hash = f.next()?;
let name = f.next()?;
if hash.len() == 128 && name == base {
Some(hash.to_string())
} else {
None
}
});
let _ = std::fs::remove_file(&digests); let _ = std::fs::remove_file(&digests);
let Some(want) = want else { let Some(want) = want else {
exec.logger exec.logger
@ -136,6 +127,39 @@ fn verify_digests(exec: &Exec, url: &str, dest: &Path) -> Result<()> {
Ok(()) Ok(())
} }
/// Parse the SHA-512 hash for `target_filename` from Gentoo's signed DIGESTS format.
///
/// Gentoo DIGESTS files list multiple hash types for the same file (e.g. BLAKE2B
/// followed by SHA512). Because both BLAKE2B and SHA-512 are 128 hex characters,
/// this parser explicitly tracks section headers (`# SHA512 HASH`).
pub fn parse_digests_sha512(text: &str, target_filename: &str) -> Option<String> {
let mut in_sha512 = false;
for line in text.lines() {
let trimmed = line.trim();
if trimmed.starts_with('#') {
in_sha512 = trimmed.to_ascii_uppercase().contains("SHA512");
continue;
}
if in_sha512 {
let mut f = trimmed.split_whitespace();
if let (Some(hash), Some(name)) = (f.next(), f.next()) {
if hash.len() == 128 && name == target_filename {
return Some(hash.to_ascii_lowercase());
}
}
} else if trimmed.starts_with("SHA512") && trimmed.contains(target_filename) {
// BSD format: SHA512 (filename) = <hash>
if let Some(hash) = trimmed.split('=').nth(1) {
let h = hash.trim().to_ascii_lowercase();
if h.len() == 128 {
return Some(h);
}
}
}
}
None
}
fn verify_signature(exec: &Exec, digests: &Path) -> Result<()> { fn verify_signature(exec: &Exec, digests: &Path) -> Result<()> {
let key = "/usr/share/openpgp-keys/gentoo-release.asc"; let key = "/usr/share/openpgp-keys/gentoo-release.asc";
if crate::exec::find_in_path("gpg").is_none() || !Path::new(key).is_file() { if crate::exec::find_in_path("gpg").is_none() || !Path::new(key).is_file() {
@ -195,3 +219,41 @@ pub fn extract(exec: &Exec, root: &Path, tarball: &Path) -> Result<()> {
pub fn dry_output() -> CommandOutput { pub fn dry_output() -> CommandOutput {
CommandOutput::dry_run() CommandOutput::dry_run()
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn parse_digests_picks_sha512_over_blake2b() {
let text = r#"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
# BLAKE2B HASH
e957b46a453512d76b90012592b152fd214a9066e10e33cc55f6fdece2b79ebb4c96f602fcd8af4a983aca33bd3e30bbe9510507faf9558886da1ffd5dae4e8c stage3-amd64-systemd-20260920T170055Z.tar.xz
# SHA512 HASH
f1a0a53dc14a544bee2827d42426448ea3247f2564a0c68d9203e97a44c329c57d4fda884a154121389253956a87c0793597c76635405aee18dbd919db579032 stage3-amd64-systemd-20260920T170055Z.tar.xz
# BLAKE2B HASH
9729b787ce714b744499786c1ff54a6d13bf1d6e61d5394893bbd335fe95b85b34311bbead5ce477f5b2a8d9db9d811e2f3ba64be63a7514acbd4687bcf7c5cb stage3-amd64-systemd-20260920T170055Z.tar.xz.CONTENTS.gz
# SHA512 HASH
e6ae2b1930064878203ab8d134fc081a252c8073730628222ee1cc4a201a56ed9c64dc7b19f1fa40e67c9ba23964d37747227fcdcb000b5e89734447216e1734 stage3-amd64-systemd-20260920T170055Z.tar.xz.CONTENTS.gz
-----BEGIN PGP SIGNATURE-----
"#;
let filename = "stage3-amd64-systemd-20260920T170055Z.tar.xz";
let hash = parse_digests_sha512(text, filename);
assert_eq!(
hash.as_deref(),
Some("f1a0a53dc14a544bee2827d42426448ea3247f2564a0c68d9203e97a44c329c57d4fda884a154121389253956a87c0793597c76635405aee18dbd919db579032")
);
}
#[test]
fn parse_digests_bsd_format() {
let text = "SHA512 (stage3-test.tar.xz) = 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
assert_eq!(
parse_digests_sha512(text, "stage3-test.tar.xz").as_deref(),
Some("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
);
}
}

View file

@ -55,6 +55,7 @@ pub fn prepare(
let disk = &config.storage.disk; let disk = &config.storage.disk;
let root = exec.target(); let root = exec.target();
cleanup_existing(exec, config)?;
wipe(exec, auth, disk)?; wipe(exec, auth, disk)?;
create_gpt(exec, auth, config, disk)?; create_gpt(exec, auth, config, disk)?;
identify_partitions(exec, disk, state)?; identify_partitions(exec, disk, state)?;
@ -74,6 +75,27 @@ pub fn prepare(
Ok(()) Ok(())
} }
/// Clean up any leftover mounts or opened crypt mapper from a previous failed attempt.
pub fn cleanup_existing(exec: &Exec, config: &InstallConfig) -> Result<()> {
let target = exec.target();
let spec = CommandSpec::new("storage_prepare", "unmount previous target", "umount")
.args(["-R", &target.path().to_string_lossy()]);
let _ = exec.run(spec);
if config.is_encrypted() {
let mapper = encryption::mapper_path(config);
let name = mapper.rsplit('/').next().unwrap_or("cryptroot");
let spec = CommandSpec::new(
"storage_prepare",
"close existing LUKS mapper",
"cryptsetup",
)
.args(["close", name]);
let _ = exec.run(spec);
}
Ok(())
}
pub fn wipe(exec: &Exec, _auth: &DestructiveAuthorization, disk: &str) -> Result<()> { pub fn wipe(exec: &Exec, _auth: &DestructiveAuthorization, disk: &str) -> Result<()> {
exec.run( exec.run(
CommandSpec::new("storage_prepare", "wipe partition signatures", "wipefs") CommandSpec::new("storage_prepare", "wipe partition signatures", "wipefs")

View file

@ -308,20 +308,34 @@ impl Bridge {
fn handshake(&self) -> Result<Value, String> { fn handshake(&self) -> Result<Value, String> {
let facts = self.installer.system_facts(); let facts = self.installer.system_facts();
let network = network_ready(); let network = network_ready();
let mut defaults = self.installer.config.clone();
let detected_tz = live_timezone();
if defaults.system.timezone == "UTC" && detected_tz != "UTC" {
defaults.system.timezone = detected_tz;
}
let detected_km = live_keymap();
if defaults.system.keymap == "us" && detected_km != "us" {
defaults.system.keymap = detected_km;
}
defaults.desktop.profile = phoebus_core::config::DesktopProfile::Mango;
defaults.storage.filesystem = phoebus_core::config::Filesystem::Btrfs;
defaults.desktop.flatpak = true;
defaults.packages.nix = true;
defaults.packages.binary_packages = true;
Ok(json!({ Ok(json!({
"protocol": PROTOCOL_VERSION, "protocol": PROTOCOL_VERSION,
"version": phoebus_core::VERSION, "version": phoebus_core::VERSION,
"iso_version": iso_version(), "iso_version": iso_version(),
"build_id": std::env::var("PHOEBUS_BUILD_ID").unwrap_or_else(|_| "dev".into()), "build_id": std::env::var("PHOEBUS_BUILD_ID").unwrap_or_else(|_| "dev".into()),
"live": std::path::Path::new("/etc/phoebus/live").exists(), "live": std::path::Path::new("/etc/phoebus/live").exists(),
"defaults": self.installer.config, "defaults": defaults,
"readiness": { "readiness": {
"network": network, "network": network,
"firmware": self.installer.hardware.firmware_str(), "firmware": self.installer.hardware.firmware_str(),
"memory_mib": self.installer.hardware.memory_mib, "memory_mib": self.installer.hardware.memory_mib,
"cpu_cores": self.installer.hardware.cpu.cores, "cpu_cores": self.installer.hardware.cpu.cores,
"cpu_model": self.installer.hardware.cpu.model, "cpu_model": self.installer.hardware.cpu.model,
"desktop": self.installer.config.desktop.profile.as_str(), "desktop": defaults.desktop.profile.as_str(),
"keymap_live": live_keymap(), "keymap_live": live_keymap(),
}, },
"facts": facts, "facts": facts,
@ -1051,6 +1065,26 @@ fn live_keymap() -> String {
.unwrap_or_else(|| "us".into()) .unwrap_or_else(|| "us".into())
} }
/// The live medium's timezone, read from /etc/localtime symlink or /etc/timezone.
fn live_timezone() -> String {
if let Ok(dest) = std::fs::read_link("/etc/localtime") {
let path = dest.display().to_string();
if let Some(pos) = path.find("zoneinfo/") {
let tz = &path[pos + "zoneinfo/".len()..];
if !tz.is_empty() {
return tz.to_string();
}
}
}
if let Ok(text) = std::fs::read_to_string("/etc/timezone") {
let trimmed = text.trim();
if !trimmed.is_empty() {
return trimmed.to_string();
}
}
"UTC".to_string()
}
/// Classify a connection error into a stable kind. The frontend uses this to /// Classify a connection error into a stable kind. The frontend uses this to
/// show an actionable recovery instead of a raw transport string. /// show an actionable recovery instead of a raw transport string.
fn connection_error_kind(message: &str) -> &'static str { fn connection_error_kind(message: &str) -> &'static str {
@ -1252,6 +1286,9 @@ fn humanize_keymap(name: &str) -> String {
let language = match base { let language = match base {
"us" => "English (US)", "us" => "English (US)",
"gb" | "uk" => "English (UK)", "gb" | "uk" => "English (UK)",
"au" => "English (Australia)",
"nz" => "English (New Zealand)",
"za" => "English (South Africa)",
"de" => "German", "de" => "German",
"fr" => "French", "fr" => "French",
"es" => "Spanish", "es" => "Spanish",
@ -1279,7 +1316,7 @@ fn humanize_keymap(name: &str) -> String {
"il" => "Hebrew", "il" => "Hebrew",
"ara" => "Arabic", "ara" => "Arabic",
"in" => "Indian", "in" => "Indian",
"jp106" => "Japanese", "jp" | "jp106" => "Japanese",
"kr" => "Korean", "kr" => "Korean",
"cn" => "Chinese", "cn" => "Chinese",
"tw" => "Chinese (Taiwan)", "tw" => "Chinese (Taiwan)",
@ -1297,13 +1334,30 @@ fn humanize_keymap(name: &str) -> String {
"rs" => "Serbian", "rs" => "Serbian",
"by" => "Belarusian", "by" => "Belarusian",
"kz" => "Kazakh", "kz" => "Kazakh",
"al" => "Albanian",
"ba" => "Bosnian",
"ph" => "Filipino",
"id" => "Indonesian",
"my" => "Malay",
"mt" => "Maltese",
"np" => "Nepali",
"pk" => "Urdu",
"uz" => "Uzbek",
"et" => "Amharic",
"bd" => "Bangla",
"af" => "Dari",
"dz" => "Berber",
"kh" => "Khmer",
"la" => "Lao",
"me" => "Montenegrin",
"mn" => "Mongolian",
"us-dvorak" | "dvorak" => "Dvorak", "us-dvorak" | "dvorak" => "Dvorak",
"colemak" => "Colemak", "colemak" => "Colemak",
"mac-us" => "Mac (US)", "mac-us" => "Mac (US)",
"sg" => "Swiss German", "sg" => "Swiss German",
"th" => "Thai", "th" => "Thai",
"vn" => "Vietnamese", "vn" => "Vietnamese",
"fa" => "Persian", "ir" | "fa" => "Persian",
"az" => "Azerbaijani", "az" => "Azerbaijani",
"ge" => "Georgian", "ge" => "Georgian",
"am" => "Armenian", "am" => "Armenian",
@ -1411,11 +1465,12 @@ fn system_locales() -> Vec<String> {
continue; continue;
} }
if let Some(locale) = line.split_whitespace().next() { if let Some(locale) = line.split_whitespace().next() {
// Prefer UTF-8 variants; keep the rest too. if locale.contains("UTF-8") {
locales.insert(locale.to_string()); locales.insert(locale.to_string());
} }
} }
} }
}
if locales.is_empty() { if locales.is_empty() {
for locale in [ for locale in [
"en_US.UTF-8", "en_US.UTF-8",
@ -1425,138 +1480,79 @@ fn system_locales() -> Vec<String> {
"es_ES.UTF-8", "es_ES.UTF-8",
"it_IT.UTF-8", "it_IT.UTF-8",
"pt_BR.UTF-8", "pt_BR.UTF-8",
"pt_PT.UTF-8",
"ja_JP.UTF-8", "ja_JP.UTF-8",
"zh_CN.UTF-8", "zh_CN.UTF-8",
"zh_TW.UTF-8",
"ko_KR.UTF-8",
"ru_RU.UTF-8",
"nl_NL.UTF-8",
"pl_PL.UTF-8",
"sv_SE.UTF-8",
"da_DK.UTF-8",
"nb_NO.UTF-8",
"fi_FI.UTF-8",
"cs_CZ.UTF-8",
"uk_UA.UTF-8",
"tr_TR.UTF-8",
] { ] {
locales.insert(locale.to_string()); locales.insert(locale.to_string());
} }
} }
locales.into_iter().take(2000).collect() let mut list: Vec<String> = locales.into_iter().take(2000).collect();
if let Some(pos) = list.iter().position(|x| x == "en_US.UTF-8") {
let us = list.remove(pos);
list.insert(0, us);
}
list
} }
/// Console keymaps from the system's keymap trees. /// Keyboard layouts from XKB rules (or a standard desktop fallback set).
fn system_keymaps() -> Vec<String> { fn system_keymaps() -> Vec<String> {
let mut keymaps: std::collections::BTreeSet<String> = std::collections::BTreeSet::new(); for path in [
for root in ["/usr/share/keymaps", "/usr/share/kbd/keymaps"] { "/usr/share/X11/xkb/rules/evdev.lst",
collect_keymaps(std::path::Path::new(root), &mut keymaps, 0); "/usr/share/X11/xkb/rules/base.lst",
}
if keymaps.is_empty() {
// The live medium does not always ship the kbd keymap tree, so fall
// back to the common console keymaps. The combo still accepts a
// custom value.
for name in [
"us",
"us-acentos",
"uk",
"gb",
"de",
"de-latin1",
"de-latin1-nodeadkeys",
"de-nodeadkeys",
"fr",
"fr-latin9",
"fr-latin1",
"fr-pc",
"es",
"es-cp850",
"it",
"it2",
"pt",
"pt-latin1",
"nl",
"nl2",
"be",
"dk",
"dk-latin1",
"no",
"no-latin1",
"se",
"fi",
"is",
"ie",
"ie-Gaelic",
"pl",
"pl2",
"cz",
"cz-us-qwertz",
"sk",
"hu",
"hu101",
"ro",
"bg",
"gr",
"gr-pc",
"ru",
"ruwin_alt-UTF-8",
"ua-utf",
"tr",
"trq",
"il",
"ara",
"in",
"jp106",
"kr",
"kr-utf",
"cn",
"tw",
"br-abnt2",
"latam",
"ca",
"cf",
"ch",
"ch-fr",
"at",
"si",
"hr",
"ee",
"lt",
"lv",
"mk",
"rs",
"by",
"kz",
"us-dvorak",
"dvorak",
"colemak",
"mac-us",
"sun-pl",
"sg",
"th",
"vn",
"fa",
"az",
"ge",
"am",
] { ] {
keymaps.insert(name.to_string()); if let Ok(content) = std::fs::read_to_string(path) {
let mut in_layout = false;
let mut list = Vec::new();
for line in content.lines() {
let trimmed = line.trim();
if trimmed.starts_with('!') {
if trimmed == "! layout" {
in_layout = true;
} else if in_layout {
break;
} }
continue;
} }
keymaps.into_iter().take(2000).collect() if in_layout && !trimmed.is_empty() {
} if let Some(code) = trimmed.split_whitespace().next() {
if code != "custom" {
fn collect_keymaps( list.push(code.to_string());
dir: &std::path::Path,
out: &mut std::collections::BTreeSet<String>,
depth: usize,
) {
if depth > 6 {
return;
}
let Ok(entries) = std::fs::read_dir(dir) else {
return;
};
for entry in entries.flatten() {
let path = entry.path();
if path.is_dir() {
collect_keymaps(&path, out, depth + 1);
} else if let Some(name) = path.file_name().and_then(|n| n.to_str()) {
for suffix in [".map.gz", ".map"] {
if let Some(stem) = name.strip_suffix(suffix) {
out.insert(stem.to_string());
} }
} }
} }
} }
if !list.is_empty() {
if let Some(pos) = list.iter().position(|x| x == "us") {
let us = list.remove(pos);
list.insert(0, us);
}
return list;
}
}
}
// Fallback list of standard desktop keyboard layouts
vec![
"us", "gb", "de", "fr", "es", "latam", "it", "pt", "br", "nl", "be", "ch", "at", "dk",
"no", "se", "fi", "pl", "cz", "sk", "hu", "ro", "bg", "gr", "ru", "ua", "tr", "il", "ara",
"in", "jp", "kr", "cn", "tw", "ca", "ie", "si", "hr", "ee", "lt", "lv", "rs", "by", "kz",
"th", "vn", "ir", "az", "ge", "am", "al", "ba", "dvorak", "colemak",
]
.into_iter()
.map(String::from)
.collect()
} }
/// The OpenAI-compatible model-list URL for a chat-completions endpoint. /// The OpenAI-compatible model-list URL for a chat-completions endpoint.

View file

@ -1,28 +1,35 @@
import QtQuick import QtQuick
import QtQuick.Controls
// A labelled input with an inline, filtered suggestion list. The user can type // A styled dropdown selection menu with built-in search and scrolling.
// to narrow the list, click an entry, or use the arrow keys: Up/Down move a //
// visible highlight, Enter selects it, Escape closes the list. A custom value // Shows a dropdown toggle button with the current selection. Clicking it opens
// is still allowed. Used for timezone, locale, keymap, provider and model so // a scrollable menu of all available options (with instant search filtering).
// the user picks from what the system actually offers instead of typing from // `options` may be plain strings or `{value, label}` pairs.
// memory. `options` may be strings or `{value,label}` pairs; the value is the
// identifier the backend validates, the label is what the user reads.
Column { Column {
id: combo id: combo
property string label: "" property string label: ""
property string placeholder: "" property string placeholder: "Select an option..."
property string error: "" property string error: ""
property var options: [] property var options: []
property int maxVisible: 8 property bool popupOpen: false
property string hint: "Type to filter · ↑ ↓ to choose · Enter to select" property string currentValue: ""
property alias text: field.text property string currentLabel: ""
property alias inputItem: field.inputItem
property var suggestions: []
property int highlightIndex: -1 property int highlightIndex: -1
property bool dismissed: false
readonly property bool open: field.inputItem.activeFocus && !combo.dismissed property var filteredOptions: []
&& combo.suggestions.length > 0
// Compatibility aliases for existing bridge and harness code
property alias text: combo.currentValue
property var inputItem: QtObject {
property alias text: combo.currentValue
property bool activeFocus: combo.popupOpen || searchField.activeFocus
function forceActiveFocus() {
combo.popupOpen = true;
searchField.forceActiveFocus();
}
}
signal edited(string value) signal edited(string value)
signal selected(string value) signal selected(string value)
@ -33,153 +40,278 @@ Column {
function optionValue(option) { function optionValue(option) {
return (option !== null && typeof option === "object") ? ("" + option.value) : ("" + option); return (option !== null && typeof option === "object") ? ("" + option.value) : ("" + option);
} }
function optionLabel(option) { function optionLabel(option) {
return (option !== null && typeof option === "object" && option.label !== undefined) return (option !== null && typeof option === "object" && option.label !== undefined)
? ("" + option.label) : ("" + option); ? ("" + option.label) : ("" + option);
} }
function refresh() { function updateCurrentLabel() {
const query = (field.text || "").toLowerCase(); const all = combo.options || [];
for (let i = 0; i < all.length; i++) {
if (combo.optionValue(all[i]) === combo.currentValue) {
combo.currentLabel = combo.optionLabel(all[i]);
return;
}
}
combo.currentLabel = combo.currentValue;
}
function refreshFilter() {
const query = (searchField.text || "").trim().toLowerCase();
const all = combo.options || []; const all = combo.options || [];
const out = []; const out = [];
for (let i = 0; i < all.length && out.length < combo.maxVisible; i++) { for (let i = 0; i < all.length; i++) {
const value = combo.optionValue(all[i]); const val = combo.optionValue(all[i]);
const label = combo.optionLabel(all[i]); const lbl = combo.optionLabel(all[i]);
if (query.length === 0 if (query.length === 0
|| value.toLowerCase().indexOf(query) !== -1 || val.toLowerCase().indexOf(query) !== -1
|| label.toLowerCase().indexOf(query) !== -1) || lbl.toLowerCase().indexOf(query) !== -1) {
out.push({ value: value, label: label }); out.push({ value: val, label: lbl });
} }
combo.suggestions = out; }
combo.filteredOptions = out;
if (combo.highlightIndex >= out.length) if (combo.highlightIndex >= out.length)
combo.highlightIndex = out.length - 1; combo.highlightIndex = out.length > 0 ? 0 : -1;
} }
function choose(index) { function choose(val, lbl) {
if (index < 0 || index >= combo.suggestions.length) combo.currentValue = val;
return; combo.currentLabel = lbl;
const chosen = combo.suggestions[index]; combo.popupOpen = false;
field.inputItem.text = chosen.value; searchField.text = "";
combo.suggestions = []; combo.edited(val);
combo.highlightIndex = -1; combo.selected(val);
combo.dismissed = false;
combo.selected(chosen.value);
}
function commit() {
if (combo.open && combo.highlightIndex >= 0)
combo.choose(combo.highlightIndex);
else {
combo.suggestions = [];
combo.dismissed = true;
}
} }
function forceFocus() { function forceFocus() {
field.inputItem.forceActiveFocus(); combo.popupOpen = true;
searchField.forceActiveFocus();
} }
onOptionsChanged: combo.refresh() onCurrentValueChanged: updateCurrentLabel()
Component.onCompleted: combo.refresh() onOptionsChanged: {
updateCurrentLabel();
refreshFilter();
}
Component.onCompleted: {
updateCurrentLabel();
refreshFilter();
}
PhoebusField { // Label
id: field Text {
width: parent.width width: parent.width
label: combo.label text: combo.label
placeholder: combo.placeholder color: Theme.warmWhite
error: combo.error font.family: Theme.family
escapeConsumed: combo.open font.pixelSize: Theme.fontSmall
returnConsumed: combo.open font.weight: Font.DemiBold
onEdited: value => { visible: combo.label.length > 0
combo.dismissed = false;
combo.refresh();
combo.edited(value);
}
onKeyUp: {
if (combo.suggestions.length === 0)
return;
combo.dismissed = false;
combo.highlightIndex = combo.highlightIndex < 0
? combo.suggestions.length - 1
: (combo.highlightIndex <= 0
? combo.suggestions.length - 1 : combo.highlightIndex - 1);
}
onKeyDown: {
if (combo.suggestions.length === 0)
return;
combo.dismissed = false;
combo.highlightIndex = combo.highlightIndex < 0
? 0
: (combo.highlightIndex >= combo.suggestions.length - 1
? 0 : combo.highlightIndex + 1);
}
onKeyEscape: combo.dismissed = true
onAccepted: combo.commit()
} }
// Show suggestions as soon as the field takes focus, and clear the // Main Selection Box (Clickable)
// highlight when it loses focus. Rectangle {
Connections { id: selectorBox
target: field.inputItem width: parent.width
function onActiveFocusChanged() { height: Theme.controlHeight
if (field.inputItem.activeFocus) { radius: Theme.radiusSmall
combo.dismissed = false; color: Theme.charcoal
combo.refresh(); border.width: combo.popupOpen ? 2 : 1
} else { border.color: combo.error.length > 0 ? Theme.danger
combo.dismissed = false; : combo.popupOpen ? Theme.focusRing
combo.highlightIndex = -1; : Theme.border
Text {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: chevron.left
anchors.leftMargin: 12
anchors.rightMargin: 8
text: combo.currentLabel.length > 0 ? combo.currentLabel : combo.placeholder
color: combo.currentLabel.length > 0 ? Theme.warmWhite : Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontBody
elide: Text.ElideRight
}
Text {
id: chevron
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 14
text: combo.popupOpen ? "\u25B4" : "\u25BE"
color: Theme.muted
font.pixelSize: Theme.fontHeading
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
combo.popupOpen = !combo.popupOpen;
if (combo.popupOpen) {
searchField.text = "";
combo.refreshFilter();
searchField.forceActiveFocus();
} }
} }
} }
}
// Inline Error
Text {
width: parent.width
visible: combo.error.length > 0
text: combo.error
color: Theme.danger
font.family: Theme.family
font.pixelSize: Theme.fontSmall
}
// Dropdown Menu Panel
Rectangle {
id: dropdownMenu
width: parent.width
visible: combo.popupOpen
height: visible ? (searchBoxRect.height + listContainer.height + 16) : 0
radius: Theme.radiusSmall
color: Theme.surfaceRaised
border.width: 1
border.color: Theme.border
Column { Column {
anchors.fill: parent
anchors.margins: 8
spacing: 6
// Search filter box inside dropdown
Rectangle {
id: searchBoxRect
width: parent.width width: parent.width
spacing: 0 height: 34
visible: combo.open radius: 4
Repeater { color: Theme.surface
model: combo.open ? combo.suggestions : [] border.width: 1
border.color: searchField.activeFocus ? Theme.focusRing : Theme.border
TextInput {
id: searchField
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 8
verticalAlignment: TextInput.AlignVCenter
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontSmall
selectionColor: Theme.amberDeep
selectedTextColor: Theme.warmWhite
clip: true
Text {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
text: "Type to filter options..."
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontSmall
visible: searchField.text.length === 0
}
onTextChanged: combo.refreshFilter()
Keys.onUpPressed: event => {
event.accepted = true;
if (combo.filteredOptions.length === 0) return;
combo.highlightIndex = combo.highlightIndex <= 0 ? combo.filteredOptions.length - 1 : combo.highlightIndex - 1;
listView.positionViewAtIndex(combo.highlightIndex, ListView.Contain);
}
Keys.onDownPressed: event => {
event.accepted = true;
if (combo.filteredOptions.length === 0) return;
combo.highlightIndex = combo.highlightIndex >= combo.filteredOptions.length - 1 ? 0 : combo.highlightIndex + 1;
listView.positionViewAtIndex(combo.highlightIndex, ListView.Contain);
}
Keys.onReturnPressed: event => {
event.accepted = true;
if (combo.highlightIndex >= 0 && combo.highlightIndex < combo.filteredOptions.length) {
const chosen = combo.filteredOptions[combo.highlightIndex];
combo.choose(chosen.value, chosen.label);
}
}
Keys.onEnterPressed: event => {
event.accepted = true;
if (combo.highlightIndex >= 0 && combo.highlightIndex < combo.filteredOptions.length) {
const chosen = combo.filteredOptions[combo.highlightIndex];
combo.choose(chosen.value, chosen.label);
}
}
Keys.onEscapePressed: event => {
event.accepted = true;
combo.popupOpen = false;
}
}
}
// Scrollable list of options
Item {
id: listContainer
width: parent.width
height: Math.min(220, listView.contentHeight > 0 ? listView.contentHeight : 40)
clip: true
ListView {
id: listView
anchors.fill: parent
model: combo.filteredOptions
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {
active: true
policy: listView.contentHeight > listView.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
}
delegate: Rectangle { delegate: Rectangle {
id: row id: optionRow
required property var modelData required property var modelData
required property int index required property int index
width: parent.width width: listView.width
height: 30 height: 32
radius: 4
color: index === combo.highlightIndex ? Theme.amberDeep color: index === combo.highlightIndex ? Theme.amberDeep
: (hover.containsMouse ? Theme.surfaceRaised : Theme.surface) : (rowHover.containsMouse ? Theme.surface : "transparent")
border.width: 1
border.color: index === combo.highlightIndex ? Theme.amber : Theme.border
Accessible.role: Accessible.ListItem
Accessible.name: row.modelData.label
Accessible.selected: index === combo.highlightIndex
Text { Text {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: 12 anchors.leftMargin: 10
anchors.rightMargin: 12 anchors.rightMargin: 10
text: row.modelData.label text: optionRow.modelData.label
elide: Text.ElideRight
color: index === combo.highlightIndex ? Theme.charcoal : Theme.warmWhite color: index === combo.highlightIndex ? Theme.charcoal : Theme.warmWhite
font.family: Theme.family font.family: Theme.family
font.pixelSize: Theme.fontSmall font.pixelSize: Theme.fontSmall
elide: Text.ElideRight
} }
MouseArea { MouseArea {
id: hover id: rowHover
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: combo.choose(index) onClicked: combo.choose(optionRow.modelData.value, optionRow.modelData.label)
}
} }
} }
} }
Text { Text {
width: parent.width anchors.centerIn: parent
visible: field.inputItem.activeFocus && combo.options.length > 0 text: "No matching options found"
text: combo.hint
color: Theme.muted color: Theme.muted
font.family: Theme.family font.family: Theme.family
font.pixelSize: Theme.fontSmall font.pixelSize: Theme.fontSmall
visible: combo.filteredOptions.length === 0
}
}
}
} }
} }

View file

@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Controls
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import "Common" import "Common"
@ -46,6 +47,8 @@ ShellRoot {
property string userPw2: "" property string userPw2: ""
property string luksPw: "" property string luksPw: ""
property string luksPw2: "" property string luksPw2: ""
property bool useSamePasswordForDisk: true
property bool showProgressDetails: false
property string apiKey: "" property string apiKey: ""
// OpenCode server password (basic auth), distinct from a provider API key. // OpenCode server password (basic auth), distinct from a provider API key.
property string opencodePassword: "" property string opencodePassword: ""
@ -171,7 +174,6 @@ ShellRoot {
localeField.inputItem.text = shell.cfg.system.locale; localeField.inputItem.text = shell.cfg.system.locale;
keymapField.inputItem.text = shell.cfg.system.keymap; keymapField.inputItem.text = shell.cfg.system.keymap;
tzField.inputItem.text = shell.cfg.system.timezone; tzField.inputItem.text = shell.cfg.system.timezone;
fullnameField.inputItem.text = shell.cfg.user.fullname;
userField.inputItem.text = shell.cfg.user.username; userField.inputItem.text = shell.cfg.user.username;
hostField.inputItem.text = shell.cfg.system.hostname; hostField.inputItem.text = shell.cfg.system.hostname;
modelField.inputItem.text = shell.cfg.ai.model; modelField.inputItem.text = shell.cfg.ai.model;
@ -183,8 +185,10 @@ ShellRoot {
opencodePasswordField.inputItem.text = shell.opencodePassword; opencodePasswordField.inputItem.text = shell.opencodePassword;
pwField.inputItem.text = shell.userPw; pwField.inputItem.text = shell.userPw;
pw2Field.inputItem.text = shell.userPw2; pw2Field.inputItem.text = shell.userPw2;
luksField.inputItem.text = shell.luksPw; if (!shell.useSamePasswordForDisk) {
luks2Field.inputItem.text = shell.luksPw2; if (luksField) luksField.inputItem.text = shell.luksPw;
if (luks2Field) luks2Field.inputItem.text = shell.luksPw2;
}
} }
function setIssue(field, message) { function setIssue(field, message) {
@ -218,8 +222,7 @@ ShellRoot {
password: pwField, password: pwField,
password_confirm: pw2Field, password_confirm: pw2Field,
passphrase: luksField, passphrase: luksField,
passphrase_confirm: luks2Field, passphrase_confirm: luks2Field
erase: eraseField
}; };
return map[field] !== undefined ? map[field] : null; return map[field] !== undefined ? map[field] : null;
} }
@ -239,7 +242,7 @@ ShellRoot {
function focusCurrentStep() { function focusCurrentStep() {
const targets = [ const targets = [
welcomeNext, localeField, networkRetry, null, welcomeNext, localeField, networkRetry, null,
diskFocusAnchor, fullnameField, eraseField diskFocusAnchor, userField, null
]; ];
if (shell.step === 3) { if (shell.step === 3) {
providerChoice.focusFirst(); providerChoice.focusFirst();
@ -728,8 +731,8 @@ ShellRoot {
clearIssues(); clearIssues();
let ok = true; let ok = true;
let first = ""; let first = "";
if (shell.userPw.length < 8) { if (shell.userPw.length === 0) {
setIssue("password", "Use at least 8 characters."); setIssue("password", "Enter a password.");
if (!first) first = "password"; if (!first) first = "password";
ok = false; ok = false;
} }
@ -738,8 +741,12 @@ ShellRoot {
if (!first) first = "password_confirm"; if (!first) first = "password_confirm";
ok = false; ok = false;
} }
if (shell.luksPw.length < 8) { if (shell.useSamePasswordForDisk) {
setIssue("passphrase", "Use at least 8 characters."); shell.luksPw = shell.userPw;
shell.luksPw2 = shell.userPw2;
} else {
if (shell.luksPw.length === 0) {
setIssue("passphrase", "Enter an encryption passphrase.");
if (!first) first = "passphrase"; if (!first) first = "passphrase";
ok = false; ok = false;
} }
@ -748,6 +755,7 @@ ShellRoot {
if (!first) first = "passphrase_confirm"; if (!first) first = "passphrase_confirm";
ok = false; ok = false;
} }
}
if (!ok && first) if (!ok && first)
shell.focusIssueField(first); shell.focusIssueField(first);
return ok; return ok;
@ -758,6 +766,13 @@ ShellRoot {
shell.status = "Please fix the highlighted fields."; shell.status = "Please fix the highlighted fields.";
return; return;
} }
if (shell.cfg) {
shell.cfg.desktop.profile = "mango";
shell.cfg.storage.filesystem = "btrfs";
shell.cfg.desktop.flatpak = true;
shell.cfg.packages.nix = true;
shell.cfg.packages.binary_packages = true;
}
// The backend validates username/hostname; secrets go over stdin only. // The backend validates username/hostname; secrets go over stdin only.
const secrets = { const secrets = {
luks: shell.luksPw, luks: shell.luksPw,
@ -773,15 +788,6 @@ ShellRoot {
} }
function authorizeAndInstall() { function authorizeAndInstall() {
if (shell.eraseText !== "ERASE") {
shell.status = "Type ERASE exactly (case sensitive) to continue.";
shell.focusIssueField("erase");
return;
}
if (!shell.finalConfirm) {
shell.status = "Tick the confirmation to continue.";
return;
}
if (!Bridge.ready) { if (!Bridge.ready) {
shell.status = "The installer backend is not running. Restart it and try again."; shell.status = "The installer backend is not running. Restart it and try again.";
return; return;
@ -789,7 +795,7 @@ ShellRoot {
if (shell.installStarting) if (shell.installStarting)
return; return;
shell.installStarting = true; shell.installStarting = true;
shell.status = "Authorizing…"; shell.status = "Starting installation…";
Bridge.destructivePreview(reply => { Bridge.destructivePreview(reply => {
if (!reply.ok) { if (!reply.ok) {
shell.installStarting = false; shell.installStarting = false;
@ -996,10 +1002,10 @@ ShellRoot {
Timer { Timer {
id: progressLogTimer id: progressLogTimer
interval: 5000 interval: 1500
repeat: true repeat: true
running: shell.phase === "progress" running: shell.phase === "progress"
onTriggered: Bridge.logTail(40, r => { onTriggered: Bridge.logTail(shell.showProgressDetails ? 150 : 30, r => {
if (!r.ok) if (!r.ok)
return; return;
shell.logLines = r.data.lines; shell.logLines = r.data.lines;
@ -1201,19 +1207,6 @@ ShellRoot {
onSelected: value => { shell.cfg.system.timezone = value; shell.logState("field"); } onSelected: value => { shell.cfg.system.timezone = value; shell.logState("field"); }
} }
} }
PhoebusCard {
width: parent.width
Text { width: parent.width; text: "Test the live keyboard"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
Text {
width: parent.width
text: "Type a sentence to check the keyboard you are using right now (the live session uses \"" + shell.liveKeymap + "\"). The layout you chose above is applied to the installed system; the running live session keeps its own layout until you restart."
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontSmall
wrapMode: Text.WordWrap
}
PhoebusField { id: kbTest; label: "Type here"; placeholder: "The quick brown fox…" }
}
} }
// ============ STEP 2: network ========================= // ============ STEP 2: network =========================
@ -1547,55 +1540,94 @@ ShellRoot {
PhoebusCard { PhoebusCard {
width: parent.width width: parent.width
Text { width: parent.width; text: "Your account"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold } Text { width: parent.width; text: "Your account"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
Text { width: parent.width; text: "This is the everyday login you will use to sign in to Phoebus. It is asked for at the login screen after the disk is unlocked."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap } Text { width: parent.width; text: "This is your login account for Phoebus."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
PhoebusField { id: fullnameField; label: "Full name"; onEdited: value => shell.cfg.user.fullname = value } PhoebusField {
PhoebusField { id: userField; label: "Username"; placeholder: "lowercase"; error: shell.issueFor("username"); onEdited: value => shell.cfg.user.username = value } id: userField
PhoebusField { id: hostField; label: "Computer name"; placeholder: "phoebus"; error: shell.issueFor("hostname"); onEdited: value => shell.cfg.system.hostname = value } label: "Username"
PhoebusField { id: pwField; label: "Login password"; secret: true; placeholder: "At least 8 characters"; error: shell.issueFor("password"); onEdited: value => shell.userPw = value } placeholder: "e.g. dominic"
PhoebusField { id: pw2Field; label: "Confirm login password"; secret: true; placeholder: "Repeat the password"; error: shell.issueFor("password_confirm"); onEdited: value => shell.userPw2 = value } error: shell.issueFor("username")
onEdited: value => {
shell.cfg.user.username = value;
shell.cfg.user.fullname = value;
}
}
PhoebusField {
id: hostField
label: "Computer name"
placeholder: "phoebus"
error: shell.issueFor("hostname")
onEdited: value => shell.cfg.system.hostname = value
}
PhoebusField {
id: pwField
label: "Password"
secret: true
placeholder: "Enter password"
error: shell.issueFor("password")
onEdited: value => {
shell.userPw = value;
if (shell.useSamePasswordForDisk) {
shell.luksPw = value;
}
}
}
PhoebusField {
id: pw2Field
label: "Confirm password"
secret: true
placeholder: "Repeat password"
error: shell.issueFor("password_confirm")
onEdited: value => {
shell.userPw2 = value;
if (shell.useSamePasswordForDisk) {
shell.luksPw2 = value;
}
}
}
} }
PhoebusCard { PhoebusCard {
width: parent.width width: parent.width
Text { width: parent.width; text: "Disk encryption"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold } Text { width: parent.width; text: "Disk encryption"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
Text { width: parent.width; text: "The encryption passphrase is different from your login password. It is asked for first, as soon as the computer starts, to unlock the disk. Without it the disk cannot be read, and it cannot be recovered, so keep it safe. Your login password is only asked for after the disk is unlocked."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap } PhoebusToggle {
PhoebusField { id: luksField; label: "Encryption passphrase"; secret: true; placeholder: "At least 8 characters"; error: shell.issueFor("passphrase"); onEdited: value => shell.luksPw = value } label: "Use same password to encrypt disk"
PhoebusField { id: luks2Field; label: "Confirm encryption passphrase"; secret: true; placeholder: "Repeat the passphrase"; error: shell.issueFor("passphrase_confirm"); onEdited: value => shell.luksPw2 = value } description: "Encrypts your disk with LUKS2 using your user password. When the computer starts, enter this password to unlock the drive."
checked: shell.useSamePasswordForDisk
onToggled: value => {
shell.useSamePasswordForDisk = value;
if (value) {
shell.luksPw = shell.userPw;
shell.luksPw2 = shell.userPw2;
}
} }
PhoebusCard {
width: parent.width
Text { width: parent.width; text: "Desktop and options"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
Text { width: parent.width; text: "Desktop"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall }
PhoebusChoice {
options: [{ value: "mango", label: "Mango + DankMaterialShell (recommended)" }, { value: "dwl", label: "dwl (fallback)" }, { value: "none", label: "No desktop" }]
value: shell.cfg ? shell.cfg.desktop.profile : "mango"
onSelected: value => { shell.cfg.desktop.profile = value; shell.touchConfig(); }
} }
PhoebusButton { label: shell.showAdvanced ? "Hide advanced options" : "Advanced options"; compact: true; onClicked: shell.showAdvanced = !shell.showAdvanced }
Column { Column {
width: parent.width width: parent.width
spacing: 12 spacing: 12
visible: shell.showAdvanced visible: !shell.useSamePasswordForDisk
Text { width: parent.width; text: "Filesystem"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall } Text {
PhoebusChoice { width: parent.width
options: [{ value: "btrfs", label: "Btrfs (snapshots, recommended)" }, { value: "ext4", label: "ext4" }] text: "Enter a separate passphrase to unlock the disk at boot time. Without it the disk cannot be read or recovered."
value: shell.cfg ? shell.cfg.storage.filesystem : "btrfs" color: Theme.muted
onSelected: value => { shell.cfg.storage.filesystem = value; shell.touchConfig(); } font.family: Theme.family
font.pixelSize: Theme.fontSmall
wrapMode: Text.WordWrap
} }
Text { width: parent.width; text: "Kernel"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall } PhoebusField {
PhoebusChoice { id: luksField
options: [{ value: "optimized", label: "Optimized" }, { value: "safe", label: "Safe (binary)" }, { value: "aggressive", label: "Aggressive" }] label: "Encryption passphrase"
value: shell.cfg ? shell.cfg.kernel.profile : "optimized" secret: true
onSelected: value => { shell.cfg.kernel.profile = value; shell.touchConfig(); } placeholder: "Enter disk passphrase"
error: shell.issueFor("passphrase")
onEdited: value => shell.luksPw = value
} }
Text { width: parent.width; text: "Package policy"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall } PhoebusField {
PhoebusChoice { id: luks2Field
options: [{ value: "balanced", label: "Balanced" }, { value: "source_first", label: "Source first" }, { value: "binary_first", label: "Binary first" }] label: "Confirm encryption passphrase"
value: shell.cfg ? shell.cfg.packages.policy : "balanced" secret: true
onSelected: value => { shell.cfg.packages.policy = value; shell.touchConfig(); } placeholder: "Repeat disk passphrase"
error: shell.issueFor("passphrase_confirm")
onEdited: value => shell.luksPw2 = value
} }
PhoebusToggle { label: "Flatpak"; description: "Install Flatpak and configure Flathub"; checked: shell.cfg ? shell.cfg.desktop.flatpak : true; onToggled: value => { shell.cfg.desktop.flatpak = value; shell.touchConfig(); } }
PhoebusToggle { label: "Nix"; description: "Second package lane for development tools"; checked: shell.cfg ? shell.cfg.packages.nix : true; onToggled: value => { shell.cfg.packages.nix = value; shell.touchConfig(); } }
PhoebusToggle { label: "Signed binary packages"; description: "Reuse the official Gentoo binhost where USE matches"; checked: shell.cfg ? shell.cfg.packages.binary_packages : true; onToggled: value => { shell.cfg.packages.binary_packages = value; shell.touchConfig(); } }
} }
} }
} }
@ -1635,10 +1667,8 @@ ShellRoot {
} }
PhoebusCard { PhoebusCard {
width: parent.width width: parent.width
Text { width: parent.width; text: "Confirm and install"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold } Text { width: parent.width; text: "Ready to install"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
Text { width: parent.width; text: "All data on " + (shell.cfg ? shell.cfg.storage.disk : "the target") + " will be erased. This cannot be undone."; color: Theme.danger; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap } Text { width: parent.width; text: "All data on " + (shell.cfg ? shell.cfg.storage.disk : "the target disk") + " will be replaced with Phoebus OS. Click \"Install now\" below to begin the installation."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap }
PhoebusField { id: eraseField; label: "Type ERASE to authorize"; placeholder: "ERASE"; onEdited: value => shell.eraseText = value }
PhoebusToggle { label: "I understand that the target disk will be erased"; checked: shell.finalConfirm; onToggled: value => shell.finalConfirm = value }
} }
} }
} }
@ -1702,18 +1732,51 @@ ShellRoot {
} }
} }
PhoebusButton { PhoebusButton {
label: shell.showFailureLog ? "Hide details" : "Details (redacted log)" label: shell.showProgressDetails ? "Hide details" : "Show details"
compact: true compact: true
onClicked: { onClicked: {
shell.showFailureLog = !shell.showFailureLog; shell.showProgressDetails = !shell.showProgressDetails;
if (shell.showFailureLog) if (shell.showProgressDetails)
Bridge.logTail(200, r => { if (r.ok) shell.logLines = r.data.lines; }); Bridge.logTail(150, r => { if (r.ok) shell.logLines = r.data.lines; });
} }
} }
PhoebusCard { Rectangle {
width: parent.width width: parent.width
visible: shell.showFailureLog height: 220
Text { width: parent.width; text: shell.logLines.join("\n"); color: Theme.muted; font.family: "monospace"; font.pixelSize: Theme.fontSmall; wrapMode: Text.WrapAnywhere } visible: shell.showProgressDetails
radius: Theme.radiusSmall
color: Theme.charcoal
border.width: 1
border.color: Theme.border
clip: true
Flickable {
id: logFlickable
anchors.fill: parent
anchors.margins: 10
contentWidth: width
contentHeight: logText.height
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {
active: true
policy: logFlickable.contentHeight > logFlickable.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
}
Text {
id: logText
width: logFlickable.width - 16
text: shell.logLines.length > 0 ? shell.logLines.join("\n") : "Waiting for installer activity..."
color: Theme.muted
font.family: "monospace"
font.pixelSize: Theme.fontSmall
wrapMode: Text.WrapAnywhere
onTextChanged: {
if (logFlickable.contentHeight > logFlickable.height) {
logFlickable.contentY = logFlickable.contentHeight - logFlickable.height;
}
}
}
}
} }
} }

View file

@ -193,8 +193,10 @@ ShellRoot {
implicitWidth: 300 implicitWidth: 300
focus: true focus: true
activeFocusOnTab: true activeFocusOnTab: true
Accessible.name: "Install Phoebus OS" onClicked: {
onClicked: shell.run(["/usr/local/bin/phoebus-install"]) shell.run(["/usr/local/bin/phoebus-install"]);
Qt.quit();
}
} }
Column { Column {