mirror of
https://github.com/theupriser/steamify-cachyos-live-iso.git
synced 2026-10-02 15:10:26 +02:00
feat: Steamify installer page in progress (CachyOS look, rows from steamify.sh --defaults --list, after the packages page); TODO
This commit is contained in:
1 parent
78e7c869b9
commit
754a6a14da
10 files changed
+274
-99
No files matched your search
@@ -45,10 +45,11 @@ main() {
|
||||
EOF
|
||||
|
||||
sudo cp "/usr/share/calamares/settings_${mode}.conf" /etc/calamares/settings.conf
|
||||
# Steamify: its step (modules/shellprocess_steamify.conf) before the
|
||||
# installer cleans up after itself.
|
||||
sudo sed -i -e 's/^- id: cleanup_calamares$/- id: steamifyskip\n module: packagechooser\n config: packagechooser_steamifyskip.conf\n\n- id: steamifyboot\n module: packagechooser\n config: packagechooser_steamifyboot.conf\n\n- id: steamify\n module: shellprocess\n config: shellprocess_steamify.conf\n\n&/' \
|
||||
-e 's/^ - packagechooser@desktop$/&\n - packagechooser@steamifyskip\n - packagechooser@steamifyboot/' \
|
||||
# Steamify: its page (packagechooserq@steamifypage, right after the
|
||||
# packages page) and its step (modules/shellprocess_steamify.conf) before
|
||||
# the installer cleans up after itself.
|
||||
sudo sed -i -e 's/^- id: cleanup_calamares$/- id: steamifypage\n module: packagechooserq\n config: packagechooserq_steamifypage.conf\n\n- id: steamify\n module: shellprocess\n config: shellprocess_steamify.conf\n\n&/' \
|
||||
-e 's/^ - netinstall$/&\n - packagechooserq@steamifypage/' \
|
||||
-e 's/^ - shellprocess@cleanup_calamares$/ - shellprocess@steamify\n&/' /etc/calamares/settings.conf
|
||||
exec pkexec-wrapper calamares -D6 >> $log
|
||||
}
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
#!/bin/bash
|
||||
# steamify-install <target root> <user> [<skip ids>] [gamescope|desktop]:
|
||||
# runs Steamify's default setup (minus what the installer's Steam Machine
|
||||
# page leaves out, where the boot page says) for
|
||||
# steamify-install <target root> <user> <choice>: runs Steamify's setup for
|
||||
# the new user inside the installed system (Calamares, after the users and
|
||||
# services steps). Steamify refuses root and asks sudo per command, so the
|
||||
# services steps), as chosen on the installer's Steamify page: <choice> is the
|
||||
# ids that are on, comma-separated, plus "boot" for Boot into Desktop, or
|
||||
# "none" (packagechooser_steamifypage). Steamify refuses root and asks sudo
|
||||
# per command, so the
|
||||
# user gets a NOPASSWD rule for this run only, named to be read last: sudo
|
||||
# takes the last matching rule, and a later %wheel rule would ask again. Never fails the install: a
|
||||
# problem leaves the log and Steamify can be run again from the desktop.
|
||||
root="$1" user="$2"
|
||||
# The pages' ids, comma-separated; the "Everything" entry is an empty id.
|
||||
skip="$(tr ',' '\n' <<< "${3:-}" | grep -v '^$' | paste -sd, -)"
|
||||
boot="${4:-gamescope}"
|
||||
# Steamify 2.7.0 takes the items to turn on (--options), not the ones to
|
||||
# leave out: every item of the default setup minus the skipped ones (the
|
||||
# power-off fix goes with Steam Machine support). Until the Steamify page
|
||||
# passes the "on" list itself.
|
||||
options=""
|
||||
for id in gaming theme glyphs single launcher notify vram cec machine poweroff; do
|
||||
[[ ",$skip," == *",$id,"* ]] && continue
|
||||
[[ "$id" == poweroff && ",$skip," == *",machine,"* ]] && continue
|
||||
options+="${options:+,}$id"
|
||||
root="$1" user="$2" choice="${3:-}"
|
||||
# Not filled in by Calamares (empty, or the literal ${gs[...]}): the page's
|
||||
# default, everything on.
|
||||
[[ -z "$choice" || "$choice" == *'${'* ]] && choice=gaming,theme,glyphs,single,launcher,notify,vram,cec,machine,poweroff
|
||||
boot=gamescope options=""
|
||||
for id in ${choice//,/ }; do
|
||||
case "$id" in
|
||||
boot) boot=desktop ;;
|
||||
none) ;;
|
||||
*) options+="${options:+,}$id" ;;
|
||||
esac
|
||||
done
|
||||
log="$root/var/log/steamify-install.log"
|
||||
rule="$root/etc/sudoers.d/zz-steamify-install"
|
||||
[[ -d "$root" && -n "$user" ]] || exit 0
|
||||
# Everything switched off on the page: nothing to set up.
|
||||
[[ -n "$options" ]] || { echo "Nothing chosen on the Steamify page." > "$log"; exit 0; }
|
||||
|
||||
install -Dm755 /usr/local/share/steamify/steamify.sh "$root/var/tmp/steamify.sh"
|
||||
printf '%s ALL=(ALL) NOPASSWD: ALL\n' "$user" > "$rule"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// The Steamify page's rows when `steamify.sh --defaults --list` can't be run
|
||||
// (see calamares-online.sh, which writes the real list over this copy in
|
||||
// /usr/local/share/steamify/qml at the start of the installer).
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
readonly property var rows: [
|
||||
{ id: "gaming", label: "SteamOS conversion", hint: "boot into gaming mode, Steam on the desktop", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "boot", label: "Boot into", hint: "", kind: "choice", parent: "gaming", on: false, selectable: true },
|
||||
{ id: "theme", label: "Install SteamOS theme", hint: "Vapor look (cachyos-vapor)", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "glyphs", label: "Install Steam Deck/Machine icons", hint: "Deck button icons in gaming mode", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "single", label: "Single user mode", hint: "no password, lock screen or log out (SDDM)", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "launcher", label: "Steamify shortcut", hint: "the app on the desktop, Steamify Terminal in the launcher", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "notify", label: "Update notifications", hint: "a notification when there's a new Steamify", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "cec", label: "HDMI-CEC", hint: "use Steam with the TV remote, TV on/off with the PC", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "machine", label: "Steam Machine support", hint: "LED bar driver, hardware settings in Steam", kind: "toggle", parent: "", on: true, selectable: true },
|
||||
{ id: "poweroff", label: "Power-off fix", hint: "the Steam Machine stays off after shutting down", kind: "toggle", parent: "machine", on: true, selectable: true }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Steamify's page in Calamares (packagechooserq@steamifypage, method legacy),
|
||||
// styled like the rest of CachyOS's installer: its palette, standard
|
||||
// controls, CachyOS's turquoise for the selected row. Left the options,
|
||||
// right what the selected (or hovered) one does.
|
||||
// The rows come from Steamify itself: calamares-online.sh writes
|
||||
// ../steamify/qml/Items.qml from `steamify.sh --defaults --list` (the newest
|
||||
// Steamify, else the ISO's), so new options show up without a new ISO; the
|
||||
// explanations are the app's (Texts.qml, same folder).
|
||||
// The choice goes to Calamares' global storage as packagechooser_steamifypage:
|
||||
// the ids that are on, comma-separated, plus "boot" for Boot into Desktop
|
||||
// ("none" when nothing is on); steamify-install passes it to
|
||||
// `steamify.sh --defaults --options ... --boot ...`.
|
||||
import io.calamares.core 1.0
|
||||
import io.calamares.ui 1.0
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../steamify/qml"
|
||||
|
||||
Item {
|
||||
id: page
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
SystemPalette { id: pal; colorGroup: SystemPalette.Active }
|
||||
readonly property color accent: "#00CED1"
|
||||
|
||||
// Only what can be set up here (Steamify leaves out the rest).
|
||||
readonly property var rows: Items.rows.filter(function (r) { return r.selectable; })
|
||||
property var want: ({})
|
||||
property string boot: "gamescope"
|
||||
property int sel: 0
|
||||
|
||||
function label(r) { return (Texts.items[r.id] || {}).label || r.label; }
|
||||
function hint(r) { return (Texts.items[r.id] || {}).hint || r.hint; }
|
||||
function shown(r) { return !r.parent || !!want[r.parent]; }
|
||||
|
||||
// Steamify's own rules: a sub-option needs its parent (turning a parent
|
||||
// off turns its sub-options off); single user mode needs the conversion.
|
||||
function toggle(id) {
|
||||
var w = Object.assign({}, want);
|
||||
w[id] = !w[id];
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var r = rows[i];
|
||||
if (w[id] && r.id === id && r.parent) w[r.parent] = true;
|
||||
if (!w[id] && r.parent === id && r.kind === "toggle") w[r.id] = false;
|
||||
if (w[id] && r.parent === id && r.kind === "toggle") w[r.id] = true; // opt-out sub-options
|
||||
}
|
||||
if (id === "single" && w.single) w.gaming = true;
|
||||
if (id === "gaming" && !w.gaming) { w.single = false; boot = "gamescope"; }
|
||||
want = w;
|
||||
}
|
||||
|
||||
function choice() {
|
||||
var on = [];
|
||||
for (var i = 0; i < rows.length; i++)
|
||||
if (rows[i].kind === "toggle" && want[rows[i].id]) on.push(rows[i].id);
|
||||
if (want.gaming && boot === "desktop") on.push("boot");
|
||||
return on.length ? on.join(",") : "none";
|
||||
}
|
||||
onWantChanged: config.packageChoice = choice()
|
||||
onBootChanged: config.packageChoice = choice()
|
||||
Component.onCompleted: {
|
||||
// Preselected like Steamify's first run.
|
||||
var w = {};
|
||||
for (var i = 0; i < rows.length; i++) if (rows[i].kind === "toggle") w[rows[i].id] = rows[i].on;
|
||||
want = w;
|
||||
config.packageChoice = choice();
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
spacing: 12
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: "Steamify sets up the SteamOS experience while CachyOS installs. Everything can be changed later with the Steamify app."
|
||||
wrapMode: Text.WordWrap
|
||||
color: pal.windowText
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 16
|
||||
|
||||
ListView {
|
||||
id: list
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: parent.width * 0.55
|
||||
clip: true
|
||||
spacing: 4
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
model: page.rows
|
||||
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
||||
delegate: Rectangle {
|
||||
id: row
|
||||
required property var modelData
|
||||
required property int index
|
||||
readonly property var it: modelData
|
||||
readonly property bool vis: page.shown(it)
|
||||
readonly property bool selected: vis && index === page.sel
|
||||
width: list.width - 12
|
||||
height: vis ? 52 : 0
|
||||
visible: vis
|
||||
radius: 4
|
||||
color: selected ? Qt.rgba(page.accent.r, page.accent.g, page.accent.b, 0.18) : pal.base
|
||||
border.width: 1
|
||||
border.color: selected ? page.accent : Qt.rgba(pal.windowText.r, pal.windowText.g, pal.windowText.b, 0.15)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent; hoverEnabled: true
|
||||
// Hovering explains a row too, like selecting it.
|
||||
onEntered: page.sel = row.index
|
||||
onClicked: { page.sel = row.index; if (row.it.kind === "toggle") page.toggle(row.it.id); }
|
||||
}
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: row.it.parent ? 32 : 12
|
||||
anchors.rightMargin: 12
|
||||
spacing: 12
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
Label { Layout.fillWidth: true; text: page.label(row.it); font.bold: true; elide: Text.ElideRight; color: pal.text }
|
||||
Label { Layout.fillWidth: true; text: page.hint(row.it); elide: Text.ElideRight; color: pal.text; opacity: 0.7; font.pointSize: 8.5 }
|
||||
}
|
||||
Switch {
|
||||
visible: row.it.kind === "toggle"
|
||||
checked: !!page.want[row.it.id]
|
||||
onToggled: { page.sel = row.index; page.toggle(row.it.id); }
|
||||
}
|
||||
RowLayout {
|
||||
visible: row.it.kind === "choice"
|
||||
spacing: 4
|
||||
RadioButton { text: "Gaming mode"; checked: page.boot === "gamescope"
|
||||
onClicked: { page.sel = row.index; page.boot = "gamescope"; } }
|
||||
RadioButton { text: "Desktop"; checked: page.boot === "desktop"
|
||||
onClicked: { page.sel = row.index; page.boot = "desktop"; } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// What the selected (or hovered) option does.
|
||||
Rectangle {
|
||||
id: detail
|
||||
readonly property var it: page.rows[page.sel] || ({})
|
||||
readonly property var tx: Texts.items[it.id] || ({})
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
radius: 4
|
||||
color: pal.base
|
||||
border.width: 1
|
||||
border.color: Qt.rgba(pal.windowText.r, pal.windowText.g, pal.windowText.b, 0.15)
|
||||
onItChanged: flick.contentY = 0
|
||||
|
||||
Flickable {
|
||||
id: flick
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
clip: true
|
||||
contentHeight: col.implicitHeight
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
||||
ColumnLayout {
|
||||
id: col
|
||||
width: flick.width - 12
|
||||
spacing: 10
|
||||
Label { Layout.fillWidth: true; text: detail.it.id ? page.label(detail.it) : ""; font.bold: true; font.pointSize: 13
|
||||
wrapMode: Text.WordWrap; color: pal.text }
|
||||
Label { Layout.fillWidth: true; text: detail.tx.body || page.hint(detail.it) || ""; wrapMode: Text.WordWrap; color: pal.text }
|
||||
Label { visible: (detail.tx.changes || []).length > 0; text: "What it changes"; font.bold: true; color: pal.text; topPadding: 4 }
|
||||
Repeater {
|
||||
model: detail.tx.changes || []
|
||||
Label { required property string modelData; Layout.fillWidth: true; text: "• " + modelData
|
||||
wrapMode: Text.WordWrap; color: pal.text }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user