Skip to content

Commit

Permalink
fix: inverse logic
Browse files Browse the repository at this point in the history
I only need to add a prefix when it is not day.

Signed-off-by: André Jaenisch <[email protected]>
  • Loading branch information
Ryuno-Ki committed Oct 24, 2024
1 parent 6f4c1de commit 449f2db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions weather-api-widget/weather.lua
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ local function worker(user_args)
layout = wibox.layout.flex.horizontal,
update = function(self, weather)
local day_night_extension = ""
if weather.is_day then
if not weather.is_day then
day_night_extension = "-night"
end

Expand All @@ -322,7 +322,7 @@ local function worker(user_args)
-- Free plan allows forecast for up to three days, each with hours
if i > 3 then break end
local day_night_extension = ""
if day.is_day then
if not day.is_day then
day_night_extension = "-night"
end

Expand Down Expand Up @@ -591,7 +591,7 @@ local function worker(user_args)
local result = json.decode(stdout)

local day_night_extension = ""
if result.current.is_day then
if not result.current.is_day then
day_night_extension = "-night"
end

Expand Down

5 comments on commit 449f2db

@xfzv
Copy link

@xfzv xfzv commented on 449f2db Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ryuno-Ki

For some reason, night icons are displayed during the day on my end (and probably the other way around but I haven't seen what occurs at night yet). Reverting this commit solves the issue:

-    if not weather.is_day then
+    if weather.is_day then

-    if not day.is_day then
+    if day.is_day then

-    if not result.current.is_day then
+    if result.current.is_day then

This also works while keeping the changes:

-    day_night_extension = "-night"
+    day_night_extension = ""

I checked my icons and they seem fine, all -night variants aren't day variants and vice versa.

Any idea?

@Ryuno-Ki
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me 😮

is_day is either 1 or 0.
weather-api-widget/icons/weather-underground-icons only has icons with -night suffixed, so if not 1 then add "-night" end sounds like the right logic to me.

@xfzv
Copy link

@xfzv xfzv commented on 449f2db Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to mention that the issue is about the forecast icons, not the current condition icon (which is fine). I'm using

icons = "weather-underground-icons",
icons_extension = ".png",
show_daily_forecast = true,

@Ryuno-Ki
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed it there, too. Odd.
I'll take a look into it once the other PR got merged.
Thanks for reporting! (I hope I can rediscover this conversation - mind to open an issue?)

@xfzv
Copy link

@xfzv xfzv commented on 449f2db Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ryuno-Ki streetturtle#459

Keep up the good work!

Please sign in to comment.