AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / ubuntu / Perguntas / 1505968
Accepted
konstantinosr
konstantinosr
Asked: 2024-02-28 20:13:50 +0800 CST2024-02-28 20:13:50 +0800 CST 2024-02-28 20:13:50 +0800 CST

Como exibir o clima corretamente com o conky?

  • 772

Tenho problemas com um tema no conky e, mais especificamente, com um widget conky. O tema se chama "alsafi" e funciona corretamente, mas o widget de clima por padrão mostra o clima de Bolonha (Itália). Alterei a chave da API e o ID da cidade ~/.config/conky/Alsafi/scripts/weather2.sh, mas ainda mostra Bolonha mesmo depois de reiniciar e reiniciar o conky. Qual pode ser o problema?

Nota : o tema é executado no conky manager 2, portanto a localização é ~/.conky.

os arquivos editados: 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

Depois de executar grep -iRE 'Alsafi|weather.sh' ~/.conky ~/.config/conkya saída do terminal é:

/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, então depois de reiniciar o conky, o cache está com 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}

Então, finalmente, depois de mais pesquisas, o problema foi resolvido. A causa são as permissões. O arquivo weather.json tem permissão para escrever e ler de mim, mas não de outros aplicativos, por isso não foi possível obter os dados da API. problema resolvido. Obrigado pelo seu tempo e ajuda, eu realmente aprecio isso.

themes
  • 1 1 respostas
  • 118 Views

1 respostas

  • Voted
  1. Best Answer
    konstantinosr
    2024-02-29T21:11:44+08:002024-02-29T21:11:44+08:00

    Como parece que o problema está ligado ~/.cache/weather.json. O que fiz foi alterar as permissões de outros aplicativos para gravar e ler o arquivo. Isso pode ser feito no terminal digitando:

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

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve