forked from Shinonome/dots-hyprland
move weather icons to Icons
Co-Authored-By: Vague Syntax <173799252+vaguesyntax@users.noreply.github.com>
This commit is contained in:
@@ -30,7 +30,7 @@ MouseArea {
|
|||||||
|
|
||||||
MaterialSymbol {
|
MaterialSymbol {
|
||||||
fill: 0
|
fill: 0
|
||||||
text: WeatherIcons.codeToName[Weather.data.wCode] ?? "cloud"
|
text: Icons.getWeatherIcon(Weather.data.wCode) ?? "cloud"
|
||||||
iconSize: Appearance.font.pixelSize.large
|
iconSize: Appearance.font.pixelSize.large
|
||||||
color: Appearance.colors.colOnLayer1
|
color: Appearance.colors.colOnLayer1
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
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"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -20,4 +20,63 @@ Singleton {
|
|||||||
return "keyboard";
|
return "keyboard";
|
||||||
return "bluetooth";
|
return "bluetooth";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property var weatherIconMap: ({
|
||||||
|
"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"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function getWeatherIcon(code) {
|
||||||
|
const key = String(code)
|
||||||
|
if (weatherIconMap.hasOwnProperty(key)) {
|
||||||
|
return weatherIconMap[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user