You are not logged in.

#21 2024-04-15 15:46:19

Robi
Member
Registered: 2024-01-30
Posts: 43

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

.

Last edited by Robi (2024-04-15 15:54:57)


...Welcome to the family...

Offline

#22 2024-04-15 15:48:07

Robi
Member
Registered: 2024-01-30
Posts: 43

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

Having put owfonts to ~./fonts and 
bunsenweather-wapi.sh
at first prints the icons in terminal correctly and fails in conky.

fc-list | grep owfont-regular

/home/a/.fonts/owfont-regular.ttf: owf\-regular:style=Regular

So this is the solution for icons:

icon_font_L='owf\-regular:size=18'
icon_font_S='owf\-regular:size=10'

date / hour works correctly. I added
${execpi 900 /home/a/.config/conky/scripts/bunsenweather-wapi.sh myplace}
to the end before ]] into
BL-Right-lua-conky.conf

Last edited by Robi (2024-04-15 15:54:21)


...Welcome to the family...

Offline

#23 2024-04-15 17:52:55

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

micko01 wrote:
unklar wrote:

I get the following error message:

conky: desktop window (3cf) is root window
conky: window type - normal
conky: drawing to created window (0x600001)
conky: drawing to double buffer
conky: forked to background, pid is 102993

date: ungültiges Datum „null“
date: ungültiges Datum „@null“
date: ungültiges Datum „@null“
conky: received SIGHUP, SIGINT, or SIGTERM to terminate. bye!

Hrm, invalid date. Did you set `language=` in the script at line 48 (or so) ? I suspect the decimal separator ('.' in English and ',' in most European locales) is likely a problem also.

It doesn't matter if and what is in line 48, I can also comment it out (#), the error remains.   sad

Offline

#24 2024-04-15 22:43:50

Robi
Member
Registered: 2024-01-30
Posts: 43

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

The German names of the days cause the problem. I tried to insert a function but at the moment it works with this primitive fix of bunsenweather-wapi.sh (the 1st and last lines should be found to insert this section):

        today=$(date +%A)
        case $today in
Montag)
	today=Monday;;
Dienstag)
	today=Tuesday;;
Mittwoch)
	today=Wednesday;;
Donnerstag)
	today=Thursday;;
Freitag)
	today=Friday;;
Samstag)
	today=Saturday;;
Sonntag)
	today=Sunday;;
esac
        today_epoch=$(echo "$weather" | jq -r '.forecast.forecastday[0].date_epoch')
        today_sunset_pre=$(echo "$weather" | jq -r '.forecast.forecastday[0].astro.sunset')
        today_sunset=$(date +%s -d "$today_sunset_pre")
        today_cond=$(echo "$weather" | jq -r '.forecast.forecastday[0].day.condition.text')
        today_cur_time=$(date +%s)
        tomorrow_epoch=$(echo "$weather" | jq -r '.forecast.forecastday[1].date_epoch')
        tomorrow_cond=$(echo "$weather" | jq -r '.forecast.forecastday[1].day.condition.text')
        tomorrow=$(date +%A -d @${tomorrow_epoch})
        case $tomorrow in
Montag)
	tomorrow=Monday;;
Dienstag)
	tomorrow=Tuesday;;
Mittwoch)
	tomorrow=Wednesday;;
Donnerstag)
	tomorrow=Thursday;;
Freitag)
	tomorrow=Friday;;
Samstag)
	tomorrow=Saturday;;
Sonntag)
	tomorrow=Sunday;;
esac
        next_day_epoch=$(echo "$weather" | jq -r '.forecast.forecastday[2].date_epoch')
        next_day_cond=$(echo "$weather" | jq -r '.forecast.forecastday[2].day.condition.text')
        next_day=$(date +%A -d @${next_day_epoch})
       case $next_day in
Montag)
	next_day=Monday;;
Dienstag)
	next_day=Tuesday;;
Mittwoch)
	next_day=Wednesday;;
Donnerstag)
	next_day=Thursday;;
Freitag)
	next_day=Friday;;
Samstag)
	next_day=Saturday;;
Sonntag)
	next_day=Sunday;;
esac

        col='#FFFFFF'

...Welcome to the family...

Offline

#25 2024-04-16 05:37:08

micko01
void main()
From: Queensland, Australia
Registered: 2024-04-07
Posts: 492
Website

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

I'm perplexed why de is causing problems. I wonder if this is a coreutils bug (date)? A conky bug? It all works for me @unklar and @Robi with LANG=de_DE system wide and language=de (ln:48) set in the script as is.

BTW, interesting work around @Robi

conky weather LANG=de

My conky and date versions in code tags below. If anyone is interested I could probably translate the script with gettext.

~$ conky -v
conky 1.19.8_pre compiled for Linux x86_64

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib64/conky


 General:
  * math
  * hddtemp
  * portmon
  * support for IBM/Lenovo notebooks
  * builtin default configuration
  * old configuration syntax
  * Imlib2
  * OSS mixer support
  * apcupsd
  * iostats
  * ncurses
  * Internationalization support

 Lua bindings:
  * Cairo
  * Imlib2
  * RSVG
 X11:
  * Xdamage extension
  * Xinerama extension (virtual display)
  * Xshape extension (click through)
  * XDBE (double buffer extension)
  * Xft
  * Xinput
  * ARGB visual
  * Own window
  * Mouse events
 Wayland:
  * ARGB visual
  * Mouse events

 Music detection:
  * CMUS
  * MPD
  * MOC

 Default values:
  * Netdevice: eno1
  * Local configfile: $HOME/.conkyrc
  * Localedir: /usr/share/locale
  * Maximum netdevices: 256
  * Maximum text size: 16384
  * Size text buffer: 256
~$ date --version
date (GNU coreutils) 9.4
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

If you're wondering why Package library path: /usr/lib64/conky is set, it's because I'm using a bastardised slackware64-current system, which I use to keep on top of changes in labwc/wlroots.


#!/bin/sh
echo '#include <stdio.h>\nvoid main() { printf("Hi, bunsenlabs\\n"); return; }' > bunsen.c
gcc bunsen.c -o bunsen
./bunsen

Offline

#26 2024-04-16 08:39:15

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

Test system  https://forums.bunsenlabs.org/viewtopic … 30#p132830

in Boron currently 1.8.3

Offline

#27 2024-04-17 18:37:01

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 1,897

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

You might have this issue in other languages other than German too. That snippet in @Robi's post above can be edited with the day names for whatever languages that may be problematic.


As an aside, what other weather services can this conky script be adapted to?

Last edited by DeepDayze (2024-04-17 18:40:51)


Real Men Use Linux

Offline

#28 2024-04-19 05:22:08

micko01
void main()
From: Queensland, Australia
Registered: 2024-04-07
Posts: 492
Website

Re: HowTo: Fix bunsenweather.sh, and use it in a Conky

I installed a Boron VM (qemu) and used my `bunsenwaeter-wapi.sh` code  with needed dependencies and it works - in English. Only had some cosmetic issues with colors, but they should be edited as needed anyway. Coreutils date version is 9.1. I did need to escape the dash in owfont as per @Robi 's suggestion a few posts back but that's all.

@DeepDayze, I did mention a few posts back about MET (Norwegian). No api key needed but I haven't had time to explore it enough yet.


#!/bin/sh
echo '#include <stdio.h>\nvoid main() { printf("Hi, bunsenlabs\\n"); return; }' > bunsen.c
gcc bunsen.c -o bunsen
./bunsen

Offline

Board footer

Powered by FluxBB