summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsubh <subh@example.com>2026-01-23 00:52:23 +0530
committersubh <subh@example.com>2026-01-23 00:52:23 +0530
commitcc3e2b53f812ec1d5b5a02a4c7ecffba509b996c (patch)
tree2101f2d3f97cdc324153f11d3a48b83b225c4d01
parentb55ceefd5b698d30c29f1e3cf5e052c506c2b30c (diff)
Added weather widget to quickshell
-rw-r--r--quickshell/shell.qml47
1 files changed, 45 insertions, 2 deletions
diff --git a/quickshell/shell.qml b/quickshell/shell.qml
index 1aa81e5..f9acfeb 100644
--- a/quickshell/shell.qml
+++ b/quickshell/shell.qml
@@ -30,7 +30,8 @@ ShellRoot {
property int volumeLevel: 0
property string activeWindow: "Window"
property string currentLayout: "Tile"
- property string cpuTemp: "0"
+ property string cpuTemp: "0°C"
+ property string weatherTemp: "0"
// CPU tracking
property var lastCpuIdle: 0
property var lastCpuTotal: 0
@@ -96,6 +97,24 @@ ShellRoot {
Component.onCompleted: running = true
}
+ // Weather
+
+ Process {
+ id: weatherProc
+ command: ["sh", "-c", "curl -s 'https://wttr.in/prayagraj?format=j1' | jq -r '.current_condition[].FeelsLikeC'"]
+
+ stdout: SplitParser {
+ onRead: data => {
+ if (!data) return
+ var temp = parseInt(data.trim()) || 0
+ weatherTemp = temp + "°C"
+ }
+ }
+
+ Component.onCompleted: running = true
+ }
+
+
// Disk usage
Process {
id: diskProc
@@ -182,6 +201,13 @@ ShellRoot {
}
}
+ Timer {
+ interval: 900000 // 15 minutes
+ running: true
+ repeat: true
+ onTriggered: weatherProc.running = true
+ }
+
// Event-based updates for window/layout (instant)
Connections {
target: Hyprland
@@ -326,6 +352,23 @@ ShellRoot {
}
Text {
+ text: "󰖐 " + weatherTemp
+ color: root.colRed
+ font.pixelSize: root.fontSize
+ font.family: root.fontFamily
+ font.bold: false
+ Layout.rightMargin: 8
+ }
+
+ Rectangle {
+ Layout.preferredWidth: 1
+ Layout.preferredHeight: 16
+ Layout.alignment: Qt.AlignVCenter
+ Layout.leftMargin: 0
+ Layout.rightMargin: 8
+ color: root.colMuted
+ }
+ Text {
text: " " + cpuTemp
color: root.colRed
font.pixelSize: root.fontSize
@@ -430,7 +473,7 @@ ShellRoot {
interval: 1000
running: true
repeat: true
- onTriggered: clockText.text = Qt.formatDateTime(new Date(), "ddd, MMM dd - HH:mm")
+ onTriggered: clockText.text = Qt.formatDateTime(new Date(), "ddd, MMM dd - HH:mm:ss")
}
}