diff --git a/weather@mockturtl/files/weather@mockturtl/3.8/weather-applet.js b/weather@mockturtl/files/weather@mockturtl/3.8/weather-applet.js index 19e63fde8ab..473795980c9 100644 --- a/weather@mockturtl/files/weather@mockturtl/3.8/weather-applet.js +++ b/weather@mockturtl/files/weather@mockturtl/3.8/weather-applet.js @@ -18808,6 +18808,7 @@ class UIForecasts { const { PolicyType } = imports.gi.Gtk; const { ScrollDirection } = imports.gi.Clutter; const { addTween } = imports.ui.tweener; +const { Tooltip: uiHourlyForecasts_Tooltip } = imports.ui.tooltips; const { BoxLayout: uiHourlyForecasts_BoxLayout, Side, ScrollView, Icon: uiHourlyForecasts_Icon, Align: uiHourlyForecasts_Align } = imports.gi.St; class UIHourlyForecasts { get Toggled() { @@ -18944,6 +18945,7 @@ class UIHourlyForecasts { } } Display(forecasts, config, tz) { + var _a; if (!forecasts || !this.hourlyForecasts) return true; if (this.hourlyForecasts.length > forecasts.length) { @@ -18968,6 +18970,7 @@ class UIHourlyForecasts { ui.Hour.text = GetHoursMinutes(hour.date, config._show24Hours, tz, config._shortHourlyTime); ui.Temperature.text = temp ? `${temp}°` : ""; ui.Icon.icon_name = (config._useCustomMenuIcons) ? hour.condition.customIcon : WeatherIconSafely(hour.condition.icons, config.IconType); + (_a = ui.SummaryTooltip) === null || _a === void 0 ? void 0 : _a.set_text(hour.condition.main); ui.PrecipPercent.text = this.GeneratePrecipitationChance(hour.precipitation); ui.PrecipVolume.text = this.GeneratePrecipitationVolume(hour.precipitation, config); } @@ -19081,11 +19084,10 @@ class UIHourlyForecasts { const iconWidth = ui.Icon.get_preferred_width(-1)[1]; const percipVolumeWidth = ui.PrecipVolume.get_preferred_width(-1)[1]; const percipChanceWidth = ui.PrecipPercent.get_preferred_width(-1)[1]; - const summaryWidth = ui.Summary.get_preferred_width(-1)[1]; const temperatureWidth = ui.Temperature.get_preferred_width(-1)[1]; const precipitationWidth = ui.PrecipPercent.get_preferred_width(-1)[1]; if (precipitationWidth == null || temperatureWidth == null || - hourWidth == null || iconWidth == null || summaryWidth == null || + hourWidth == null || iconWidth == null || percipVolumeWidth == null || percipChanceWidth == null) continue; if (requiredWidth < hourWidth) @@ -19119,7 +19121,7 @@ class UIHourlyForecasts { grid.attach(forecastContainer, 1, 1, 1, 1); this.container.add(gridActor, { expand: true, x_fill: true, y_fill: true }); for (let index = 0; index < hours; index++) { - const box = new uiHourlyForecasts_BoxLayout({ vertical: true, style_class: "hourly-box-item" }); + const box = new uiHourlyForecasts_BoxLayout({ vertical: true, style_class: "hourly-box-item", reactive: true }); this.hourlyContainers.push(box); this.hourlyForecasts.push({ Hour: Label({ @@ -19132,9 +19134,9 @@ class UIHourlyForecasts { icon_type: config.IconType, icon_size: 24, icon_name: APPLET_ICON, - style_class: "hourly-icon" + style_class: "hourly-icon", + reactive: true }), - Summary: Label({ text: _(ELLIPSIS), style_class: "hourly-data" }), PrecipPercent: Label({ text: " ", style_class: "hourly-data", @@ -19154,14 +19156,16 @@ class UIHourlyForecasts { x_align: imports.gi.Clutter.ActorAlign.CENTER, }) }); - this.hourlyForecasts[index].PrecipVolume.clutter_text.set_line_wrap(true); - box.add_child(this.hourlyForecasts[index].Hour); - box.add_child(this.hourlyForecasts[index].Icon); - box.add_child(this.hourlyForecasts[index].Temperature); + const hourlySet = this.hourlyForecasts[index]; + hourlySet.PrecipVolume.clutter_text.set_line_wrap(true); + box.add_child(hourlySet.Hour); + box.add_child(hourlySet.Icon); + box.add_child(hourlySet.Temperature); if ((_a = this.app.Provider) === null || _a === void 0 ? void 0 : _a.supportHourlyPrecipChance) - box.add_child(this.hourlyForecasts[index].PrecipPercent); + box.add_child(hourlySet.PrecipPercent); if ((_b = this.app.Provider) === null || _b === void 0 ? void 0 : _b.supportHourlyPrecipVolume) - box.add_child(this.hourlyForecasts[index].PrecipVolume); + box.add_child(hourlySet.PrecipVolume); + hourlySet.SummaryTooltip = new uiHourlyForecasts_Tooltip(hourlySet.Icon, _(ELLIPSIS)); forecastContainer.add(box, { x_fill: true, x_align: uiHourlyForecasts_Align.MIDDLE, diff --git a/weather@mockturtl/install.sh b/weather@mockturtl/install.sh index d1ea15b32f6..2f6b7748c8f 100755 --- a/weather@mockturtl/install.sh +++ b/weather@mockturtl/install.sh @@ -47,7 +47,7 @@ if [ "$errors" -eq 0 ]; then cp --verbose files/weather@mockturtl/${VERSION}/weather-applet.js ~/.local/share/cinnamon/applets/weather\@mockturtl/${VERSION}/weather-applet.js echo "Restarting Cinnamon..." # Restart Cinnamon in the background without terminating the script - nohup bash -c "export DISPLAY=:0; cinnamon --replace" > /dev/null 2>&1 & + cinnamon-dbus-command RestartCinnamon 0 if $DEBUG; then #cinnamon-looking-glass --logs & #TODO create command line parameter in Looking Glass to open logs tab cinnamon-looking-glass & diff --git a/weather@mockturtl/src/3_8/ui_elements/uiHourlyForecasts.ts b/weather@mockturtl/src/3_8/ui_elements/uiHourlyForecasts.ts index 1fd8295b34a..e2cd4639999 100644 --- a/weather@mockturtl/src/3_8/ui_elements/uiHourlyForecasts.ts +++ b/weather@mockturtl/src/3_8/ui_elements/uiHourlyForecasts.ts @@ -9,6 +9,7 @@ import { GetHoursMinutes, TempToUserConfig, _, MillimeterToUserUnits, NotEmpty, const { PolicyType } = imports.gi.Gtk; const { ScrollDirection } = imports.gi.Clutter; const { addTween } = imports.ui.tweener; +const { Tooltip } = imports.ui.tooltips; const { BoxLayout, Side, ScrollView, Icon, Align } = imports.gi.St; export class UIHourlyForecasts { @@ -177,7 +178,7 @@ export class UIHourlyForecasts { ui.Hour.text = GetHoursMinutes(hour.date, config._show24Hours, tz, config._shortHourlyTime); ui.Temperature.text = temp ? `${temp}°` : ""; ui.Icon.icon_name = (config._useCustomMenuIcons) ? hour.condition.customIcon : WeatherIconSafely(hour.condition.icons, config.IconType); - // ui.Summary.text = hour.condition.main; + ui.SummaryTooltip?.set_text(hour.condition.main); ui.PrecipPercent.text = this.GeneratePrecipitationChance(hour.precipitation); ui.PrecipVolume.text = this.GeneratePrecipitationVolume(hour.precipitation, config); } @@ -334,18 +335,16 @@ export class UIHourlyForecasts { const iconWidth = ui.Icon.get_preferred_width(-1)[1]; const percipVolumeWidth = ui.PrecipVolume.get_preferred_width(-1)[1]; const percipChanceWidth = ui.PrecipPercent.get_preferred_width(-1)[1]; - const summaryWidth = ui.Summary.get_preferred_width(-1)[1]; const temperatureWidth = ui.Temperature.get_preferred_width(-1)[1]; const precipitationWidth = ui.PrecipPercent.get_preferred_width(-1)[1]; if (precipitationWidth == null || temperatureWidth == null || - hourWidth == null || iconWidth == null || summaryWidth == null || + hourWidth == null || iconWidth == null || percipVolumeWidth == null || percipChanceWidth == null) continue; if (requiredWidth < hourWidth) requiredWidth = hourWidth; if (requiredWidth < iconWidth) requiredWidth = iconWidth; - // if (requiredWidth < summaryWidth) requiredWidth = summaryWidth; if (requiredWidth < temperatureWidth) requiredWidth = temperatureWidth; if (requiredWidth < precipitationWidth) requiredWidth = precipitationWidth; } @@ -376,10 +375,10 @@ export class UIHourlyForecasts { this.container.add(gridActor, {expand: true, x_fill: true, y_fill: true}); for (let index = 0; index < hours; index++) { - const box = new BoxLayout({ vertical: true, style_class: "hourly-box-item" }); + const box = new BoxLayout({ vertical: true, style_class: "hourly-box-item", reactive: true }); this.hourlyContainers.push(box); - this.hourlyForecasts.push({ + this.hourlyForecasts.push({ // Override color on light theme for grey text Hour: Label({ text: "Hour", @@ -391,9 +390,9 @@ export class UIHourlyForecasts { icon_type: config.IconType, icon_size: 24, icon_name: APPLET_ICON, - style_class: "hourly-icon" + style_class: "hourly-icon", + reactive: true }), - Summary: Label({ text: _(ELLIPSIS), style_class: "hourly-data" }), PrecipPercent: Label({ text: " ", style_class: "hourly-data", @@ -412,16 +411,20 @@ export class UIHourlyForecasts { style: `padding-top: ${this.tempGraphHeight}px`, x_align: imports.gi.Clutter.ActorAlign.CENTER, }) - }) + }); + + const hourlySet = this.hourlyForecasts[index]; - this.hourlyForecasts[index].PrecipVolume.clutter_text.set_line_wrap(true); - box.add_child(this.hourlyForecasts[index].Hour); - box.add_child(this.hourlyForecasts[index].Icon,); - box.add_child(this.hourlyForecasts[index].Temperature); + hourlySet.PrecipVolume.clutter_text.set_line_wrap(true); + box.add_child(hourlySet.Hour); + box.add_child(hourlySet.Icon,); + box.add_child(hourlySet.Temperature); if (this.app.Provider?.supportHourlyPrecipChance) - box.add_child(this.hourlyForecasts[index].PrecipPercent); + box.add_child(hourlySet.PrecipPercent); if (this.app.Provider?.supportHourlyPrecipVolume) - box.add_child(this.hourlyForecasts[index].PrecipVolume); + box.add_child(hourlySet.PrecipVolume); + + hourlySet.SummaryTooltip = new Tooltip(hourlySet.Icon, _(ELLIPSIS)) forecastContainer.add(box, { x_fill: true, @@ -567,7 +570,7 @@ export class UIHourlyForecasts { interface HourlyForecastUI { Icon: imports.gi.St.Icon, Hour: imports.gi.St.Label, - Summary: imports.gi.St.Label, + SummaryTooltip?: imports.ui.tooltips.Tooltip, PrecipVolume: imports.gi.St.Label, Temperature: imports.gi.St.Label, PrecipPercent: imports.gi.St.Label