phoebus_os/installer/live/desktop/phoebus-welcome/shell.qml
2026-10-01 18:56:40 -07:00

534 lines
22 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtQuick
import QtQuick.Controls
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 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 string currentResolution: ""
property bool showDisplay: false
property bool showAdvanced: false
property bool showPower: false
function run(cmd) {
Quickshell.execDetached(cmd);
}
function refreshDisplayModes() {
displayDetect.running = true;
}
function applyResolution(mode) {
shell.run(["sh", "-c",
"out=$(wlr-randr 2>/dev/null | awk '/^[A-Za-z0-9-]+ / {print $1; exit}'); " +
"if [ -n \"$out\" ]; then wlr-randr --output \"$out\" --mode " + mode + "; fi"]);
shell.currentResolution = mode;
displayDetectTimer.start();
}
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;
}
}
}
}
Process {
id: displayDetect
command: ["sh", "-c", "out=$(wlr-randr 2>/dev/null | awk '/^[A-Za-z0-9-]+ / {print $1; exit}'); [ -n \"$out\" ] && wlr-randr --output \"$out\" 2>/dev/null | awk '/current/ {print $1; exit}'"]
stdout: SplitParser {
onRead: line => {
const trimmed = ("" + line).trim();
if (trimmed.length > 0)
shell.currentResolution = trimmed;
}
}
}
Timer {
id: displayDetectTimer
interval: 600
repeat: false
onTriggered: displayDetect.running = true
}
// 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();
displayDetect.running = true;
}
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
}
Flickable {
id: flick
anchors.fill: parent
contentWidth: width
contentHeight: page.implicitHeight + (page.compactView ? 24 : (Theme.padLarge * 2))
clip: true
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {
active: true
policy: flick.contentHeight > flick.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
}
Column {
id: page
property bool compactView: flick.width < 760 || flick.height < 600
width: flick.width - (compactView ? 24 : (Theme.padLarge * 2)) - (flick.contentHeight > flick.height ? 14 : 0)
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: compactView ? 12 : Theme.padLarge
spacing: compactView ? 12 : 18
// -- header ----------------------------------------------------
Item {
width: parent.width
height: page.compactView ? 44 : 56
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: page.compactView ? 10 : 14
PhoebusEmblem {
width: page.compactView ? 40 : 56
height: page.compactView ? 40 : 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: page.compactView ? 20 : 26
font.weight: Font.DemiBold
font.letterSpacing: page.compactView ? 2 : 3
}
Text {
text: "A modern, encrypted, AI-first workstation"
color: Theme.muted
font.family: Theme.family
font.pixelSize: page.compactView ? (Theme.fontSmall - 1) : Theme.fontSmall
visible: !page.compactView || parent.width > 520
}
}
}
Rectangle {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
height: page.compactView ? 26 : 30
width: versionText.implicitWidth + 24
radius: height / 2
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: page.compactView ? 14 : Theme.padLarge
spacing: page.compactView ? 10 : 14
Text {
width: parent.width
text: "Welcome to Phoebus OS"
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: page.compactView ? Theme.fontTitle : 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
}
Item {
id: heroActions
width: parent.width
property bool isNarrow: parent.width < 760
implicitHeight: isNarrow ? (installButton.height + 14 + chipsCol.implicitHeight)
: Math.max(installButton.height, chipsCol.implicitHeight)
height: implicitHeight
PhoebusButton {
id: installButton
label: "Install Phoebus OS"
primary: true
height: page.compactView ? 48 : 58
implicitHeight: height
width: heroActions.isNarrow ? parent.width : 280
implicitWidth: width
anchors.left: parent.left
anchors.top: parent.top
focus: true
activeFocusOnTab: true
onClicked: {
shell.run(["/usr/local/bin/phoebus-install"]);
}
}
Column {
id: chipsCol
width: heroActions.isNarrow ? parent.width : (parent.width - installButton.width - 24)
anchors.left: heroActions.isNarrow ? parent.left : installButton.right
anchors.leftMargin: heroActions.isNarrow ? 0 : 24
anchors.top: heroActions.isNarrow ? installButton.bottom : parent.top
anchors.topMargin: heroActions.isNarrow ? 14 : 0
spacing: 8
Flow {
width: parent.width
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 confirm installation. 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: page.compactView ? 8 : 12
PhoebusButton {
label: "Network"
compact: page.compactView
onClicked: shell.run(["dms", "ipc", "call", "settings", "openWith", "network_status"])
}
PhoebusButton {
label: "Display resolution"
compact: page.compactView
onClicked: {
shell.refreshDisplayModes();
shell.showDisplay = true;
}
}
PhoebusButton {
label: "Text & motion"
compact: page.compactView
onClicked: shell.run(["dms", "ipc", "call", "settings", "openWith", "typography"])
}
PhoebusButton {
label: "Phoebus Help"
compact: page.compactView
onClicked: shell.run(["/usr/local/bin/phoebus-help"])
}
PhoebusButton {
label: "Installation help"
compact: page.compactView
onClicked: shell.run(["kitty", "-e", "sh", "-c",
"cat /usr/share/phoebus/install-help.txt; printf '\\nPress Enter to close'; read -r _"])
}
PhoebusButton {
label: "DMS Welcome"
compact: page.compactView
onClicked: shell.run(["dms", "ipc", "call", "welcome", "open"])
}
PhoebusButton {
label: "Power"
compact: page.compactView
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; printf '\\nPress Enter to close'; read -r _"])
}
PhoebusButton {
label: "Installer log"
compact: true
onClicked: shell.run(["kitty", "-e", "sh", "-c", "if [ -s /var/log/phoebus-installer/install.log ]; then less /var/log/phoebus-installer/install.log; else printf 'No installer log yet. Start the installer to create it.\\n'; fi; printf '\\nPress Enter to close'; read -r _"])
}
PhoebusButton {
label: "Disk information"
compact: true
onClicked: shell.run(["kitty", "-e", "sh", "-c", "lsblk -o NAME,SIZE,MODEL,TYPE,MOUNTPOINTS; printf '\\nPress Enter to close'; read -r _"])
}
PhoebusButton {
label: "Network settings"
compact: true
onClicked: shell.run(["dms", "ipc", "call", "settings", "openWith", "network_status"])
}
}
}
Item { width: 1; height: 1 }
}
}
// -- display resolution overlay ------------------------------------
Rectangle {
anchors.fill: parent
color: Theme.overlay
visible: shell.showDisplay
MouseArea { anchors.fill: parent; onClicked: shell.showDisplay = false }
PhoebusCard {
anchors.centerIn: parent
width: Math.min(parent.width - 32, 540)
padding: Theme.padLarge
spacing: 14
Text {
width: parent.width
text: "Display Resolution"
color: Theme.warmWhite
font.family: Theme.family
font.pixelSize: Theme.fontTitle
font.weight: Font.DemiBold
}
Text {
width: parent.width
text: "Choose a screen resolution to match your monitor or VM window size. The change applies immediately."
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontBody
wrapMode: Text.WordWrap
}
Row {
spacing: 8
Text {
text: "Current mode:"
color: Theme.muted
font.family: Theme.family
font.pixelSize: Theme.fontSmall
anchors.verticalCenter: parent.verticalCenter
}
PhoebusChip {
text: shell.currentResolution.length > 0 ? shell.currentResolution : "Detecting…"
tone: Theme.amber
}
}
Flow {
width: parent.width
spacing: 10
Repeater {
model: [
{ label: "1920 × 1080 (Full HD)", mode: "1920x1080" },
{ label: "1440 × 900 (Widescreen)", mode: "1440x900" },
{ label: "1280 × 768 (Standard)", mode: "1280x768" },
{ label: "1024 × 768 (4:3)", mode: "1024x768" },
{ label: "800 × 600 (Compact)", mode: "800x600" }
]
delegate: PhoebusButton {
required property var modelData
label: modelData.label
compact: true
primary: shell.currentResolution.indexOf(modelData.mode) >= 0
onClicked: {
shell.applyResolution(modelData.mode);
}
}
}
}
Item { width: 1; height: 4 }
Row {
width: parent.width
spacing: 12
PhoebusButton {
label: "DMS Desktop Settings"
compact: true
onClicked: {
shell.showDisplay = false;
shell.run(["dms", "ipc", "call", "settings", "openWith", "display_config"]);
}
}
PhoebusButton {
label: "Close"
primary: true
compact: true
onClicked: shell.showDisplay = false
}
}
}
}
// -- 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
}
}
}
}
}