Regenerated
This commit is contained in:
+258
-61
@@ -3666,53 +3666,277 @@ ShellRoot {
|
||||
** =generated/.config/quickshell/updater/shell.qml=
|
||||
Updates the system
|
||||
#+BEGIN_SRC qml :tangle generated/.config/quickshell/updater/shell.qml :noweb yes :mkdirp yes :eval never
|
||||
// --- 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.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Window {
|
||||
width: 500
|
||||
height: 200
|
||||
visible: true
|
||||
title: "System Updater"
|
||||
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"
|
||||
readonly property color peach: "#fab387"
|
||||
}
|
||||
|
||||
property int progress: 0
|
||||
property string status: "Waiting..."
|
||||
QtObject {
|
||||
id: state
|
||||
property int step: 0
|
||||
property bool running: false
|
||||
property bool failed: false
|
||||
property string log: ""
|
||||
|
||||
Timer {
|
||||
interval: 300
|
||||
running: true
|
||||
repeat: true
|
||||
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: ["sudo", "nixos-rebuild", "switch", "--flake", ".#traveldroid"], cwd: "/home/henrov/Repos/nixos/Droidnix" },
|
||||
{ label: "Reloading Hyprland", cmd: ["hyprctl", "reload"], cwd: "/home/henrov" },
|
||||
]
|
||||
}
|
||||
|
||||
onTriggered: {
|
||||
let file = "/tmp/nixos-updater-status"
|
||||
function runStep(index) {
|
||||
if (index >= state.steps.length) {
|
||||
state.running = false
|
||||
state.step = state.steps.length
|
||||
return
|
||||
}
|
||||
state.step = index
|
||||
state.running = true
|
||||
stepProc.command = state.steps[index].cmd
|
||||
stepProc.workingDirectory = state.steps[index].cwd
|
||||
stepProc.running = true
|
||||
}
|
||||
|
||||
let xhr = new XMLHttpRequest()
|
||||
xhr.open("GET", "file://" + file)
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
let parts = xhr.responseText.trim().split("|")
|
||||
Process {
|
||||
id: stepProc
|
||||
|
||||
if (parts.length === 2) {
|
||||
progress = parseInt(parts[0])
|
||||
status = parts[1]
|
||||
}
|
||||
}
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
state.log = text.split("\n").slice(-6).join("\n")
|
||||
}
|
||||
}
|
||||
|
||||
stderr: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (text.trim() !== "")
|
||||
state.log = text.split("\n").slice(-6).join("\n")
|
||||
}
|
||||
}
|
||||
|
||||
onExited: (code) => {
|
||||
if (code !== 0 && state.step !== 3) {
|
||||
// step 3 is git commit — may exit 1 if nothing to commit, that's fine
|
||||
state.failed = true
|
||||
state.running = false
|
||||
} else {
|
||||
runStep(state.step + 1)
|
||||
}
|
||||
xhr.send()
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: 10
|
||||
FloatingWindow {
|
||||
id: root
|
||||
title: "quickshell-updater"
|
||||
visible: true
|
||||
width: 520
|
||||
height: contentCol.implicitHeight + 32
|
||||
color: "transparent"
|
||||
|
||||
Text { text: status }
|
||||
Shortcut {
|
||||
sequence: "Escape"
|
||||
onActivated: Qt.quit()
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
from: 0
|
||||
to: 100
|
||||
value: progress
|
||||
width: 300
|
||||
// Gradient border
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -2
|
||||
radius: 18
|
||||
z: -1
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop { position: 0.0; color: colors.blue }
|
||||
GradientStop { position: 1.0; color: colors.green }
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
// Title
|
||||
Text {
|
||||
text: " System Update"
|
||||
color: colors.text
|
||||
font.pixelSize: 15
|
||||
font.bold: true
|
||||
Layout.topMargin: 4
|
||||
}
|
||||
|
||||
// Steps list
|
||||
Repeater {
|
||||
model: state.steps.length
|
||||
|
||||
delegate: RowLayout {
|
||||
spacing: 10
|
||||
Layout.fillWidth: true
|
||||
|
||||
// Icon
|
||||
Text {
|
||||
font.pixelSize: 14
|
||||
text: {
|
||||
if (state.failed && index === state.step) return "✗"
|
||||
if (index < state.step || (!state.running && index === state.step)) return "✓"
|
||||
if (index === state.step && state.running) return "…"
|
||||
return "○"
|
||||
}
|
||||
color: {
|
||||
if (state.failed && index === state.step) return colors.red
|
||||
if (index < state.step || (!state.running && !state.failed && index === state.step)) return colors.green
|
||||
if (index === state.step && state.running) return colors.yellow
|
||||
return colors.surface1
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: state.steps[index].label
|
||||
font.pixelSize: 13
|
||||
color: {
|
||||
if (state.failed && index === state.step) return colors.red
|
||||
if (index < state.step) return colors.subtext0
|
||||
if (index === state.step) return colors.text
|
||||
return colors.surface1
|
||||
}
|
||||
}
|
||||
|
||||
// Spinner for active step
|
||||
Text {
|
||||
visible: index === state.step && state.running
|
||||
text: "⠋"
|
||||
color: colors.blue
|
||||
font.pixelSize: 13
|
||||
|
||||
RotationAnimation on rotation {
|
||||
running: index === state.step && state.running
|
||||
from: 0; to: 360
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Log output
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
height: 80
|
||||
radius: 8
|
||||
color: colors.surface0
|
||||
visible: state.log !== ""
|
||||
|
||||
Text {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 8
|
||||
}
|
||||
text: state.log
|
||||
color: colors.subtext0
|
||||
font.pixelSize: 11
|
||||
font.family: "monospace"
|
||||
wrapMode: Text.WrapAnywhere
|
||||
elide: Text.ElideLeft
|
||||
verticalAlignment: Text.AlignBottom
|
||||
}
|
||||
}
|
||||
|
||||
// Status / close
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: 4
|
||||
|
||||
Text {
|
||||
text: {
|
||||
if (state.failed) return "✗ Failed at: " + state.steps[state.step].label
|
||||
if (state.step === state.steps.length) return "✓ Done!"
|
||||
if (state.running) return "Running…"
|
||||
return "Press Start"
|
||||
}
|
||||
color: {
|
||||
if (state.failed) return colors.red
|
||||
if (state.step === state.steps.length) return colors.green
|
||||
return colors.subtext0
|
||||
}
|
||||
font.pixelSize: 12
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
// Start button
|
||||
Rectangle {
|
||||
visible: !state.running && state.step === 0
|
||||
width: 80; height: 28
|
||||
radius: 14
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop { position: 0.0; color: colors.blue }
|
||||
GradientStop { position: 1.0; color: colors.green }
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Start"
|
||||
color: colors.base
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: runStep(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Close button
|
||||
Rectangle {
|
||||
visible: !state.running && state.step > 0
|
||||
width: 80; height: 28
|
||||
radius: 14
|
||||
color: colors.surface1
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Close"
|
||||
color: colors.text
|
||||
font.pixelSize: 12
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: Qt.quit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4038,33 +4262,6 @@ main() {
|
||||
main
|
||||
#+END_SRC
|
||||
|
||||
** =generated/.config/scripts/update-engine.sh=
|
||||
A file containing color variables
|
||||
#+BEGIN_SRC sh :tangle generated/.config/scripts/update-engine.sh :shebang "#!/usr/bin/env bash" :noweb yes :mkdirp yes :eval never
|
||||
|
||||
STATUS_FILE="/tmp/nixos-updater-status"
|
||||
|
||||
echo "0|Starting" > "$STATUS_FILE"
|
||||
|
||||
update_step() {
|
||||
echo "$1|$2" > "$STATUS_FILE"
|
||||
}
|
||||
|
||||
update_step 10 "Fixing ownership"
|
||||
sudo chown -R "$USER":"wheel" "$REPO"
|
||||
|
||||
update_step 30 "Updating flake"
|
||||
nix flake update
|
||||
|
||||
update_step 60 "Rebuilding system"
|
||||
sudo nixos-rebuild switch --flake ".#$HOSTNAME"
|
||||
|
||||
update_step 90 "Updating Flatpaks"
|
||||
flatpak update -y
|
||||
|
||||
update_step 100 "Done"
|
||||
#+END_SRC
|
||||
|
||||
** =generated/.config/wofi/scripts/wofi-launcher.sh=
|
||||
Providing an media
|
||||
#+BEGIN_SRC sh :tangle generated/.config/wofi/scripts/wofi-launcher.sh :shebang "#!/usr/bin/env bash" :noweb yes :mkdirp yes :eval never
|
||||
|
||||
Reference in New Issue
Block a user