From 3f44ecb0681800cf0b68da2aa17c8c28699c6b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Fri, 27 Jun 2025 12:30:25 +0300 Subject: [PATCH 01/22] feat(modules/bar): add weather bar --- .config/quickshell/constants/WeatherIcons.qml | 59 ++++++++ .config/quickshell/modules/bar/Bar.qml | 135 ++++++++++-------- .../modules/bar/weather/WeatherBar.qml | 68 +++++++++ .../modules/bar/weather/WeatherCard.qml | 45 ++++++ .../modules/bar/weather/WeatherPopup.qml | 95 ++++++++++++ .../modules/common/ConfigOptions.qml | 17 +++ .../quickshell/services/WeatherService.qml | 105 ++++++++++++++ 7 files changed, 462 insertions(+), 62 deletions(-) create mode 100644 .config/quickshell/constants/WeatherIcons.qml create mode 100644 .config/quickshell/modules/bar/weather/WeatherBar.qml create mode 100644 .config/quickshell/modules/bar/weather/WeatherCard.qml create mode 100644 .config/quickshell/modules/bar/weather/WeatherPopup.qml create mode 100644 .config/quickshell/services/WeatherService.qml diff --git a/.config/quickshell/constants/WeatherIcons.qml b/.config/quickshell/constants/WeatherIcons.qml new file mode 100644 index 000000000..bd74d4e17 --- /dev/null +++ b/.config/quickshell/constants/WeatherIcons.qml @@ -0,0 +1,59 @@ +pragma Singleton + +import Quickshell + +Singleton { + // credits: calestia + // this snippet is taken from + // https://github.com/caelestia-dots/shell + readonly property var codeToName: ({ + "113": "clear_day", + "116": "partly_cloudy_day", + "119": "cloud", + "122": "cloud", + "143": "foggy", + "176": "rainy", + "179": "rainy", + "182": "rainy", + "185": "rainy", + "200": "thunderstorm", + "227": "cloudy_snowing", + "230": "snowing_heavy", + "248": "foggy", + "260": "foggy", + "263": "rainy", + "266": "rainy", + "281": "rainy", + "284": "rainy", + "293": "rainy", + "296": "rainy", + "299": "rainy", + "302": "weather_hail", + "305": "rainy", + "308": "weather_hail", + "311": "rainy", + "314": "rainy", + "317": "rainy", + "320": "cloudy_snowing", + "323": "cloudy_snowing", + "326": "cloudy_snowing", + "329": "snowing_heavy", + "332": "snowing_heavy", + "335": "snowing", + "338": "snowing_heavy", + "350": "rainy", + "353": "rainy", + "356": "rainy", + "359": "weather_hail", + "362": "rainy", + "365": "rainy", + "368": "cloudy_snowing", + "371": "snowing", + "374": "rainy", + "377": "rainy", + "386": "thunderstorm", + "389": "thunderstorm", + "392": "thunderstorm", + "395": "snowing" + }) +} diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index 0a890c6ee..1eefb15d6 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -3,6 +3,7 @@ import "root:/services" import "root:/modules/common/" import "root:/modules/common/widgets" import "root:/modules/common/functions/color_utils.js" as ColorUtils +import "root:/modules/bar/weather" import QtQuick import QtQuick.Controls import QtQuick.Layouts @@ -27,7 +28,8 @@ Scope { color: Appearance.colors.colOutlineVariant } - Variants { // For each monitor + Variants { + // For each monitor model: { const screens = Quickshell.screens; const list = ConfigOptions.bar.screenList; @@ -42,12 +44,8 @@ Scope { property ShellScreen modelData property var brightnessMonitor: Brightness.getMonitorForScreen(modelData) - property real useShortenedForm: (Appearance.sizes.barHellaShortenScreenWidthThreshold >= screen.width) ? 2 : - (Appearance.sizes.barShortenScreenWidthThreshold >= screen.width) ? 1 : 0 - readonly property int centerSideModuleWidth: - (useShortenedForm == 2) ? Appearance.sizes.barCenterSideModuleWidthHellaShortened : - (useShortenedForm == 1) ? Appearance.sizes.barCenterSideModuleWidthShortened : - Appearance.sizes.barCenterSideModuleWidth + property real useShortenedForm: (Appearance.sizes.barHellaShortenScreenWidthThreshold >= screen.width) ? 2 : (Appearance.sizes.barShortenScreenWidthThreshold >= screen.width) ? 1 : 0 + readonly property int centerSideModuleWidth: (useShortenedForm == 2) ? Appearance.sizes.barCenterSideModuleWidthHellaShortened : (useShortenedForm == 1) ? Appearance.sizes.barCenterSideModuleWidthShortened : Appearance.sizes.barCenterSideModuleWidth WlrLayershell.namespace: "quickshell:bar" implicitHeight: barHeight + Appearance.rounding.screenRounding @@ -74,7 +72,7 @@ Scope { } color: showBarBackground ? Appearance.colors.colLayer0 : "transparent" height: barHeight - + MouseArea { // Left side | scroll to change brightness id: barLeftSideMouseArea anchors.left: parent.left @@ -87,21 +85,21 @@ Scope { acceptedButtons: Qt.LeftButton hoverEnabled: true propagateComposedEvents: true - onEntered: (event) => { - barLeftSideMouseArea.hovered = true + onEntered: event => { + barLeftSideMouseArea.hovered = true; } - onExited: (event) => { - barLeftSideMouseArea.hovered = false - barLeftSideMouseArea.trackingScroll = false + onExited: event => { + barLeftSideMouseArea.hovered = false; + barLeftSideMouseArea.trackingScroll = false; } - onPressed: (event) => { + onPressed: event => { if (event.button === Qt.LeftButton) { - Hyprland.dispatch('global quickshell:sidebarLeftOpen') + Hyprland.dispatch('global quickshell:sidebarLeftOpen'); } } // Scroll to change brightness WheelHandler { - onWheel: (event) => { + onWheel: event => { if (event.angleDelta.y < 0) barRoot.brightnessMonitor.setBrightness(barRoot.brightnessMonitor.brightness - 0.05); else if (event.angleDelta.y > 0) @@ -113,17 +111,18 @@ Scope { } acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad } - onPositionChanged: (mouse) => { + onPositionChanged: mouse => { if (barLeftSideMouseArea.trackingScroll) { const dx = mouse.x - barLeftSideMouseArea.lastScrollX; const dy = mouse.y - barLeftSideMouseArea.lastScrollY; - if (Math.sqrt(dx*dx + dy*dy) > osdHideMouseMoveThreshold) { - Hyprland.dispatch('global quickshell:osdBrightnessHide') + if (Math.sqrt(dx * dx + dy * dy) > osdHideMouseMoveThreshold) { + Hyprland.dispatch('global quickshell:osdBrightnessHide'); barLeftSideMouseArea.trackingScroll = false; } } } - Item { // Left section + Item { + // Left section anchors.fill: parent implicitHeight: leftSectionRowLayout.implicitHeight implicitWidth: leftSectionRowLayout.implicitWidth @@ -135,22 +134,22 @@ Scope { side: "left" anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter - } - + RowLayout { // Content id: leftSectionRowLayout anchors.fill: parent spacing: 10 - RippleButton { // Left sidebar button + RippleButton { + // Left sidebar button Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter Layout.leftMargin: Appearance.rounding.screenRounding Layout.fillWidth: false property real buttonPadding: 5 implicitWidth: distroIcon.width + buttonPadding * 2 implicitHeight: distroIcon.height + buttonPadding * 2 - + buttonRadius: Appearance.rounding.full colBackground: barLeftSideMouseArea.hovered ? Appearance.colors.colLayer1Hover : ColorUtils.transparentize(Appearance.colors.colLayer1Hover, 1) colBackgroundHover: Appearance.colors.colLayer1Hover @@ -159,10 +158,10 @@ Scope { colBackgroundToggledHover: Appearance.colors.colSecondaryContainerHover colRippleToggled: Appearance.colors.colSecondaryContainerActive toggled: GlobalStates.sidebarLeftOpen - property color colText: toggled ? Appearance.m3colors.m3onSecondaryContainer : Appearance.colors.colOnLayer0 + property color colText: toggled ? Appearance.m3colors.m3onSecondaryContainer : Appearance.colors.colOnLayer0 onPressed: { - Hyprland.dispatch('global quickshell:sidebarLeftToggle') + Hyprland.dispatch('global quickshell:sidebarLeftToggle'); } CustomIcon { @@ -170,10 +169,9 @@ Scope { anchors.centerIn: parent width: 19.5 height: 19.5 - source: ConfigOptions.bar.topLeftIcon == 'distro' ? - SystemInfo.distroIcon : "spark-symbolic" + source: ConfigOptions.bar.topLeftIcon == 'distro' ? SystemInfo.distroIcon : "spark-symbolic" } - + ColorOverlay { anchors.fill: distroIcon source: distroIcon @@ -211,34 +209,38 @@ Scope { visible: barRoot.useShortenedForm < 2 Layout.fillWidth: true } - } - VerticalBarSeparator {visible: ConfigOptions?.bar.borderless} + VerticalBarSeparator { + visible: ConfigOptions?.bar.borderless + } BarGroup { id: middleCenterGroup padding: workspacesWidget.widgetPadding Layout.fillHeight: true - + Workspaces { id: workspacesWidget bar: barRoot Layout.fillHeight: true - MouseArea { // Right-click to toggle overview + MouseArea { + // Right-click to toggle overview anchors.fill: parent acceptedButtons: Qt.RightButton - - onPressed: (event) => { + + onPressed: event => { if (event.button === Qt.RightButton) { - Hyprland.dispatch('global quickshell:overviewToggle') + Hyprland.dispatch('global quickshell:overviewToggle'); } } } } } - VerticalBarSeparator {visible: ConfigOptions?.bar.borderless} + VerticalBarSeparator { + visible: ConfigOptions?.bar.borderless + } MouseArea { id: rightCenterGroup @@ -248,13 +250,13 @@ Scope { Layout.fillHeight: true onPressed: { - Hyprland.dispatch('global quickshell:sidebarRightToggle') + Hyprland.dispatch('global quickshell:sidebarRightToggle'); } BarGroup { id: rightCenterGroupContent anchors.fill: parent - + ClockWidget { showDate: (ConfigOptions.bar.verbose && barRoot.useShortenedForm < 2) Layout.alignment: Qt.AlignVCenter @@ -273,6 +275,19 @@ Scope { } } + VerticalBarSeparator { + visible: ConfigOptions?.bar.borderless + } + + // Weather + BarGroup { + id: weatherGroupContent + Layout.fillHeight: true + Layout.alignment: Qt.AlignVCenter + WeatherBar { + visible: ConfigOptions.bar.weather.show + } + } } MouseArea { // Right side | scroll to change volume @@ -286,28 +301,27 @@ Scope { property real lastScrollX: 0 property real lastScrollY: 0 property bool trackingScroll: false - + acceptedButtons: Qt.LeftButton hoverEnabled: true propagateComposedEvents: true - onEntered: (event) => { - barRightSideMouseArea.hovered = true + onEntered: event => { + barRightSideMouseArea.hovered = true; } - onExited: (event) => { - barRightSideMouseArea.hovered = false - barRightSideMouseArea.trackingScroll = false + onExited: event => { + barRightSideMouseArea.hovered = false; + barRightSideMouseArea.trackingScroll = false; } - onPressed: (event) => { + onPressed: event => { if (event.button === Qt.LeftButton) { - Hyprland.dispatch('global quickshell:sidebarRightOpen') - } - else if (event.button === Qt.RightButton) { - MprisController.activePlayer.next() + Hyprland.dispatch('global quickshell:sidebarRightOpen'); + } else if (event.button === Qt.RightButton) { + MprisController.activePlayer.next(); } } // Scroll to change volume WheelHandler { - onWheel: (event) => { + onWheel: event => { const currentVolume = Audio.value; const step = currentVolume < 0.1 ? 0.01 : 0.02 || 0.2; if (event.angleDelta.y < 0) @@ -321,12 +335,12 @@ Scope { } acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad } - onPositionChanged: (mouse) => { + onPositionChanged: mouse => { if (barRightSideMouseArea.trackingScroll) { const dx = mouse.x - barRightSideMouseArea.lastScrollX; const dy = mouse.y - barRightSideMouseArea.lastScrollY; - if (Math.sqrt(dx*dx + dy*dy) > osdHideMouseMoveThreshold) { - Hyprland.dispatch('global quickshell:osdVolumeHide') + if (Math.sqrt(dx * dx + dy * dy) > osdHideMouseMoveThreshold) { + Hyprland.dispatch('global quickshell:osdVolumeHide'); barRightSideMouseArea.trackingScroll = false; } } @@ -336,7 +350,7 @@ Scope { anchors.fill: parent implicitHeight: rightSectionRowLayout.implicitHeight implicitWidth: rightSectionRowLayout.implicitWidth - + ScrollHint { reveal: barRightSideMouseArea.hovered icon: "volume_up" @@ -351,13 +365,13 @@ Scope { anchors.fill: parent spacing: 5 layoutDirection: Qt.RightToLeft - + RippleButton { // Right sidebar button id: rightSidebarButton Layout.margins: 4 Layout.rightMargin: Appearance.rounding.screenRounding Layout.fillHeight: true - implicitWidth: indicatorsRowLayout.implicitWidth + 10*2 + implicitWidth: indicatorsRowLayout.implicitWidth + 10 * 2 buttonRadius: Appearance.rounding.full colBackground: barRightSideMouseArea.hovered ? Appearance.colors.colLayer1Hover : ColorUtils.transparentize(Appearance.colors.colLayer1Hover, 1) colBackgroundHover: Appearance.colors.colLayer1Hover @@ -373,7 +387,7 @@ Scope { } onPressed: { - Hyprland.dispatch('global quickshell:sidebarRightToggle') + Hyprland.dispatch('global quickshell:sidebarRightToggle'); } RowLayout { @@ -381,7 +395,7 @@ Scope { anchors.centerIn: parent property real realSpacing: 15 spacing: 0 - + Revealer { reveal: Audio.sink?.audio?.muted ?? false Layout.fillHeight: true @@ -475,9 +489,6 @@ Scope { opacity: 1.0 - Appearance.transparency } } - } - } - } diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml new file mode 100644 index 000000000..58f68ab45 --- /dev/null +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -0,0 +1,68 @@ +pragma ComponentBehavior: Bound +import "root:/modules/common" +import "root:/modules/common/widgets" +import "root:/constants" +import "root:/services" +import Quickshell +import QtQuick +import QtQuick.Layouts + +Item { + id: root + property real margin: 5 + implicitHeight: 32 + implicitWidth: mouseArea.implicitWidth + margin * 2 + + MouseArea { + id: mouseArea + property bool hovered: false + implicitWidth: rowLayout.implicitWidth + implicitHeight: rowLayout.implicitHeight + anchors.centerIn: root + + hoverEnabled: true + onEntered: { + popupLoader.item.visible = true; + } + onExited: { + popupLoader.item.visible = false; + } + + RowLayout { + id: rowLayout + + MaterialSymbol { + fill: 0 + text: WeatherIcons.codeToName[WeatherService.data.wCode] + iconSize: Appearance.font.pixelSize.large + color: Appearance.colors.colOnLayer1 + } + + StyledText { + visible: true + font.pixelSize: Appearance.font.pixelSize.normal + color: Appearance.colors.colOnLayer1 + text: WeatherService.data.temp + } + } + } + + LazyLoader { + id: popupLoader + active: true + + component: PopupWindow { + id: popupWindow + implicitWidth: weatherPopup.implicitWidth + implicitHeight: weatherPopup.implicitHeight + anchor.item: root + anchor.edges: Edges.Bottom + anchor.rect.x: (root.implicitWidth - popupWindow.implicitWidth) / 2 + anchor.rect.y: root.implicitHeight + 10 + color: "transparent" + WeatherPopup { + id: weatherPopup + } + } + } +} diff --git a/.config/quickshell/modules/bar/weather/WeatherCard.qml b/.config/quickshell/modules/bar/weather/WeatherCard.qml new file mode 100644 index 000000000..6910b2cc5 --- /dev/null +++ b/.config/quickshell/modules/bar/weather/WeatherCard.qml @@ -0,0 +1,45 @@ +import QtQuick +import QtQuick.Layouts + +import "root:/modules/common" +import "root:/modules/common/widgets" + +Rectangle { + id: root + radius: Appearance.rounding.verysmall + color: Appearance.colors.colLayer1 + border.color: Appearance.colors.colShadow + border.width: 1 + implicitWidth: columnLayout.implicitWidth * 2 + implicitHeight: columnLayout.implicitHeight * 2 + Layout.fillWidth: parent + + property alias title: title.text + property alias value: value.text + property alias symbol: symbol.text + + ColumnLayout { + id: columnLayout + anchors.fill: parent + spacing: -10 + RowLayout { + Layout.alignment: Qt.AlignHCenter + MaterialSymbol { + id: symbol + fill: 0 + iconSize: Appearance.font.pixelSize.normal + } + Text { + id: title + font.pixelSize: Appearance.font.pixelSize.smaller + color: Appearance.colors.colOnLayer2 + } + } + Text { + id: value + Layout.alignment: Qt.AlignHCenter + font.pixelSize: Appearance.font.pixelSize.normal + color: Appearance.colors.colOnLayer2 + } + } +} diff --git a/.config/quickshell/modules/bar/weather/WeatherPopup.qml b/.config/quickshell/modules/bar/weather/WeatherPopup.qml new file mode 100644 index 000000000..04f0c307a --- /dev/null +++ b/.config/quickshell/modules/bar/weather/WeatherPopup.qml @@ -0,0 +1,95 @@ +import "root:/services" +import "root:/modules/common" +import "root:/modules/common/widgets" + +import QtQuick +import QtQuick.Layouts + +Rectangle { + id: root + readonly property real margin: 10 + implicitWidth: columnLayout.implicitWidth + margin * 2 + implicitHeight: columnLayout.implicitHeight + margin * 2 + color: Appearance.colors.colLayer0 + radius: 12 + clip: true + border.color: Appearance.colors.colShadow + border.width: 1 + + ColumnLayout { + id: columnLayout + spacing: 5 + anchors.centerIn: root + implicitWidth: Math.max(header.implicitWidth, gridLayout.implicitWidth) + implicitHeight: gridLayout.implicitHeight + + // Header + RowLayout { + id: header + spacing: 5 + Layout.fillWidth: parent + Layout.alignment: Qt.AlignHCenter + MaterialSymbol { + fill: 0 + text: "location_on" + iconSize: Appearance.font.pixelSize.huge + } + + Text { + text: WeatherService.data.city + font.pixelSize: Appearance.font.pixelSize.large + color: Appearance.colors.colOnLayer0 + } + } + + // Metrics grid + GridLayout { + id: gridLayout + columns: 2 + rowSpacing: 5 + columnSpacing: 5 + uniformCellWidths: true + + WeatherCard { + title: "UV Index" + symbol: "wb_sunny" + value: WeatherService.data.uv + } + WeatherCard { + title: "Wind" + symbol: "air" + value: `(${WeatherService.data.windDir}) ${WeatherService.data.wind}` + } + WeatherCard { + title: "Precipitation" + symbol: "rainy_light" + value: WeatherService.data.precip + } + WeatherCard { + title: "Humidity" + symbol: "humidity_low" + value: WeatherService.data.humidity + } + WeatherCard { + title: "Visibility" + symbol: "visibility" + value: WeatherService.data.visib + } + WeatherCard { + title: "Pressure" + symbol: "readiness_score" + value: WeatherService.data.press + } + WeatherCard { + title: "Sunrise" + symbol: "wb_twilight" + value: WeatherService.data.sunrise + } + WeatherCard { + title: "Sunset" + symbol: "bedtime" + value: WeatherService.data.sunset + } + } + } +} diff --git a/.config/quickshell/modules/common/ConfigOptions.qml b/.config/quickshell/modules/common/ConfigOptions.qml index 198d4affc..ad5395743 100644 --- a/.config/quickshell/modules/common/ConfigOptions.qml +++ b/.config/quickshell/modules/common/ConfigOptions.qml @@ -72,6 +72,16 @@ Singleton { property bool alwaysShowNumbers: false property int showNumberDelay: 300 // milliseconds } + property QtObject weather: QtObject { + property bool show: true + // for specific location checkout gps setting + property string city: "Istanbul" + // use uscs units + // by default use metric (SI) units + property bool useUSCS: false + // in minutes + property int fetchInterval: 10 + } } property QtObject battery: QtObject { @@ -161,4 +171,11 @@ Singleton { property QtObject hacks: QtObject { property int arbitraryRaceConditionDelay: 20 // milliseconds } + + // this is for weather and feature apis + property QtObject gps: QtObject { + property bool active: false + property real latitude: 41.27830580591624 + property real longitude: 28.730357071149154 + } } diff --git a/.config/quickshell/services/WeatherService.qml b/.config/quickshell/services/WeatherService.qml new file mode 100644 index 000000000..da418f724 --- /dev/null +++ b/.config/quickshell/services/WeatherService.qml @@ -0,0 +1,105 @@ +pragma Singleton +pragma ComponentBehavior: Bound + +import Quickshell +import Quickshell.Io +import QtQuick + +import "root:/modules/common" + +Singleton { + id: root + // 10 minute + readonly property int fetchInterval: ConfigOptions.bar.weather.fetchInterval * 60 * 1000 + property var data: ({ + uv: 0, + humidity: 0, + sunrise: 0, + sunset: 0, + windDir: 0, + wCode: 0, + city: 0, + wind: 0, + precip: 0, + visib: 0, + press: 0, + temp: 0 + }) + + function refineData(data) { + let temp = {}; + temp.uv = data?.current?.uvIndex || 0; + temp.humidity = (data?.current?.humidity || 0) + "%"; + temp.sunrise = data?.astronomy?.sunrise || "0.0"; + temp.sunset = data?.astronomy?.sunset || "0.0"; + temp.windDir = data?.current?.winddir16Point || "N"; + temp.wCode = data?.current?.weatherCode || "113"; + temp.city = data?.location?.areaName[0].value || "Istanbul"; + temp.temp = ""; + if (ConfigOptions.bar.weather.useUSCS) { + temp.wind = (data?.current?.windspeedMiles || 0) + " mph"; + temp.precip = (data?.current?.precipInches || 0) + " in"; + temp.visib = (data?.current?.visibilityMiles || 0) + " m"; + temp.press = (data?.current?.pressureInches || 0) + " psi"; + temp.temp += (data?.current?.temp_F || 0); + temp.temp += " (" + (data?.current?.FeelsLikeF || 0) + ") "; + temp.temp += "\u{02109}"; + } else { + temp.wind = (data?.current?.windspeedKmph || 0) + " km/h"; + temp.precip = (data?.current?.precipMM || 0) + " mm"; + temp.visib = (data?.current?.visibility || 0) + " km"; + temp.press = (data?.current?.pressure || 0) + " hPa"; + temp.temp += (data?.current?.temp_C || 0); + temp.temp += " (" + (data?.current?.FeelsLikeC || 0) + ") "; + temp.temp += "\u{02103}"; + } + root.data = temp; + } + + function getData() { + let command = "curl -s wttr.in"; + if (ConfigOptions.gps.active) { + command += `/${ConfigOptions.gps.latitude},${Config.gps.longitude}`; + } else { + command += `/${formatCityName(ConfigOptions.bar.weather.city)}`; + } + + // format as json + command += "?format=j1"; + command += " | "; + // only take the current weather, location, asytronmy data + command += "jq '{current: .current_condition[0], location: .nearest_area[0], astronomy: .weather[0].astronomy[0]}'"; + fetcher.command[2] = command; + fetcher.running = true; + } + + function formatCityName(cityName) { + return cityName.trim().split(/\s+/).join('+'); + } + + Process { + id: fetcher + command: ["bash", "-c", ""] + stdout: StdioCollector { + onStreamFinished: { + if (text.length === 0) + return; + try { + const parsedData = JSON.parse(text); + root.refineData(parsedData); + // console.info(`[ data: ${JSON.stringify(parsedData)}`); + } catch (e) { + console.error(`[WeatherService] ${e.message}`); + } + } + } + } + + Timer { + running: true + repeat: true + interval: root.fetchInterval + triggeredOnStart: true + onTriggered: root.getData() + } +} From d7cf0f4f27e85000c19f91f34782b439740857c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Sat, 28 Jun 2025 08:32:39 +0300 Subject: [PATCH 02/22] fix(WeatherBar): not using config fonts --- .../quickshell/modules/bar/weather/WeatherBar.qml | 2 +- .../quickshell/modules/bar/weather/WeatherCard.qml | 12 +++++------- .../quickshell/modules/bar/weather/WeatherPopup.qml | 5 +++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml index 58f68ab45..bcab6edcc 100644 --- a/.config/quickshell/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -40,7 +40,7 @@ Item { StyledText { visible: true - font.pixelSize: Appearance.font.pixelSize.normal + font.pixelSize: Appearance.font.pixelSize.large color: Appearance.colors.colOnLayer1 text: WeatherService.data.temp } diff --git a/.config/quickshell/modules/bar/weather/WeatherCard.qml b/.config/quickshell/modules/bar/weather/WeatherCard.qml index 6910b2cc5..7b81fe543 100644 --- a/.config/quickshell/modules/bar/weather/WeatherCard.qml +++ b/.config/quickshell/modules/bar/weather/WeatherCard.qml @@ -6,10 +6,8 @@ import "root:/modules/common/widgets" Rectangle { id: root - radius: Appearance.rounding.verysmall + radius: Appearance.rounding.small color: Appearance.colors.colLayer1 - border.color: Appearance.colors.colShadow - border.width: 1 implicitWidth: columnLayout.implicitWidth * 2 implicitHeight: columnLayout.implicitHeight * 2 Layout.fillWidth: parent @@ -29,17 +27,17 @@ Rectangle { fill: 0 iconSize: Appearance.font.pixelSize.normal } - Text { + StyledText { id: title font.pixelSize: Appearance.font.pixelSize.smaller - color: Appearance.colors.colOnLayer2 + color: Appearance.colors.colOnLayer1 } } - Text { + StyledText { id: value Layout.alignment: Qt.AlignHCenter font.pixelSize: Appearance.font.pixelSize.normal - color: Appearance.colors.colOnLayer2 + color: Appearance.colors.colOnLayer1 } } } diff --git a/.config/quickshell/modules/bar/weather/WeatherPopup.qml b/.config/quickshell/modules/bar/weather/WeatherPopup.qml index 04f0c307a..931a0469a 100644 --- a/.config/quickshell/modules/bar/weather/WeatherPopup.qml +++ b/.config/quickshell/modules/bar/weather/WeatherPopup.qml @@ -35,9 +35,10 @@ Rectangle { iconSize: Appearance.font.pixelSize.huge } - Text { + StyledText { text: WeatherService.data.city - font.pixelSize: Appearance.font.pixelSize.large + font.pixelSize: Appearance.font.pixelSize.title + font.family: Appearance.font.family.title color: Appearance.colors.colOnLayer0 } } From 660af6e0183dc8ca168c399fc4c8c03d89aadc24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Sat, 28 Jun 2025 08:34:43 +0300 Subject: [PATCH 03/22] fix(modules/bar): WeatherBar pushing middlesection to the left --- .config/quickshell/modules/bar/Bar.qml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index 1eefb15d6..0923513a6 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -278,15 +278,17 @@ Scope { VerticalBarSeparator { visible: ConfigOptions?.bar.borderless } + } - // Weather - BarGroup { - id: weatherGroupContent - Layout.fillHeight: true - Layout.alignment: Qt.AlignVCenter - WeatherBar { - visible: ConfigOptions.bar.weather.show - } + // Weather + Loader { + id: weatherLoader + active: ConfigOptions.bar.weather.show + anchors.left: middleSection.right + anchors.margins: 10 + sourceComponent: BarGroup { + implicitHeight: barHeight + WeatherBar {} } } @@ -295,7 +297,7 @@ Scope { anchors.right: parent.right implicitHeight: barHeight - width: (barRoot.width - middleSection.width) / 2 + width: (barRoot.width - (barLeftSideMouseArea.width + middleSection.width + weatherLoader.width)) property bool hovered: false property real lastScrollX: 0 From bb456687a62ef90bfe042d22491bf0d1be87ea72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Sat, 28 Jun 2025 08:35:22 +0300 Subject: [PATCH 04/22] feat(settings): add weather section --- .../quickshell/modules/common/ConfigOptions.qml | 2 +- .../modules/settings/ServicesConfig.qml | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/modules/common/ConfigOptions.qml b/.config/quickshell/modules/common/ConfigOptions.qml index ad5395743..f4d40abbe 100644 --- a/.config/quickshell/modules/common/ConfigOptions.qml +++ b/.config/quickshell/modules/common/ConfigOptions.qml @@ -73,7 +73,7 @@ Singleton { property int showNumberDelay: 300 // milliseconds } property QtObject weather: QtObject { - property bool show: true + property bool show: false // for specific location checkout gps setting property string city: "Istanbul" // use uscs units diff --git a/.config/quickshell/modules/settings/ServicesConfig.qml b/.config/quickshell/modules/settings/ServicesConfig.qml index 1be540363..b77c086f6 100644 --- a/.config/quickshell/modules/settings/ServicesConfig.qml +++ b/.config/quickshell/modules/settings/ServicesConfig.qml @@ -136,4 +136,17 @@ ContentPage { } } -} \ No newline at end of file + ContentSubsection { + title: "Weather" + ConfigRow { + uniform: false + ConfigSwitch { + text: "Show" + checked: ConfigOptions.bar.weather.show + onCheckedChanged: { + ConfigLoader.setConfigValueAndSave("bar.weather.show", checked); + } + } + } + } +} From 9404b21f82788de087eba7e4cc6d465f0ee99704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Sat, 28 Jun 2025 16:58:54 +0300 Subject: [PATCH 05/22] config(hyprland): fix invalid geoclue agent path --- .config/hypr/hyprland/execs.conf | 2 +- .../hyprland/scripts/start_geoclue_agent.sh | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 .config/hypr/hyprland/scripts/start_geoclue_agent.sh diff --git a/.config/hypr/hyprland/execs.conf b/.config/hypr/hyprland/execs.conf index d4945605b..9d4747a90 100644 --- a/.config/hypr/hyprland/execs.conf +++ b/.config/hypr/hyprland/execs.conf @@ -1,7 +1,7 @@ # Bar, wallpaper exec-once = swww-daemon --format xrgb --no-cache exec-once = sleep 0.5; swww img "$(cat ~/.local/state/quickshell/user/generated/wallpaper/path.txt)" --transition-step 100 --transition-fps 120 --transition-type grow --transition-angle 30 --transition-duration 1 -exec-once = /usr/lib/geoclue-2.0/demos/agent & gammastep +exec-once = ~/.config/hypr/hyprland/scripts/start_geoclue_agent.sh & gammastep exec-once = qs & # Input method diff --git a/.config/hypr/hyprland/scripts/start_geoclue_agent.sh b/.config/hypr/hyprland/scripts/start_geoclue_agent.sh new file mode 100755 index 000000000..e464d0531 --- /dev/null +++ b/.config/hypr/hyprland/scripts/start_geoclue_agent.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Check if GeoClue agent is already running +if pgrep -f 'geoclue-2.0/demos/agent' > /dev/null; then + echo "GeoClue agent is already running." + exit 0 +fi + +# List of known possible GeoClue agent paths +AGENT_PATHS=" +/usr/libexec/geoclue-2.0/demos/agent +/usr/lib/geoclue-2.0/demos/agent +" + +# Find the first valid agent path +for path in $AGENT_PATHS; do + if [ -x "$path" ]; then + echo "Starting GeoClue agent from: $path" + "$path" & # starts in the background + exit 0 + fi +done + +# If we got here, none of the paths worked +echo "GeoClue agent not found in known paths." +echo "Please install GeoClue or update the script with the correct path." +exit 1 From d8f5471b3e6930b768df42e1889ebc71d9fab491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Sat, 28 Jun 2025 20:25:36 +0300 Subject: [PATCH 06/22] config(WeatherService): add enableGps option --- .config/quickshell/modules/common/ConfigOptions.qml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.config/quickshell/modules/common/ConfigOptions.qml b/.config/quickshell/modules/common/ConfigOptions.qml index f4d40abbe..c96a7a9b0 100644 --- a/.config/quickshell/modules/common/ConfigOptions.qml +++ b/.config/quickshell/modules/common/ConfigOptions.qml @@ -73,8 +73,10 @@ Singleton { property int showNumberDelay: 300 // milliseconds } property QtObject weather: QtObject { - property bool show: false - // for specific location checkout gps setting + property bool show: true + // gps based location + property bool enableGPS: true + // use if 'enableGPS' is false property string city: "Istanbul" // use uscs units // by default use metric (SI) units @@ -171,11 +173,4 @@ Singleton { property QtObject hacks: QtObject { property int arbitraryRaceConditionDelay: 20 // milliseconds } - - // this is for weather and feature apis - property QtObject gps: QtObject { - property bool active: false - property real latitude: 41.27830580591624 - property real longitude: 28.730357071149154 - } } From 689f6c90e7cfdfe562fcf7df24f983b92e2a01ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Sat, 28 Jun 2025 20:48:34 +0300 Subject: [PATCH 07/22] feat(WeatherService): add geolocation service --- .../quickshell/services/WeatherService.qml | 61 +++++++++++++++++-- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/.config/quickshell/services/WeatherService.qml b/.config/quickshell/services/WeatherService.qml index da418f724..7f4bbee3b 100644 --- a/.config/quickshell/services/WeatherService.qml +++ b/.config/quickshell/services/WeatherService.qml @@ -4,6 +4,7 @@ pragma ComponentBehavior: Bound import Quickshell import Quickshell.Io import QtQuick +import QtPositioning import "root:/modules/common" @@ -11,6 +12,16 @@ Singleton { id: root // 10 minute readonly property int fetchInterval: ConfigOptions.bar.weather.fetchInterval * 60 * 1000 + readonly property string city: ConfigOptions.bar.weather.city + readonly property bool useUSCS: ConfigOptions.bar.weather.useUSCS + readonly property bool gpsActive: ConfigOptions.bar.weather.enableGPS + + property var location: ({ + valid: false, + lat: 0, + lon: 0, + }) + property var data: ({ uv: 0, humidity: 0, @@ -36,7 +47,7 @@ Singleton { temp.wCode = data?.current?.weatherCode || "113"; temp.city = data?.location?.areaName[0].value || "Istanbul"; temp.temp = ""; - if (ConfigOptions.bar.weather.useUSCS) { + if (root.useUSCS) { temp.wind = (data?.current?.windspeedMiles || 0) + " mph"; temp.precip = (data?.current?.precipInches || 0) + " in"; temp.visib = (data?.current?.visibilityMiles || 0) + " m"; @@ -58,10 +69,11 @@ Singleton { function getData() { let command = "curl -s wttr.in"; - if (ConfigOptions.gps.active) { - command += `/${ConfigOptions.gps.latitude},${Config.gps.longitude}`; + + if (root.gpsActive && root.location.valid) { + command += `/${root.location.lat},${root.location.long}`; } else { - command += `/${formatCityName(ConfigOptions.bar.weather.city)}`; + command += `/${formatCityName(root.city)}`; } // format as json @@ -77,6 +89,13 @@ Singleton { return cityName.trim().split(/\s+/).join('+'); } + Component.onCompleted: { + if(!root.gpsActive) return + + console.info("[WeatherService] Starting the GPS service.") + positionSource.start() + } + Process { id: fetcher command: ["bash", "-c", ""] @@ -95,11 +114,41 @@ Singleton { } } + PositionSource { + id: positionSource + updateInterval: root.fetchInterval + + onPositionChanged: { + // update the location if the given location is valid + // if it fails getting the location, use the last valid location + if (position.latitudeValid && position.longitudeValid) { + root.location.lat = position.coordinate.latitude; + root.location.long = position.coordinate.longitude; + root.location.valid = true + // console.info(`📍 Location: ${position.coordinate.latitude}, ${position.coordinate.longitude}`); + root.getData(); + // if can't get initialized with valid location deactivate the GPS + } else { + root.gpsActive = root.location.valid ? true : false + } + } + + onValidityChanged: { + if(!valid) { + positionSource.stop() + root.location.valid = false + root.gpsActive = false + Quickshell.execDetached(["bash", "-c", `notify-send WeatherService 'Failed to load the GPS service. Using the fallback method instead.'`]) + console.error("[WeatherService] Could not aquire a valid backend plugin.") + } + } + } + Timer { - running: true + running: !root.gpsActive repeat: true interval: root.fetchInterval - triggeredOnStart: true + triggeredOnStart: !root.gpsActive onTriggered: root.getData() } } From c17db4bfb1b4b7d47d95d18fdb652ff0a12aeef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Tue, 1 Jul 2025 05:20:41 +0300 Subject: [PATCH 08/22] Resolve conflicting merge issues --- .config/quickshell/modules/bar/Bar.qml | 7 +- .config/quickshell/modules/common/Config.qml | 12 ++ .../modules/common/ConfigOptions.qml | 176 ------------------ .../quickshell/services/WeatherService.qml | 44 ++--- 4 files changed, 38 insertions(+), 201 deletions(-) delete mode 100644 .config/quickshell/modules/common/ConfigOptions.qml diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index 94f7caf58..192dcb504 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -307,18 +307,19 @@ Scope { } VerticalBarSeparator { - visible: ConfigOptions?.bar.borderless + visible: Config.options.bar.borderless } } // Weather Loader { id: weatherLoader - active: ConfigOptions.bar.weather.show + active: Config.options.bar.weather.show anchors.left: middleSection.right anchors.margins: 10 sourceComponent: BarGroup { - implicitHeight: barHeight + implicitHeight: Appearance.sizes.baseBarHeight + height: Appearance.sizes.barHeight WeatherBar {} } } diff --git a/.config/quickshell/modules/common/Config.qml b/.config/quickshell/modules/common/Config.qml index dda2e97ee..5e7b9bb3f 100644 --- a/.config/quickshell/modules/common/Config.qml +++ b/.config/quickshell/modules/common/Config.qml @@ -122,6 +122,18 @@ Singleton { property bool alwaysShowNumbers: false property int showNumberDelay: 300 // milliseconds } + property JsonObject weather: JsonObject { + property bool show: true + // gps based location + property bool enableGPS: true + // use if 'enableGPS' is false + property string city: "Istanbul" + // use uscs units + // by default use metric (SI) units + property bool useUSCS: false + // in minutes + property int fetchInterval: 10 + } } property JsonObject battery: JsonObject { diff --git a/.config/quickshell/modules/common/ConfigOptions.qml b/.config/quickshell/modules/common/ConfigOptions.qml deleted file mode 100644 index c96a7a9b0..000000000 --- a/.config/quickshell/modules/common/ConfigOptions.qml +++ /dev/null @@ -1,176 +0,0 @@ -pragma Singleton -pragma ComponentBehavior: Bound -import QtQuick -import Quickshell - -Singleton { - property QtObject policies: QtObject { - property int ai: 1 // 0: No | 1: Yes | 2: Local - property int weeb: 1 // 0: No | 1: Open | 2: Closet - } - - property QtObject ai: QtObject { - property string systemPrompt: qsTr("Use casual tone. No user knowledge is to be assumed except basic Linux literacy. Be brief and concise: When explaining concepts, use bullet points (prefer minus sign (-) over asterisk (*)) and highlight keywords in bold to pinpoint the main concepts instead of long paragraphs. You are also encouraged to split your response with h2 headers, each header title beginning with an emoji, like `## 🐧 Linux`. When making changes to the user's config, you must get the config to know what values there are before setting.") - } - - property QtObject appearance: QtObject { - property int fakeScreenRounding: 2 // 0: None | 1: Always | 2: When not fullscreen - property bool transparency: false - property QtObject palette: QtObject { - property string type: "auto" // Allowed: auto, scheme-content, scheme-expressive, scheme-fidelity, scheme-fruit-salad, scheme-monochrome, scheme-neutral, scheme-rainbow, scheme-tonal-spot - } - } - - property QtObject audio: QtObject { - // Values in % - property QtObject protection: QtObject { - // Prevent sudden bangs - property bool enable: true - property real maxAllowedIncrease: 10 - property real maxAllowed: 90 // Realistically should already provide some protection when it's 99... - } - } - - property QtObject apps: QtObject { - property string bluetooth: "kcmshell6 kcm_bluetooth" - property string network: "plasmawindowed org.kde.plasma.networkmanagement" - property string networkEthernet: "kcmshell6 kcm_networkmanagement" - property string taskManager: "plasma-systemmonitor --page-name Processes" - property string terminal: "kitty -1" // This is only for shell actions - } - - property QtObject background: QtObject { - property bool fixedClockPosition: false - property real clockX: -500 - property real clockY: -500 - } - - property QtObject bar: QtObject { - property bool bottom: false // Instead of top - property bool borderless: false // true for no grouping of items - property string topLeftIcon: "spark" // Options: distro, spark - property bool showBackground: true - property bool verbose: true - property QtObject resources: QtObject { - property bool alwaysShowSwap: true - property bool alwaysShowCpu: false - } - property list screenList: [] // List of names, like "eDP-1", find out with 'hyprctl monitors' command - property QtObject utilButtons: QtObject { - property bool showScreenSnip: true - property bool showColorPicker: false - property bool showMicToggle: false - property bool showKeyboardToggle: true - property bool showDarkModeToggle: true - } - property QtObject tray: QtObject { - property bool monochromeIcons: true - } - property QtObject workspaces: QtObject { - property int shown: 10 - property bool showAppIcons: true - property bool alwaysShowNumbers: false - property int showNumberDelay: 300 // milliseconds - } - property QtObject weather: QtObject { - property bool show: true - // gps based location - property bool enableGPS: true - // use if 'enableGPS' is false - property string city: "Istanbul" - // use uscs units - // by default use metric (SI) units - property bool useUSCS: false - // in minutes - property int fetchInterval: 10 - } - } - - property QtObject battery: QtObject { - property int low: 20 - property int critical: 5 - property bool automaticSuspend: true - property int suspend: 3 - } - - property QtObject dock: QtObject { - property real height: 60 - property real hoverRegionHeight: 3 - property bool pinnedOnStartup: false - property bool hoverToReveal: false // When false, only reveals on empty workspace - property list pinnedApps: [ // IDs of pinned entries - "org.kde.dolphin", "kitty",] - } - - property QtObject language: QtObject { - property QtObject translator: QtObject { - property string engine: "auto" // Run `trans -list-engines` for available engines. auto should use google - property string targetLanguage: "auto" // Run `trans -list-all` for available languages - property string sourceLanguage: "auto" - } - } - - property QtObject networking: QtObject { - property string userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" - } - - property QtObject osd: QtObject { - property int timeout: 1000 - } - - property QtObject osk: QtObject { - property string layout: "qwerty_full" - property bool pinnedOnStartup: false - } - - property QtObject overview: QtObject { - property real scale: 0.18 // Relative to screen size - property real rows: 2 - property real columns: 5 - } - - property QtObject resources: QtObject { - property int updateInterval: 3000 - } - - property QtObject search: QtObject { - property int nonAppResultDelay: 30 // This prevents lagging when typing - property string engineBaseUrl: "https://www.google.com/search?q=" - property list excludedSites: ["quora.com"] - property bool sloppy: false // Uses levenshtein distance based scoring instead of fuzzy sort. Very weird. - property QtObject prefix: QtObject { - property string action: "/" - property string clipboard: ";" - property string emojis: ":" - } - } - - property QtObject sidebar: QtObject { - property QtObject translator: QtObject { - property int delay: 300 // Delay before sending request. Reduces (potential) rate limits and lag. - } - property QtObject booru: QtObject { - property bool allowNsfw: false - property string defaultProvider: "yandere" - property int limit: 20 - property QtObject zerochan: QtObject { - property string username: "[unset]" - } - } - } - - property QtObject time: QtObject { - // https://doc.qt.io/qt-6/qtime.html#toString - property string format: "hh:mm" - property string dateFormat: "dddd, dd/MM" - } - - property QtObject windows: QtObject { - property bool showTitlebar: true // Client-side decoration for shell apps - property bool centerTitle: true - } - - property QtObject hacks: QtObject { - property int arbitraryRaceConditionDelay: 20 // milliseconds - } -} diff --git a/.config/quickshell/services/WeatherService.qml b/.config/quickshell/services/WeatherService.qml index 7f4bbee3b..c4e8ac66f 100644 --- a/.config/quickshell/services/WeatherService.qml +++ b/.config/quickshell/services/WeatherService.qml @@ -11,15 +11,15 @@ import "root:/modules/common" Singleton { id: root // 10 minute - readonly property int fetchInterval: ConfigOptions.bar.weather.fetchInterval * 60 * 1000 - readonly property string city: ConfigOptions.bar.weather.city - readonly property bool useUSCS: ConfigOptions.bar.weather.useUSCS - readonly property bool gpsActive: ConfigOptions.bar.weather.enableGPS + readonly property int fetchInterval: Config.options.bar.weather.fetchInterval * 60 * 1000 + readonly property string city: Config.options.bar.weather.city + readonly property bool useUSCS: Config.options.bar.weather.useUSCS + readonly property bool gpsActive: Config.options.bar.weather.enableGPS property var location: ({ valid: false, lat: 0, - lon: 0, + lon: 0 }) property var data: ({ @@ -90,10 +90,10 @@ Singleton { } Component.onCompleted: { - if(!root.gpsActive) return - - console.info("[WeatherService] Starting the GPS service.") - positionSource.start() + if (!root.gpsActive) + return; + console.info("[WeatherService] Starting the GPS service."); + positionSource.start(); } Process { @@ -124,23 +124,23 @@ Singleton { if (position.latitudeValid && position.longitudeValid) { root.location.lat = position.coordinate.latitude; root.location.long = position.coordinate.longitude; - root.location.valid = true + root.location.valid = true; // console.info(`📍 Location: ${position.coordinate.latitude}, ${position.coordinate.longitude}`); root.getData(); - // if can't get initialized with valid location deactivate the GPS - } else { - root.gpsActive = root.location.valid ? true : false - } + // if can't get initialized with valid location deactivate the GPS + } else { + root.gpsActive = root.location.valid ? true : false; + } } onValidityChanged: { - if(!valid) { - positionSource.stop() - root.location.valid = false - root.gpsActive = false - Quickshell.execDetached(["bash", "-c", `notify-send WeatherService 'Failed to load the GPS service. Using the fallback method instead.'`]) - console.error("[WeatherService] Could not aquire a valid backend plugin.") - } + if (!valid) { + positionSource.stop(); + root.location.valid = false; + root.gpsActive = false; + Quickshell.execDetached(["bash", "-c", `notify-send WeatherService 'Failed to load the GPS service. Using the fallback method instead.'`]); + console.error("[WeatherService] Could not aquire a valid backend plugin."); + } } } @@ -148,7 +148,7 @@ Singleton { running: !root.gpsActive repeat: true interval: root.fetchInterval - triggeredOnStart: !root.gpsActive + triggeredOnStart: !root.gpsActive onTriggered: root.getData() } } From fd873ff7c1cd276f83935d8a334763e885177c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Tue, 1 Jul 2025 05:29:10 +0300 Subject: [PATCH 09/22] fix(): WeatherBar pushing MiddleSection to the left --- .config/quickshell/modules/bar/Bar.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index 192dcb504..b88a89476 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -330,7 +330,7 @@ Scope { anchors.right: parent.right implicitHeight: Appearance.sizes.baseBarHeight height: Appearance.sizes.barHeight - width: (barRoot.width - middleSection.width) / 2 + width: barRoot.width - (barLeftSideMouseArea.width + middleSection.width + weatherLoader.width) property bool hovered: false property real lastScrollX: 0 From 67c75b1cce495256edfc3bc45f78583b7f721da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Tue, 1 Jul 2025 05:42:50 +0300 Subject: [PATCH 10/22] fix(ServiceConfig): add weatherbar section --- .../modules/settings/ServicesConfig.qml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.config/quickshell/modules/settings/ServicesConfig.qml b/.config/quickshell/modules/settings/ServicesConfig.qml index ecd7efa89..21064ac91 100644 --- a/.config/quickshell/modules/settings/ServicesConfig.qml +++ b/.config/quickshell/modules/settings/ServicesConfig.qml @@ -138,16 +138,13 @@ ContentPage { } } - ContentSubsection { + ContentSection { title: "Weather" - ConfigRow { - uniform: false - ConfigSwitch { - text: "Show" - checked: ConfigOptions.bar.weather.show - onCheckedChanged: { - ConfigLoader.setConfigValueAndSave("bar.weather.show", checked); - } + ConfigSwitch { + text: "Show" + checked: Config.options.bar.weather.show + onCheckedChanged: { + Config.options.bar.weather.show = checked; } } } From b982c788fe25744897bc403e38d0ef4b98ba587d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Tue, 1 Jul 2025 07:11:06 +0300 Subject: [PATCH 11/22] style(WeatherPopup): remove the border --- .config/quickshell/modules/bar/weather/WeatherPopup.qml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.config/quickshell/modules/bar/weather/WeatherPopup.qml b/.config/quickshell/modules/bar/weather/WeatherPopup.qml index 931a0469a..0829bea9e 100644 --- a/.config/quickshell/modules/bar/weather/WeatherPopup.qml +++ b/.config/quickshell/modules/bar/weather/WeatherPopup.qml @@ -11,10 +11,8 @@ Rectangle { implicitWidth: columnLayout.implicitWidth + margin * 2 implicitHeight: columnLayout.implicitHeight + margin * 2 color: Appearance.colors.colLayer0 - radius: 12 + radius: Appearance.rounding.small clip: true - border.color: Appearance.colors.colShadow - border.width: 1 ColumnLayout { id: columnLayout From c94231365ffee129613949557b6e4a6e19c4d1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Tue, 1 Jul 2025 12:57:14 +0300 Subject: [PATCH 12/22] chore(WeatherService): rename to `Weather` --- .../modules/bar/weather/WeatherBar.qml | 4 ++-- .../modules/bar/weather/WeatherPopup.qml | 18 +++++++++--------- .../{WeatherService.qml => Weather.qml} | 0 3 files changed, 11 insertions(+), 11 deletions(-) rename .config/quickshell/services/{WeatherService.qml => Weather.qml} (100%) diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml index bcab6edcc..b879646ce 100644 --- a/.config/quickshell/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -33,7 +33,7 @@ Item { MaterialSymbol { fill: 0 - text: WeatherIcons.codeToName[WeatherService.data.wCode] + text: WeatherIcons.codeToName[Weather.data.wCode] iconSize: Appearance.font.pixelSize.large color: Appearance.colors.colOnLayer1 } @@ -42,7 +42,7 @@ Item { visible: true font.pixelSize: Appearance.font.pixelSize.large color: Appearance.colors.colOnLayer1 - text: WeatherService.data.temp + text: Weather.data.temp } } } diff --git a/.config/quickshell/modules/bar/weather/WeatherPopup.qml b/.config/quickshell/modules/bar/weather/WeatherPopup.qml index 0829bea9e..cda627455 100644 --- a/.config/quickshell/modules/bar/weather/WeatherPopup.qml +++ b/.config/quickshell/modules/bar/weather/WeatherPopup.qml @@ -34,7 +34,7 @@ Rectangle { } StyledText { - text: WeatherService.data.city + text: Weather.data.city font.pixelSize: Appearance.font.pixelSize.title font.family: Appearance.font.family.title color: Appearance.colors.colOnLayer0 @@ -52,42 +52,42 @@ Rectangle { WeatherCard { title: "UV Index" symbol: "wb_sunny" - value: WeatherService.data.uv + value: Weather.data.uv } WeatherCard { title: "Wind" symbol: "air" - value: `(${WeatherService.data.windDir}) ${WeatherService.data.wind}` + value: `(${Weather.data.windDir}) ${Weather.data.wind}` } WeatherCard { title: "Precipitation" symbol: "rainy_light" - value: WeatherService.data.precip + value: Weather.data.precip } WeatherCard { title: "Humidity" symbol: "humidity_low" - value: WeatherService.data.humidity + value: Weather.data.humidity } WeatherCard { title: "Visibility" symbol: "visibility" - value: WeatherService.data.visib + value: Weather.data.visib } WeatherCard { title: "Pressure" symbol: "readiness_score" - value: WeatherService.data.press + value: Weather.data.press } WeatherCard { title: "Sunrise" symbol: "wb_twilight" - value: WeatherService.data.sunrise + value: Weather.data.sunrise } WeatherCard { title: "Sunset" symbol: "bedtime" - value: WeatherService.data.sunset + value: Weather.data.sunset } } } diff --git a/.config/quickshell/services/WeatherService.qml b/.config/quickshell/services/Weather.qml similarity index 100% rename from .config/quickshell/services/WeatherService.qml rename to .config/quickshell/services/Weather.qml From 50cc371100bae79527c439514cc18886e7ec6ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Tue, 1 Jul 2025 13:19:24 +0300 Subject: [PATCH 13/22] chor(Weather): rename `show` to `enable` --- .config/quickshell/modules/bar/Bar.qml | 2 +- .config/quickshell/modules/common/Config.qml | 4 ++-- .config/quickshell/modules/settings/ServicesConfig.qml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index b88a89476..ce4a614ec 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -314,7 +314,7 @@ Scope { // Weather Loader { id: weatherLoader - active: Config.options.bar.weather.show + active: Config.options.bar.weather.enable anchors.left: middleSection.right anchors.margins: 10 sourceComponent: BarGroup { diff --git a/.config/quickshell/modules/common/Config.qml b/.config/quickshell/modules/common/Config.qml index 5e7b9bb3f..6df375828 100644 --- a/.config/quickshell/modules/common/Config.qml +++ b/.config/quickshell/modules/common/Config.qml @@ -123,11 +123,11 @@ Singleton { property int showNumberDelay: 300 // milliseconds } property JsonObject weather: JsonObject { - property bool show: true + property bool enable: true // gps based location property bool enableGPS: true // use if 'enableGPS' is false - property string city: "Istanbul" + property string city: "" // use uscs units // by default use metric (SI) units property bool useUSCS: false diff --git a/.config/quickshell/modules/settings/ServicesConfig.qml b/.config/quickshell/modules/settings/ServicesConfig.qml index 21064ac91..97d80a18a 100644 --- a/.config/quickshell/modules/settings/ServicesConfig.qml +++ b/.config/quickshell/modules/settings/ServicesConfig.qml @@ -141,10 +141,10 @@ ContentPage { ContentSection { title: "Weather" ConfigSwitch { - text: "Show" - checked: Config.options.bar.weather.show + text: "enable" + checked: Config.options.bar.weather.enable onCheckedChanged: { - Config.options.bar.weather.show = checked; + Config.options.bar.weather.enable = checked; } } } From fd6af822cd70bac253387892359c7f6a64fdbd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Tue, 1 Jul 2025 13:42:54 +0300 Subject: [PATCH 14/22] chore(Weather): make things more clear --- .config/quickshell/services/Weather.qml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.config/quickshell/services/Weather.qml b/.config/quickshell/services/Weather.qml index c4e8ac66f..e95453fdc 100644 --- a/.config/quickshell/services/Weather.qml +++ b/.config/quickshell/services/Weather.qml @@ -14,7 +14,7 @@ Singleton { readonly property int fetchInterval: Config.options.bar.weather.fetchInterval * 60 * 1000 readonly property string city: Config.options.bar.weather.city readonly property bool useUSCS: Config.options.bar.weather.useUSCS - readonly property bool gpsActive: Config.options.bar.weather.enableGPS + property bool gpsActive: Config.options.bar.weather.enableGPS property var location: ({ valid: false, @@ -130,15 +130,16 @@ Singleton { // if can't get initialized with valid location deactivate the GPS } else { root.gpsActive = root.location.valid ? true : false; + console.error("[WeatherService] Failed to get the GPS location."); } } onValidityChanged: { - if (!valid) { + if (!positionSource.valid) { positionSource.stop(); root.location.valid = false; root.gpsActive = false; - Quickshell.execDetached(["bash", "-c", `notify-send WeatherService 'Failed to load the GPS service. Using the fallback method instead.'`]); + Quickshell.execDetached(["bash", "-c", `notify-send WeatherService 'Can not find a GPS service. Using the fallback method instead.'`]); console.error("[WeatherService] Could not aquire a valid backend plugin."); } } From 2684bbae69a2b722f2b9f349da74afc5af24d549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Wed, 2 Jul 2025 15:52:24 +0300 Subject: [PATCH 15/22] refactor(WeatherBar): put in `barRightSide` --- .config/quickshell/modules/bar/Bar.qml | 41 +++++++++---------- .../modules/bar/weather/WeatherBar.qml | 7 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index ce4a614ec..1785e3179 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -85,7 +85,7 @@ Scope { } } } - + // Background shadow Loader { active: showBarBackground && Config.options.bar.cornerStyle === 1 @@ -105,7 +105,7 @@ Scope { color: showBarBackground ? Appearance.colors.colLayer0 : "transparent" radius: Config.options.bar.cornerStyle === 1 ? Appearance.rounding.windowRounding : 0 } - + MouseArea { // Left side | scroll to change brightness id: barLeftSideMouseArea anchors.left: parent.left @@ -203,8 +203,7 @@ Scope { anchors.centerIn: parent width: 19.5 height: 19.5 - source: Config.options.bar.topLeftIcon == 'distro' ? - SystemInfo.distroIcon : "spark-symbolic" + source: Config.options.bar.topLeftIcon == 'distro' ? SystemInfo.distroIcon : "spark-symbolic" } ColorOverlay { @@ -246,7 +245,9 @@ Scope { } } - VerticalBarSeparator {visible: Config.options?.bar.borderless} + VerticalBarSeparator { + visible: Config.options?.bar.borderless + } BarGroup { id: middleCenterGroup @@ -271,7 +272,9 @@ Scope { } } - VerticalBarSeparator {visible: Config.options?.bar.borderless} + VerticalBarSeparator { + visible: Config.options?.bar.borderless + } MouseArea { id: rightCenterGroup @@ -307,20 +310,7 @@ Scope { } VerticalBarSeparator { - visible: Config.options.bar.borderless - } - } - - // Weather - Loader { - id: weatherLoader - active: Config.options.bar.weather.enable - anchors.left: middleSection.right - anchors.margins: 10 - sourceComponent: BarGroup { - implicitHeight: Appearance.sizes.baseBarHeight - height: Appearance.sizes.barHeight - WeatherBar {} + visible: Config.options.bar.borderless && Config.options.bar.weather.enable } } @@ -330,7 +320,7 @@ Scope { anchors.right: parent.right implicitHeight: Appearance.sizes.baseBarHeight height: Appearance.sizes.barHeight - width: barRoot.width - (barLeftSideMouseArea.width + middleSection.width + weatherLoader.width) + width: (barRoot.width - middleSection.width) / 2 property bool hovered: false property real lastScrollX: 0 @@ -493,6 +483,15 @@ Scope { Item { Layout.fillWidth: true Layout.fillHeight: true + + // Weather + Loader { + active: Config.options.bar.weather.enable + sourceComponent: BarGroup { + implicitHeight: Appearance.sizes.baseBarHeight + WeatherBar {} + } + } } } } diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml index b879646ce..c0fda9641 100644 --- a/.config/quickshell/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -9,8 +9,8 @@ import QtQuick.Layouts Item { id: root - property real margin: 5 - implicitHeight: 32 + property real margin: 10 + implicitHeight: mouseArea.implicitHeight implicitWidth: mouseArea.implicitWidth + margin * 2 MouseArea { @@ -30,12 +30,12 @@ Item { RowLayout { id: rowLayout - MaterialSymbol { fill: 0 text: WeatherIcons.codeToName[Weather.data.wCode] iconSize: Appearance.font.pixelSize.large color: Appearance.colors.colOnLayer1 + Layout.alignment: Qt.AlignVCenter } StyledText { @@ -43,6 +43,7 @@ Item { font.pixelSize: Appearance.font.pixelSize.large color: Appearance.colors.colOnLayer1 text: Weather.data.temp + Layout.alignment: Qt.AlignVCenter } } } From 8b83b42eed0070f0bb96658f188058c0e63b5d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20A=2E=20Tekeo=C4=9Flu?= <55619655+tekeoglan@users.noreply.github.com> Date: Thu, 3 Jul 2025 10:00:08 +0300 Subject: [PATCH 16/22] chore(Weather): use generic city name for default value --- .config/quickshell/services/Weather.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/quickshell/services/Weather.qml b/.config/quickshell/services/Weather.qml index e95453fdc..eb1a00af4 100644 --- a/.config/quickshell/services/Weather.qml +++ b/.config/quickshell/services/Weather.qml @@ -45,7 +45,7 @@ Singleton { temp.sunset = data?.astronomy?.sunset || "0.0"; temp.windDir = data?.current?.winddir16Point || "N"; temp.wCode = data?.current?.weatherCode || "113"; - temp.city = data?.location?.areaName[0].value || "Istanbul"; + temp.city = data?.location?.areaName[0]?.value || "City"; temp.temp = ""; if (root.useUSCS) { temp.wind = (data?.current?.windspeedMiles || 0) + " mph"; From f6f7ac19fda88aeac57eb7fc2834b2b609b83fe2 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 5 Jul 2025 11:32:59 +0200 Subject: [PATCH 17/22] fix bar font size --- .config/quickshell/modules/bar/Bar.qml | 14 +++++++------- .../quickshell/modules/bar/weather/WeatherBar.qml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index 1785e3179..c99629cc7 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -483,14 +483,14 @@ Scope { Item { Layout.fillWidth: true Layout.fillHeight: true + } - // Weather - Loader { - active: Config.options.bar.weather.enable - sourceComponent: BarGroup { - implicitHeight: Appearance.sizes.baseBarHeight - WeatherBar {} - } + // Weather + Loader { + active: Config.options.bar.weather.enable + sourceComponent: BarGroup { + implicitHeight: Appearance.sizes.baseBarHeight + WeatherBar {} } } } diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml index c0fda9641..26804308b 100644 --- a/.config/quickshell/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -40,7 +40,7 @@ Item { StyledText { visible: true - font.pixelSize: Appearance.font.pixelSize.large + font.pixelSize: Appearance.font.pixelSize.small color: Appearance.colors.colOnLayer1 text: Weather.data.temp Layout.alignment: Qt.AlignVCenter From 9043440c8d664ccca4bd2ad433a42b6f705f50b6 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 5 Jul 2025 11:37:51 +0200 Subject: [PATCH 18/22] fix spacing --- .config/quickshell/modules/bar/Bar.qml | 2 ++ .config/quickshell/modules/bar/weather/WeatherPopup.qml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index c99629cc7..27b188d02 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -487,6 +487,8 @@ Scope { // Weather Loader { + Layout.leftMargin: 8 + Layout.fillHeight: true active: Config.options.bar.weather.enable sourceComponent: BarGroup { implicitHeight: Appearance.sizes.baseBarHeight diff --git a/.config/quickshell/modules/bar/weather/WeatherPopup.qml b/.config/quickshell/modules/bar/weather/WeatherPopup.qml index cda627455..b39fffd37 100644 --- a/.config/quickshell/modules/bar/weather/WeatherPopup.qml +++ b/.config/quickshell/modules/bar/weather/WeatherPopup.qml @@ -12,6 +12,8 @@ Rectangle { implicitHeight: columnLayout.implicitHeight + margin * 2 color: Appearance.colors.colLayer0 radius: Appearance.rounding.small + border.width: 1 + border.color: Appearance.m3colors.m3outlineVariant clip: true ColumnLayout { From ba8c737543f45e4bdec887772a595a4ba59b091c Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 5 Jul 2025 11:38:07 +0200 Subject: [PATCH 19/22] weather bar: remove unnecessary nested item --- .../modules/bar/weather/WeatherBar.qml | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml index 26804308b..ccd27a1b8 100644 --- a/.config/quickshell/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -7,44 +7,37 @@ import Quickshell import QtQuick import QtQuick.Layouts -Item { +MouseArea { id: root property real margin: 10 - implicitHeight: mouseArea.implicitHeight - implicitWidth: mouseArea.implicitWidth + margin * 2 + property bool hovered: false + implicitWidth: rowLayout.implicitWidth + margin * 2 + implicitHeight: rowLayout.implicitHeight - MouseArea { - id: mouseArea - property bool hovered: false - implicitWidth: rowLayout.implicitWidth - implicitHeight: rowLayout.implicitHeight - anchors.centerIn: root + hoverEnabled: true + onEntered: { + popupLoader.item.visible = true; + } + onExited: { + popupLoader.item.visible = false; + } - hoverEnabled: true - onEntered: { - popupLoader.item.visible = true; - } - onExited: { - popupLoader.item.visible = false; + RowLayout { + id: rowLayout + MaterialSymbol { + fill: 0 + text: WeatherIcons.codeToName[Weather.data.wCode] + iconSize: Appearance.font.pixelSize.large + color: Appearance.colors.colOnLayer1 + Layout.alignment: Qt.AlignVCenter } - RowLayout { - id: rowLayout - MaterialSymbol { - fill: 0 - text: WeatherIcons.codeToName[Weather.data.wCode] - iconSize: Appearance.font.pixelSize.large - color: Appearance.colors.colOnLayer1 - Layout.alignment: Qt.AlignVCenter - } - - StyledText { - visible: true - font.pixelSize: Appearance.font.pixelSize.small - color: Appearance.colors.colOnLayer1 - text: Weather.data.temp - Layout.alignment: Qt.AlignVCenter - } + StyledText { + visible: true + font.pixelSize: Appearance.font.pixelSize.small + color: Appearance.colors.colOnLayer1 + text: Weather.data.temp + Layout.alignment: Qt.AlignVCenter } } From 41a8bfa097d4c1ac1b575fd109416926f8171805 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 5 Jul 2025 11:44:28 +0200 Subject: [PATCH 20/22] bar: weather popup: use loader properly --- .config/quickshell/modules/bar/weather/WeatherBar.qml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml index ccd27a1b8..f0fa0cfc5 100644 --- a/.config/quickshell/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -15,12 +15,6 @@ MouseArea { implicitHeight: rowLayout.implicitHeight hoverEnabled: true - onEntered: { - popupLoader.item.visible = true; - } - onExited: { - popupLoader.item.visible = false; - } RowLayout { id: rowLayout @@ -43,10 +37,11 @@ MouseArea { LazyLoader { id: popupLoader - active: true + active: root.containsMouse component: PopupWindow { id: popupWindow + visible: true implicitWidth: weatherPopup.implicitWidth implicitHeight: weatherPopup.implicitHeight anchor.item: root From 8dccac4cda7b0a8c7ab2eda762b27692d7b10568 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 5 Jul 2025 11:45:27 +0200 Subject: [PATCH 21/22] bar: weather: disable by default --- .config/quickshell/modules/common/Config.qml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.config/quickshell/modules/common/Config.qml b/.config/quickshell/modules/common/Config.qml index 2b69c9c4f..594dbefd5 100644 --- a/.config/quickshell/modules/common/Config.qml +++ b/.config/quickshell/modules/common/Config.qml @@ -123,16 +123,11 @@ Singleton { property int showNumberDelay: 300 // milliseconds } property JsonObject weather: JsonObject { - property bool enable: true - // gps based location - property bool enableGPS: true - // use if 'enableGPS' is false - property string city: "" - // use uscs units - // by default use metric (SI) units - property bool useUSCS: false - // in minutes - property int fetchInterval: 10 + property bool enable: false + property bool enableGPS: true // gps based location + property string city: "" // When 'enableGPS' is false + property bool useUSCS: false // Instead of metric (SI) units + property int fetchInterval: 10 // minutes } } From e843164f60221e9c4dbb2043076b4e3f8e4d2429 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 5 Jul 2025 11:50:26 +0200 Subject: [PATCH 22/22] bar: weather: fix alignment --- .config/quickshell/modules/bar/weather/WeatherBar.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.config/quickshell/modules/bar/weather/WeatherBar.qml b/.config/quickshell/modules/bar/weather/WeatherBar.qml index f0fa0cfc5..5d54562d7 100644 --- a/.config/quickshell/modules/bar/weather/WeatherBar.qml +++ b/.config/quickshell/modules/bar/weather/WeatherBar.qml @@ -18,6 +18,8 @@ MouseArea { RowLayout { id: rowLayout + anchors.centerIn: parent + MaterialSymbol { fill: 0 text: WeatherIcons.codeToName[Weather.data.wCode]