update module
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Modules
|
||||
|
||||
Singleton {
|
||||
property int availableUpdates: 0
|
||||
|
||||
Timer {
|
||||
interval: 1
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
console.log("Checking for updates...")
|
||||
updatesProc.running = true
|
||||
interval = 60000
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: updatesProc
|
||||
running: false
|
||||
|
||||
command: ["checkupdates"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const output = this.text
|
||||
const lines = output.trim().split("\n")
|
||||
console.log("Available updates:", lines)
|
||||
availableUpdates = lines.length
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Modules
|
||||
|
||||
Item {
|
||||
id: root
|
||||
required property int countUpdates
|
||||
implicitWidth: 60
|
||||
implicitHeight: 22
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: height / 2
|
||||
color: "#40000000"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: 5
|
||||
rightMargin: 5
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||
font.family: "Material Symbols Rounded"
|
||||
font.pixelSize: 18
|
||||
text: "\uf569"
|
||||
color: "#ffffff"
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||
implicitWidth: 18
|
||||
implicitHeight: root.implicitHeight
|
||||
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: root.countUpdates
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user