diff --git a/dots/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml b/dots/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml index 66923834d..1fcde7176 100644 --- a/dots/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml +++ b/dots/.config/quickshell/ii/modules/bar/weather/WeatherBar.qml @@ -30,7 +30,7 @@ MouseArea { MaterialSymbol { fill: 0 - text: WeatherIcons.codeToName[Weather.data.wCode] ?? "cloud" + text: Icons.getWeatherIcon(Weather.data.wCode) ?? "cloud" iconSize: Appearance.font.pixelSize.large color: Appearance.colors.colOnLayer1 Layout.alignment: Qt.AlignVCenter diff --git a/dots/.config/quickshell/ii/modules/bar/weather/WeatherIcons.qml b/dots/.config/quickshell/ii/modules/bar/weather/WeatherIcons.qml deleted file mode 100644 index bd74d4e17..000000000 --- a/dots/.config/quickshell/ii/modules/bar/weather/WeatherIcons.qml +++ /dev/null @@ -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" - }) -} diff --git a/dots/.config/quickshell/ii/modules/common/Icons.qml b/dots/.config/quickshell/ii/modules/common/Icons.qml index 454aea11e..9858d2963 100644 --- a/dots/.config/quickshell/ii/modules/common/Icons.qml +++ b/dots/.config/quickshell/ii/modules/common/Icons.qml @@ -20,4 +20,63 @@ Singleton { return "keyboard"; 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] + } + } }