phoebus_os/installer/live/desktop/phoebus-welcome/shell.qml
Phoebus 613e383082 fix(gui): focus the welcome action and refuse silent mid-install exit
The tiled welcome window was not keyboard-focused, so the primary action
had no focus ring and Return did nothing; request activation and force
focus. Refuse Escape during the destructive phase and say the operation
cannot be cancelled. Show the AI connection guidance beside the controls.
Guard the fixes with live_iso tests.
2026-09-21 20:01:58 -07:00

408 lines
16 KiB
Bash

import QtQuick
import Quickshell
import Quickshell.Io
import "Common"
// Phoebus OS live welcome. This is the ISO's launcher: it shows the identity,
// the system's readiness, a dominant "Install Phoebus OS" action and secondary
// troubleshooting tools under Advanced. It never authorizes or starts disk
// changes; only the installer does that, behind its own ERASE confirmation.
ShellRoot {
id: shell
property string isoVersion: "0.1.0"
property bool networkUp: false
property string firmware: "UEFI"
property string memory: "?"
property string cores: "?"
property bool showAdvanced: false
property bool showPower: false
property bool showKeyboardTest: false
function run(cmd) {
Quickshell.execDetached(cmd);
}
Process {
id: readiness
command: ["sh", "-c",
"echo VERSION=$(cat /etc/phoebus/version 2>/dev/null || cat /usr/share/phoebus/version 2>/dev/null || echo 0.1.0); " +
"awk 'NR>1 && $2==\"00000000\" {print \"NET=up\"; found=1; exit} END {if (!found) print \"NET=down\"}' /proc/net/route; " +
"if [ -d /sys/firmware/efi ]; then echo FW=UEFI; else echo FW=BIOS; fi; " +
"awk '/MemTotal/ {printf \"MEM=%.1f GiB\\n\", $2/1048576}' /proc/meminfo; " +
"echo CORES=$(nproc)"]
running: true
stdout: SplitParser {
onRead: line => {
const parts = ("" + line).split("=");
if (parts.length !== 2)
return;
switch (parts[0]) {
case "VERSION": shell.isoVersion = parts[1]; break;
case "NET": shell.networkUp = parts[1] === "up"; break;
case "FW": shell.firmware = parts[1]; break;
case "MEM": shell.memory = parts[1]; break;
case "CORES": shell.cores = parts[1]; break;
}
}
}
}
// The compositor may not have focused the tiled window yet at session
// start; request activation and, shortly after, force focus on the primary
// action so it is reachable with the keyboard (Enter).
Timer {
id: focusTimer
interval: 700
repeat: false
running: false
onTriggered: {
if (typeof window.requestActivate === "function")
window.requestActivate();
installButton.forceActiveFocus();
}
}
FloatingWindow {
id: window
Component.onCompleted: {
if (typeof window.requestActivate === "function")
window.requestActivate();
focusTimer.start();
}
visible: true
color: Theme.charcoal
implicitWidth: 940
implicitHeight: 620
title: "Phoebus OS"
// Backdrop: wallpaper when available, a calm charcoal gradient always.
Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "#1c1c22" }
GradientStop { position: 1.0; color: "#121215" }
}
}
Image {
anchors.fill: parent
source: Theme.wallpaper
fillMode: Image.PreserveAspectCrop
smooth: true
visible: status === Image.Ready
}
Rectangle {
anchors.fill: parent
color: Theme.overlay
}
Column {
id: page
anchors.fill: parent
anchors.margins: Theme.padLarge
spacing: 18
// -- header ----------------------------------------------------
Item {
width: parent.width
height: 56
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: 14
PhoebusEmblem {
width: 56
height: 56
anchors.verticalCenter: parent.verticalCenter
}
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: 2
Text {
text: "PHOEBUS <font color=\"" + Theme.amber + "\">OS</font>"
textFormat: Text.StyledText
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: 26
font.weight: Font.DemiBold
font.letterSpacing: 3
}
Text {
text: "A modern, encrypted, AI-first workstation"
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontSmall
}
}
}
Rectangle {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
height: 30
width: versionText.implicitWidth + 24
radius: 15
color: Theme.surface
border.width: 1
border.color: Theme.border
Text {
id: versionText
anchors.centerIn: parent
text: "Live medium · " + shell.isoVersion
color: Theme.amber
font.family: Theme.family
font.pixelSize: Theme.fontSmall
}
}
}
// -- hero + primary action ------------------------------------
PhoebusCard {
width: parent.width
padding: Theme.padLarge
Text {
width: parent.width
text: "Welcome to Phoebus OS"
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontDisplay
font.weight: Font.DemiBold
}
Text {
width: parent.width
text: "This medium installs Phoebus to your computer. The installer guides you through language, networking, a connected AI model, the target disk, your account and encryption."
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontBody
wrapMode: Text.WordWrap
}
Row {
width: parent.width
spacing: 20
PhoebusButton {
id: installButton
label: "Install Phoebus OS"
primary: true
implicitHeight: 58
implicitWidth: 300
focus: true
activeFocusOnTab: true
Accessible.name: "Install Phoebus OS"
onClicked: shell.run(["/usr/local/bin/phoebus-install"])
}
Column {
width: parent.width - 320
spacing: 6
anchors.verticalCenter: parent.verticalCenter
Row {
spacing: 8
PhoebusChip {
text: shell.networkUp ? "Network connected" : "Network offline"
tone: shell.networkUp ? Theme.success : Theme.warning
}
PhoebusChip { text: shell.firmware; tone: Theme.muted }
PhoebusChip { text: shell.memory + " RAM"; tone: Theme.muted }
PhoebusChip { text: shell.cores + " cores"; tone: Theme.muted }
}
Text {
width: parent.width
text: "Nothing is written until you review the plan and type ERASE. An installed system boots without a network or a model."
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontSmall
wrapMode: Text.WordWrap
}
}
}
}
// -- secondary actions ----------------------------------------
Flow {
width: parent.width
spacing: 12
PhoebusButton {
label: "Network"
onClicked: shell.run(["sh", "-c",
"command -v dms >/dev/null && exec dms ipc call settings focusOrToggle || exec kitty -e sh -c 'nmcli device status; read -r _'"])
}
PhoebusButton {
label: "Display & keyboard"
onClicked: shell.run(["sh", "-c",
"command -v dms >/dev/null && dms ipc call settings focusOrToggle || kitty -e wlr-randr"])
}
PhoebusButton {
label: "Accessibility"
onClicked: shell.run(["sh", "-c",
"command -v dms >/dev/null && dms ipc call settings focusOrToggle || true"])
}
PhoebusButton {
label: "Installation help"
onClicked: shell.run(["sh", "-c",
"kitty -e sh -c 'cat /usr/share/phoebus/install-help.txt 2>/dev/null || echo Help is not installed; read -r || true'"])
}
PhoebusButton {
label: "Keyboard test"
onClicked: shell.showKeyboardTest = true
}
PhoebusButton {
label: "Power"
onClicked: shell.showPower = true
}
}
// -- advanced / troubleshooting -------------------------------
PhoebusButton {
label: (shell.showAdvanced ? "Hide advanced tools" : "Advanced tools")
compact: true
onClicked: shell.showAdvanced = !shell.showAdvanced
}
PhoebusCard {
width: parent.width
visible: shell.showAdvanced
fill: Theme.overlay
Text {
width: parent.width
text: "Troubleshooting and recovery tools"
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontHeading
font.weight: Font.DemiBold
}
Text {
width: parent.width
text: "These tools are working and supported on the live medium. Recovery-image features are not shipped yet and are not listed here."
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontSmall
wrapMode: Text.WordWrap
}
Flow {
width: parent.width
spacing: 12
PhoebusButton {
label: "Terminal"
compact: true
onClicked: shell.run(["kitty"])
}
PhoebusButton {
label: "System log"
compact: true
onClicked: shell.run(["kitty", "-e", "sh", "-c", "journalctl -b --no-pager | less; read -r _"])
}
PhoebusButton {
label: "Installer log"
compact: true
onClicked: shell.run(["kitty", "-e", "sh", "-c", "tail -n 200 /var/log/phoebus-installer/install.log 2>/dev/null | less; read -r _"])
}
PhoebusButton {
label: "Disk information"
compact: true
onClicked: shell.run(["kitty", "-e", "sh", "-c", "lsblk -o NAME,SIZE,MODEL,TYPE,MOUNTPOINTS; read -r _"])
}
PhoebusButton {
label: "Network settings"
compact: true
onClicked: shell.run(["sh", "-c", "command -v dms >/dev/null && exec dms ipc call settings focusOrToggle || exec kitty -e sh -c 'nmcli device status; read -r _'"])
}
}
}
Item { width: 1; height: 1 }
}
// -- keyboard test overlay ----------------------------------------
Rectangle {
anchors.fill: parent
color: Theme.overlay
visible: shell.showKeyboardTest
MouseArea { anchors.fill: parent; onClicked: shell.showKeyboardTest = false }
PhoebusCard {
anchors.centerIn: parent
width: 520
padding: Theme.padLarge
Text {
width: parent.width
text: "Keyboard test"
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontTitle
font.weight: Font.DemiBold
}
Text {
width: parent.width
text: "Type in the field below to confirm your layout produces the characters you expect."
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontBody
wrapMode: Text.WordWrap
}
PhoebusField {
id: keyTest
label: "Type here"
placeholder: "The quick brown fox…"
}
Row {
spacing: 12
PhoebusButton {
label: "Close"
primary: true
onClicked: shell.showKeyboardTest = false
}
}
Component.onCompleted: keyTest.inputItem.forceActiveFocus()
}
}
// -- power overlay -------------------------------------------------
Rectangle {
anchors.fill: parent
color: Theme.overlay
visible: shell.showPower
MouseArea { anchors.fill: parent; onClicked: shell.showPower = false }
PhoebusCard {
anchors.centerIn: parent
width: 420
padding: Theme.padLarge
Text {
width: parent.width
text: "Power"
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontTitle
font.weight: Font.DemiBold
}
PhoebusButton {
label: "Restart"
onClicked: {
shell.showPower = false;
shell.run(["systemctl", "reboot"]);
}
}
PhoebusButton {
label: "Shut down"
onClicked: {
shell.showPower = false;
shell.run(["systemctl", "poweroff"]);
}
}
PhoebusButton {
label: "Cancel"
compact: true
onClicked: shell.showPower = false
}
}
}
}
}