From 37244dc0f776579fec7b29abb69f3f1e721d7457 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 5 Nov 2025 00:44:22 +0100 Subject: [PATCH] background: add weather widget Co-Authored-By: Vague Syntax <173799252+vaguesyntax@users.noreply.github.com> --- .../ii/modules/background/Background.qml | 12 ++++ .../widgets/weather/WeatherWidget.qml | 58 +++++++++++++++++++ .../quickshell/ii/modules/common/Config.qml | 7 ++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 dots/.config/quickshell/ii/modules/background/widgets/weather/WeatherWidget.qml diff --git a/dots/.config/quickshell/ii/modules/background/Background.qml b/dots/.config/quickshell/ii/modules/background/Background.qml index 583c085ea..7057da1cd 100644 --- a/dots/.config/quickshell/ii/modules/background/Background.qml +++ b/dots/.config/quickshell/ii/modules/background/Background.qml @@ -16,6 +16,7 @@ import Quickshell.Hyprland import qs.modules.background.widgets import qs.modules.background.widgets.clock +import qs.modules.background.widgets.weather Variants { id: root @@ -267,6 +268,17 @@ Variants { } } + FadeLoader { + shown: Config.options.background.widgets.weather.enable + sourceComponent: WeatherWidget { + screenWidth: bgRoot.screen.width + screenHeight: bgRoot.screen.height + scaledScreenWidth: bgRoot.screen.width / bgRoot.effectiveWallpaperScale + scaledScreenHeight: bgRoot.screen.height / bgRoot.effectiveWallpaperScale + wallpaperScale: bgRoot.effectiveWallpaperScale + } + } + FadeLoader { shown: Config.options.background.widgets.clock.enable sourceComponent: ClockWidget { diff --git a/dots/.config/quickshell/ii/modules/background/widgets/weather/WeatherWidget.qml b/dots/.config/quickshell/ii/modules/background/widgets/weather/WeatherWidget.qml new file mode 100644 index 000000000..8e055b542 --- /dev/null +++ b/dots/.config/quickshell/ii/modules/background/widgets/weather/WeatherWidget.qml @@ -0,0 +1,58 @@ +import QtQuick +import qs +import qs.services +import qs.modules.common +import qs.modules.common.functions +import qs.modules.common.widgets +import qs.modules.common.widgets.widgetCanvas +import qs.modules.background.widgets + +AbstractBackgroundWidget { + id: root + + configEntryName: "weather" + + implicitHeight: backgroundShape.implicitHeight + implicitWidth: backgroundShape.implicitWidth + + StyledDropShadow { + target: backgroundShape + } + + MaterialShape { + id: backgroundShape + anchors.fill: parent + shape: MaterialShape.Shape.Pill + color: Appearance.colors.colPrimaryContainer + implicitSize: 230 + + StyledText { + font { + pixelSize: 84 + family: Appearance.font.family.expressive + weight: Font.Medium + } + color: Appearance.colors.colPrimary + text: Weather.data?.temp.substring(0,Weather.data?.temp.length - 1) ?? "--°" + anchors { + right: parent.right + top: parent.top + rightMargin: 26 + topMargin: 30 + } + } + + MaterialSymbol { + iconSize: 84 + color: Appearance.colors.colOnPrimaryContainer + text: Icons.getWeatherIcon(Weather.data.wCode) ?? "cloud" + anchors { + left: parent.left + bottom: parent.bottom + + leftMargin: 26 + bottomMargin: 30 + } + } + } +} diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index 11ab5d571..c457f674d 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -169,7 +169,12 @@ Singleton { property JsonObject digital: JsonObject { property bool animateChange: true } - + } + property JsonObject weather: JsonObject { + property bool enable: false + property string placementStrategy: "free" // "free", "leastBusy", "mostBusy" + property real x: 400 + property real y: 100 } } property string wallpaperPath: ""