polybar / polybar-scripts

This is a community project. We write and collect scripts for polybar!
The Unlicense
2.48k stars 340 forks source link

weather fullfeatured #90

Closed ycf83 closed 6 years ago

ycf83 commented 6 years ago

hi , i use your script weather full, it's very good, easy to use , but i get wrong information about the next sunrise or sunset , i don't know way, weather information is good .

x70b1 commented 6 years ago

Could you say what values you get and what you expect?

ycf83 commented 6 years ago

i don't get the same time for sunrise or sunset like on openweathermap.org , for sunrise it's always show 11h16 and it's wrong it's should be 6:50 AM for example

x70b1 commented 6 years ago

What is your CITY="" var?

ycf83 commented 6 years ago

CITY="2507480" UNITS="metric" SYMBOL="°"

x70b1 commented 6 years ago

Ah, found your problem. This value displays the duration until the next sunset or sunrise.

But you could adapt that script to show the value as a time.

ycf83 commented 6 years ago

thnk's for help bro, im not programmer i don't know how to do, if u can help please sir

x70b1 commented 6 years ago

Replace lines 79-85:

    if [ "$sun_rise" -gt "$now" ]; then
        daytime=" $(date --date="@$sun_rise" -u +%H:%M)"
    elif [ "$sun_set" -gt "$now" ]; then
        daytime=" $(date --date="@$sun_set" -u +%H:%M)"
    else
        daytime=" $(date --date="@$sun_rise" -u +%H:%M)"
    fi
132ikl commented 6 years ago

@x70b1 Not related to the issue, but what do the @s do in that?

x70b1 commented 6 years ago

@132ikl It indicates that we're providing a timestamp.

ycf83 commented 6 years ago

@x70b1 , thnk's a lot men, everything is good , u can close this issue if u want , thnk's you so much :+1:

132ikl commented 6 years ago

Maybe this should be properly implemented as an option into the script?

x70b1 commented 6 years ago

Yes, maybe. On the other hand, everyone can modify their own script as they like.

132ikl commented 6 years ago

There's also people like OP who don't necessarily have the knowledge of how to do more complex scripting with bash, who would appreciate more options. Maybe there should be a standard to allow for small options (such as this issue or the one I implemented in info-twitch-countdown), similar to the way the boilerplate icon is handled

x70b1 commented 6 years ago

Yes, but it leads to a question: Where do we stop? We can not handle every case. Yes, there are a lot of nice ideas out there. But I want to keep things simple. The most scripts have only a few lines. I don't want to blow them up with many if-else conditions.

This repository is also already nearly foolproof. The reason for this is: There are no hundreds of options. There are simple scripts. That's all.

I knew this problem would occur. This is why README.md says the following:

This repository is not an exact blueprint. I guess every script has to be customized to make your Polybar unique.
132ikl commented 6 years ago

That's fair. Maybe some remarkably modifiable scripts could have an "additions.txt" or something, which could include small modifications (such as those previously listed) users can make to customize their scripts. That may get out of hand as well, though, so that's simply an idea.