summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsubh <subh@subh.space>2026-03-31 07:35:08 +0530
committersubh <subh@subh.space>2026-03-31 07:35:08 +0530
commit0203dd4b8d45c663356f797c11be17fdec6f22f2 (patch)
tree7d214feb3205b9bba80b5510e41191891aa59aeb
parent218e74f316f248b090659fc79b3f96fc7b302db8 (diff)
changed the weather module for quickshell
-rwxr-xr-xinstall.sh87
-rw-r--r--quickshell/shell.qml69
-rwxr-xr-xscripts/weather.py76
3 files changed, 126 insertions, 106 deletions
diff --git a/install.sh b/install.sh
deleted file mode 100755
index d246341..0000000
--- a/install.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-
-
-sudo pacman -Syu
-
-echo "[*] Installing core packages"
-sudo pacman -S NetworkManager dunst ly firewalld discord libnotify fastfetch ttf-iosevka-nerd quickshell fzf hyprlock hyprshot exa fd ripgrep bat pcmanfm make cmake hyprland wayland pipewire ghostty swww rofi pavucontrol pulseaudio mpv feh maim dbus wl-clipboard tmux docker docker-compose rust go cargo uv python3 doas openvpn net-tools 7zip zip netcat socat wget curl spotify zoxide octopi cuda nvidia-settings nvidia-utils opencl-nvidia bore grex protonvpn keepassxc pass zathura zathura-pdf-mupdf
-
-echo "[*] Building yay"
-git clone https://aur.archlinux.org/yay.git && cd yay && sudo makepkg -si
-
-echo "[*] Building chaotic aur"
-wget -q -O chaotic-AUR-installer.bash https://raw.githubusercontent.com/SharafatKarim/chaotic-AUR-installer/main/install.bash && sudo bash chaotic-AUR-installer.bash && rm chaotic-AUR-installer.bash
-
-sudo pacman -Sy chaotic-keyring
-
-echo "[*] Installing yay packges"
-yay -S zen-browser-bin xwaylandvideobridge croc ttyd stremio satty
-
-
-echo "[*] Adding the blackarch repo"
-mkdir -p $HOME/Downloads
-sudo curl -o $HOME/Downloads/strap.sh https://blackarch.org/strap.sh
-sudo chmod +x $HOME/Downloads/strap.sh
-sudo $HOME/Downloads/strap.sh
-sudo pacman -Syu
-
-
-echo "[*] Downloading Wallpapers"
-curl -LJ https://github.com/JaKooLit/Wallpaper-Bank/archive/refs/heads/main.zip -o $HOME/Downloads/main.zip 2>&1
-unzip $HOME/Downloads/main.zip -d $HOME
-
-echo "[*] Setting up rofi"
-mkdir -p ~/.config/rofi
-cp rofi/* ~/.config/rofi
-
-echo "[*] Setting up dunst"
-mkdir -p ~/.config/dunst
-cp dunst/* ~/.config/dunst/
-
-echo "[*] Setting up tmux"
-mkdir -p ~/.config/tmux
-cp tmux/tmux.conf ~/.config/tmux
-
-echo "[*] Setting up ghostty"
-cp -r ghostty ~/.config/
-
-echo "[*] Setting up hyprlock"
-cp -r hyprlock ~/.config/
-
-echo "[*] Setting up hyprland"
-mkdir -p ~/.config/hypr
-cp hyprland/* ~/.config/hypr
-
-echo "[*] Setting up quickshell"
-cp -r quickshell ~/.config/
-
-echo "[*] Setting up ly"
-sudo mkdir -p /etc/ly
-sudo cp ly/config.ini /etc/ly/config.ini
-
-
-echo "[*] Setting up desktop manager"
-sudo systemctl disable getty@tty2.service
-sudo systemctl enable ly@tty2.service
-
-
-echo "[*] Setting up firewall"
-sudo systemctl enable firewalld
-
-
-echo "[*] Reboot Required. Reboot Now? [Y/n]"
-read -r bool
-
-case "$bool" in
- y|Y)
- echo "[*] Rebooting..."
- systemctl reboot
- ;;
- *)
- exit 0
- ;;
-esac
-
-
-
-
diff --git a/quickshell/shell.qml b/quickshell/shell.qml
index bc4678a..1857c55 100644
--- a/quickshell/shell.qml
+++ b/quickshell/shell.qml
@@ -17,7 +17,7 @@ ShellRoot {
property color colRed: "#f38ba8" // Catppuccin Red
property color colYellow: "#f9e2af" // Catppuccin Yellow
property color colBlue: "#89b4fa" // Catppuccin Blue
-
+ property color colGreen: "#A3BE8C"
// Font
property string fontFamily: "Iosevka Nerd Font Propo"
property int fontSize: 16
@@ -43,14 +43,14 @@ ShellRoot {
property int notificationCount: 0
- property string weatherTemp: "0"
- property string weatherIcon: ""
- property string weatherDesc: ""
property var lastCpuIdle: 0
property var lastCpuTotal: 0
-
-
+ property string weatherIcon: " "
+ property string weatherTemp: "--°C"
+ property string weatherPrecip: ""
+ property string weatherWind: ""
+
function getWeatherIcon(desc) {
if (!desc) return "❓";
var hour = new Date().getHours();
@@ -189,22 +189,23 @@ ShellRoot {
// Weather
Process {
id: weatherProc
- command: ["sh", "-c", "curl -s 'https://wttr.in/prayagraj?format=j1' | jq -r '.current_condition[] | [.weatherDesc[0].value, .FeelsLikeC + \"°C\"] | join(\"|\")'"]
+ // Call your python script directly
+ command: ["python3", "/opt/scripts/weather.py"]
+
stdout: SplitParser {
onRead: data => {
if (!data || data.trim() === "") return
- var parts = data.trim().split('|')
- if (parts.length >= 2) {
- weatherDesc = parts[0]
+ var parts = data.trim().split(/\s+/)
+ if (parts.length >= 3) {
+ weatherIcon = parts[0]
weatherTemp = parts[1]
-
- weatherIcon = getWeatherIcon(weatherDesc.toLowerCase())
+ weatherPrecip = parts[2] + " " + parts[3] // Icon + %
}
}
- }
- Component.onCompleted: running = true
+
}
-
+ Component.onCompleted: running = true
+}
// Disk usage
Process {
id: diskProc
@@ -281,7 +282,7 @@ ShellRoot {
}
}
// Weather Timer
- Timer { interval: 1800000; running: true; repeat: true; onTriggered: weatherProc.running = true }
+ Timer { interval: 3600000; running: true; repeat: true; onTriggered: weatherProc.running = true }
Connections {
target: Hyprland
@@ -364,13 +365,42 @@ ShellRoot {
text: activeWindow; color: root.colPurple; font.pixelSize: root.fontSize; font.family: root.fontFamily; font.bold: true
Layout.fillWidth: true; Layout.leftMargin: 8; elide: Text.ElideRight; maximumLineCount: 1
}
+ RowLayout {
+ id: weatherRow
+ spacing: 10
+
+ Text {
+ text: weatherIcon
+ color: root.colYellow
+ font.pixelSize: 18
+ font.family: root.fontFamily
+ font.bold: true
+ }
+
+ Text {
+ text: weatherTemp
+ font.family: root.fontFamily
+ font.pixelSize: root.fontSize
+ color: root.colYellow
+ font.bold: true
+ }
+ Text {
+ text: weatherPrecip
+ font.family: root.fontFamily
+ font.pixelSize: root.fontSize
+ color: root.colGreen
+ font.bold: true
+ Layout.rightMargin: 8
+ }
+
+ }
+
+ Rectangle { Layout.preferredWidth: 1; Layout.preferredHeight: 16; Layout.rightMargin: 8; color: root.colMuted }
// System Stats (Right Side)
Text { text: "󰣇 " + kernelVersion; color: root.colCyan; font.pixelSize: root.fontSize; font.family: root.fontFamily; font.bold: true; Layout.rightMargin: 8 }
Rectangle { Layout.preferredWidth: 1; Layout.preferredHeight: 16; Layout.rightMargin: 8; color: root.colMuted }
- Text { text: weatherIcon + weatherTemp; color: root.colYellow; font.pixelSize: root.fontSize; font.family: root.fontFamily; font.bold: true; Layout.rightMargin: 8 }
- Rectangle { Layout.preferredWidth: 1; Layout.preferredHeight: 16; Layout.rightMargin: 8; color: root.colMuted }
Text { text: " " + cpuTemp; color: tempColor; font.pixelSize: root.fontSize; font.family: root.fontFamily; font.bold: true; Layout.rightMargin: 8 }
Rectangle { Layout.preferredWidth: 1; Layout.preferredHeight: 16; Layout.rightMargin: 8; color: root.colMuted }
@@ -419,6 +449,7 @@ ShellRoot {
onTriggered: clockText.text = Qt.formatDateTime(new Date(), "ddd, MMM dd - HH:mm:ss")
}
}
+
RowLayout {
id: notifRow
visible: root.notificationCount > 0
@@ -452,8 +483,8 @@ ShellRoot {
}
}
}
- Item { width: 8 }
+ Item { width: 8 }
}
}
}
diff --git a/scripts/weather.py b/scripts/weather.py
new file mode 100755
index 0000000..0c2af7b
--- /dev/null
+++ b/scripts/weather.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+
+import requests
+import os
+import json
+from dotenv import load_dotenv
+
+def getWeatherIcon(isDayTime: bool, weatherDescription: str):
+ if weatherDescription in ["CLEAR", "MOSTLY_CLEAR"]:
+ if isDayTime:
+ return " "
+ else:
+ return " "
+ if weatherDescription in ["PARTLY_CLOUDY"]:
+ if isDayTime:
+ return " "
+ else:
+ return " "
+ if weatherDescription in ["CLOUDY", "MOSTLY_CLOUDY"]:
+ return " "
+ if weatherDescription in ["LIGHT_RAIN", "LIGHT_TO_MODERATE_RAIN","LIGHT_RAIN_SHOWERS"]:
+ if isDayTime:
+ return " "
+ else:
+ return " "
+ if weatherDescription in ["RAIN", "RAIN_SHOWERS", "HEAVY_RAIN", "HEAVY_RAIN_SHOWERS", "MODERATE_TO_HEAVY_RAIN", "RAIN_PERIODICALLY_HEAVY"]:
+ return " "
+ if weatherDescription in ["SNOW", "LIGHT_SNOW", "HEAVY_SNOW", "SNOW_SHOWERS", "LIGHT_SNOW_SHOWERS", "HEAVY_SNOW_SHOWERS", "SNOWSTORM", "BLOWING_SNOW", "RAIN_AND_SNOW", "HAIL"]:
+ return " "
+ if weatherDescription in ["LIGHT_THUNDERSTORM_RAIN"]:
+ if isDayTime:
+ return " "
+ else:
+ return " "
+
+ if weatherDescription in ["THUNDERSHOWER", "SCATTERED_THUNDERSTORMS", "THUNDERSTORM", "HEAVY_THUNDERSTORM"]:
+ return " "
+
+ if weatherDescription in ["WINDY"]:
+ if isDayTime:
+ return " "
+ else:
+ return " "
+
+ if weatherDescription in ["FOG","HAZE","DUST","MIST","SMOKE"]:
+ if isDay:
+ return " "
+ else:
+ return " "
+
+ return "󰖐 "
+
+
+url = "https://weather.googleapis.com/v1/currentConditions:lookup"
+lat = "25.4448"
+long = "81.8432"
+
+load_dotenv()
+params = {
+ "key":os.getenv("API_KEY"),
+ "location.latitude":lat,
+ "location.longitude": long
+ }
+
+
+response = requests.get(url, params=params)
+jsonDump = json.loads(response.text)
+currentTemperature = jsonDump["temperature"]["degrees"]
+weatherDescription = jsonDump["weatherCondition"]["type"]
+isDaytime = jsonDump["isDaytime"]
+precipitation = jsonDump["precipitation"]["probability"]["percent"]
+
+
+weatherIcon = getWeatherIcon(isDaytime, weatherDescription)
+print(weatherIcon, f"{currentTemperature}°C",f" {precipitation}%")
+