Files
linux-dotfiles/quickshell/services/FortuneService.qml
2026-04-02 22:54:57 +02:00

33 lines
672 B
QML

import QtQuick
import Quickshell.Io
Item {
id: fortuneService
property string fortuneText: "Loading..."
Process {
id: fortuneProcess
command: ["fortune", "-s", "-a"]
stdout: StdioCollector {
onStreamFinished: {
fortuneService.fortuneText = this.text.trim();
}
}
}
Component.onCompleted: {
fortuneProcess.running = true;
}
Timer {
interval: 60000 // update fortune every minute
repeat: true
running: true
onTriggered: {
fortuneProcess.running = true; // run the process again to get a new fortune
}
}
}