126 lines
3.7 KiB
QML
126 lines
3.7 KiB
QML
// --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
ShellRoot {
|
|
QtObject {
|
|
id: colors
|
|
readonly property color base: "#1e1e2e"
|
|
readonly property color surface0: "#313244"
|
|
readonly property color surface1: "#45475a"
|
|
readonly property color text: "#cdd6f4"
|
|
readonly property color subtext0: "#a6adc8"
|
|
readonly property color green: "#a6e3a1"
|
|
readonly property color blue: "#89b4fa"
|
|
readonly property color red: "#f38ba8"
|
|
readonly property color yellow: "#f9e2af"
|
|
}
|
|
|
|
property int currentStep: 0
|
|
property bool isRunning: false
|
|
property bool isFailed: false
|
|
property string currentLog: ""
|
|
property bool started: false
|
|
property string sudoPassword: ""
|
|
|
|
readonly property int rebuildStep: 5
|
|
|
|
readonly property var steps: [
|
|
{ label: "Updating flake.lock", cmd: ["nix", "flake", "update"], cwd: "/home/henrov/Repos/nixos/Droidnix" },
|
|
{ label: "Updating Flatpaks", cmd: ["flatpak", "update", "-y"], cwd: "/home/henrov" },
|
|
{ label: "Staging changes", cmd: ["git", "add", "."], cwd: "/home/henrov/Repos/nixos/Droidnix" },
|
|
{ label: "Committing changes", cmd: ["git", "commit", "-m", "Updated system"], cwd: "/home/henrov/Repos/nixos/Droidnix" },
|
|
{ label: "Pushing to remote", cmd: ["git", "push"], cwd: "/home/henrov/Repos/nixos/Droidnix" },
|
|
|
|
{
|
|
label: "Rebuilding NixOS",
|
|
cmd: [
|
|
"sh",
|
|
"-c",
|
|
`echo "${sudoPassword}" | sudo -S nixos-rebuild switch --flake .#traveldroid`
|
|
],
|
|
cwd: "/home/henrov/Repos/nixos/Droidnix"
|
|
},
|
|
|
|
{ label: "Reloading Hyprland", cmd: ["hyprctl", "reload"], cwd: "/home/henrov" },
|
|
]
|
|
|
|
function runStep(index) {
|
|
if (index >= steps.length) {
|
|
isRunning = false
|
|
currentStep = steps.length
|
|
return
|
|
}
|
|
currentStep = index
|
|
currentLog = ""
|
|
isRunning = true
|
|
|
|
stepProc.command = steps[index].cmd
|
|
stepProc.workingDirectory = steps[index].cwd
|
|
stepProc.running = true
|
|
}
|
|
|
|
Process {
|
|
id: stepProc
|
|
|
|
stdout: SplitParser {
|
|
onRead: (line) => {
|
|
currentLog = (currentLog + "\n" + line).split("\n").slice(-8).join("\n").trim()
|
|
}
|
|
}
|
|
|
|
stderr: SplitParser {
|
|
onRead: (line) => {
|
|
if (line.trim() !== "")
|
|
currentLog = (currentLog + "\n" + line).split("\n").slice(-8).join("\n").trim()
|
|
}
|
|
}
|
|
|
|
onExited: (code) => {
|
|
if (code !== 0 && currentStep !== 3) {
|
|
isFailed = true
|
|
isRunning = false
|
|
} else {
|
|
runStep(currentStep + 1)
|
|
}
|
|
}
|
|
}
|
|
|
|
FloatingWindow {
|
|
title: "quickshell-updater"
|
|
visible: true
|
|
width: 640
|
|
|
|
height: (contentCol.implicitHeight + 48) * 1.1
|
|
|
|
color: "transparent"
|
|
|
|
Shortcut {
|
|
sequence: "Escape"
|
|
onActivated: Qt.quit()
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
radius: 16
|
|
color: colors.base
|
|
|
|
ColumnLayout {
|
|
id: contentCol
|
|
anchors {
|
|
top: parent.top
|
|
left: parent.left
|
|
right: parent.right
|
|
margins: 20
|
|
}
|
|
spacing: 12
|
|
|
|
// ... unchanged UI omitted for brevity ...
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|