1

I have problem with a theme in conky and, more specifically, with a conky widget. The theme is called "alsafi" and it works properly, but the weather widget by default shows the weather of Bologna (Italy). I changed the API key and city ID in ~/.config/conky/Alsafi/scripts/weather2.sh, but it still shows Bologna even after rebooting and restarting conky. What can the issue be?

Note: the theme runs from conky manager 2 so the location is ~/.conky.

the edited files: weather-v2.0.sh

# This script is to get weather data from openweathermap.com in the form of a json file
# so that conky will still display the weather when offline even though it doesn't up to date

Variables

get your city id at https://openweathermap.org/find and replace

city_id=256639 #<---modified to display my city

replace with yours

api_key=c99cf91646e0ca8d6ff63957a1d20552 #<--- personal api key

choose between metric for Celcius or imperial for fahrenheit

unit=metric

i'm not sure it will support all languange,

lang=en

Main command

url="api.openweathermap.org/data/2.5/weather?id=${city_id}&appid=${api_key}&cnt=5&units=${unit}&lang=${lang}" curl ${url} -s -o ~/.cache/weather.json

exit

After running grep -iRE 'Alsafi|weather.sh' ~/.conky ~/.config/conky the output of terminal is:

/home/kr/.conky/Sirius/Changelog:-  New Weather.sh
/home/kr/.conky/conky-startup.sh:cd "$HOME/.conky/Alsafi"
/home/kr/.conky/conky-startup.sh:conky -c "$HOME/.conky/Alsafi/Alsafi.conf" &
/home/kr/.conky/Alsafi/Changelog:Alsafi - Conky Theme
/home/kr/.conky/Alsafi/Alsafi.conf:--  ALSAFI
/home/kr/.conky/Alsafi/Alsafi.conf:${execi 600 ~/.config/conky/Alsafi/scripts/weather-v2.0.sh}\
/home/kr/.conky/Alsafi/Alsafi.conf:${offset 0}${voffset 10}${color}${font feather:size=20}${execi 15 ~/.config/conky/Alsafi/scripts/weather-text-icon}${goto 73}${font}
/home/kr/.conky/Alsafi/Alsafi.conf:${offset 0}${voffset 0}${color1}${font Barlow:bold:size=13}${exec ~/.config/conky/Alsafi/scripts/playerctl.sh}
/home/kr/.conky/Alsafi/Alsafi.conf:${offset 0}${voffset 0}${font Barlow:bold:size=10}Wi-Fi : ${execi 5 ~/.config/conky/Alsafi/scripts/ssid}
/home/kr/.conky/Alsafi/start.sh:conky -c $HOME/.config/conky/Alsafi/Alsafi.conf &> /dev/null &
/home/kr/.config/conky/Sirius/Changelog:-   New Weather.sh

Ok so after restarting conky thas the cache with weather.json

➜  ~ cat ~/.cache/weather.json     
{"coord":{"lon":11.4333,"lat":44.4667},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"base":"stations","main":{"temp":11.95,"feels_like":11.66,"temp_min":10.77,"temp_max":13.14,"pressure":1016,"humidity":94},"visibility":7000,"wind":{"speed":3.09,"deg":40},"clouds":{"all":75},"dt":1709155681,"sys":{"type":2,"id":2004497,"country":"IT","sunrise":1709099691,"sunset":1709139562},"timezone":3600,"id":3181927,"name":"Bologna","cod":200}

So finally after more research the issue solved.The cause are the permissions .The weather.json file has permission to write and read from me but not from other apps so it couldnt get the data from the api .After changing the permissions using gui the issue solve.Thanks for your time and your help i really appreciate that.

1 Answers1

2

As it seems the issue is on ~/.cache/weather.json . What I did was change the permissions for other apps to write and read to the file. This can be done from the terminal by typing :

chmod o+w ~/.cache/weather.json