add WeatherService, WeatherApplet with hover panel and lock screen widget
This commit is contained in:
parent
6f385130ff
commit
9285365732
8 changed files with 150 additions and 26 deletions
|
|
@ -98,7 +98,8 @@ QtObject {
|
|||
screenshot: true,
|
||||
notifications: true,
|
||||
mpris: true,
|
||||
volume: true
|
||||
volume: true,
|
||||
weather: true
|
||||
})
|
||||
property var statsDaemon: ({
|
||||
interval: -1
|
||||
|
|
|
|||
42
shell/services/WeatherService.qml
Normal file
42
shell/services/WeatherService.qml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import "." as S
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property string icon: ""
|
||||
property string tooltip: ""
|
||||
readonly property bool available: icon !== ""
|
||||
|
||||
property Process _proc: Process {
|
||||
running: S.Modules.weather.enable
|
||||
command: ["wttrbar"].concat(S.Modules.weather.args)
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
try {
|
||||
const data = JSON.parse(text);
|
||||
root.icon = data.text ?? "";
|
||||
root.tooltip = data.tooltip ?? "";
|
||||
} catch (e) {
|
||||
root.icon = "";
|
||||
root.tooltip = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Timer _poll: Timer {
|
||||
interval: S.Modules.weather.interval || 3600000
|
||||
running: S.Modules.weather.enable
|
||||
repeat: true
|
||||
onTriggered: root._proc.running = true
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
_proc.running = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,4 +15,5 @@ singleton PowerProfileService 1.0 PowerProfileService.qml
|
|||
singleton ScreenshotService 1.0 ScreenshotService.qml
|
||||
singleton SystemStats 1.0 SystemStats.qml
|
||||
singleton Theme 1.0 Theme.qml
|
||||
singleton WeatherService 1.0 WeatherService.qml
|
||||
# keep-sorted end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue