Inxi in Conky

Hi, I was looking at the inxi comano and saw that inxi -w displays weather data based on the user’s location.
It occurred to me if it will be possible to make Conky show the results of inxi.
I was googling before asking but I can’t find anything.
Does anyone know the syntax to accomplish this if this is possible?

Inxi uses https://openweathermap.org to get its weather which is a subscription service.
The weather forecast returned by inxi is a general overview for your country which it will provide on accessing the site.
This is not necessarily correct for your actual location.

For example I am given current conditions for London, England although I live some 250KM north where the weather is generally very different.

If you are prepared to subscribe then Arcolonux provided a solution although I haven’t tried it.
See here: Everything you need to know about the conky AP-Weather | ArcoLinux

1 Like

Thank you very much, I was unaware of the service, in my case it is quite close to reality, perhaps I live in the place from where they take the climatic reference.
I’ll keep trying with the paths established by Conky, I haven’t succeeded yet. If you can pass me the lines of code to add them to my Conky I would appreciate it.

Looking a little closer at the output from conky it seems that I was wrong and the report is more local than I believed.
However, the data returned is not easy to work with in conky and would need considerable shell processing to be useful.
Example:

inxi -w 
Weather:
  Report: temperature: 12.13 C (54 F) conditions: overcast clouds
  Locale: Manchester, I2, GBR current time: Sat 30 Sep 2023 09:14:44 BST
    (Europe/London) Source: OpenWeatherMap.org

If you want to use this then the conky command would be something like:

${exec inxi -w (whatever code you use to filter the output)}
example:

inxi -w | sed -n '/temp/p'
  Report: temperature: 13.4 C (56 F) conditions: overcast clouds

This does use a lot of resources in conky though.

Personally I would look for a dedicated weather utility of which there are many.

yay -Ss weather

2 Likes

Hello, thank you very much for your reply.
My thing is playing with Conky, I don’t know if keeping this weather thing in everyday use, it’s more part of a learning process than the value it has as information.
Mabox, brings in its left panel the weather forecast, when it works it is quite accurate.
I will try again, I used ${exec inxi -w} but it didn’t work, I did it without geolocation code, since I don’t know it and in terminal it gives the complete answer.

inxi -w
Weather:
  Report: temperature: 13.66 C (57 F) conditions: clear sky
  Locale: Buenos Aires, 07, ARG current time: 2023-09-30 21:34:40
    (America/Argentina/Buenos_Aires) Source: OpenWeatherMap.org

This is the response of the forecast that comes in the right panel of Mabox

1 Like

To use the inxi command in conky try somethig like this:
${execpi 1800 inxi -w}
The execpi command executes a process at the specified interval, here the interval is is 1800 seconds (30 minutes).
The output could use some editing though.

See Conky – Variables for more information.

1 Like

Because I cannot resist diving into a rabbithole when I stumble upon one:

The Mabox menu weather uses wttr.in, which can be used in conky as well:

https://github.com/chubin/wttr.in#conky

The readme on github details all the other ways you can format wttr.in’s output. I may see how quickly it can display a .png in viewnior instead of using terminator, which needs a lot of screen real estate on my setup.

Edit: in other news, it is raining in Seattle and will continue to do so. Some things don’t change (much).

2 Likes

Hi @piquet I’m using it but I don’t like the way it looks, I don’t know how to remove the texts I don’t like, like the numbers 12, Farenheit degrees, .
I’m going to check if I can remove those texts and make it look decent, meanwhile I’ll try other alternatives.
Thank you very much.

Hi @josefk I’m going to look into it and see if I can do it.
Thank you very much.
I agree with you, it’s always good to poke around,

Ok, I tried but doesn’t work on Conky I guess I have to modify the font.conf file, but it seems that it needs lua and these Conkys don’t use it, as far as I can see. So I would have to create a new Conky with lua which I can’t do at the moment.
Thank you very much, for the information, it’s always good, it adds up, I’m a bit slow and I don’t have much time.


png-not-support

You haven’t said which fields you want to display.
Play around with this:

inxi -w | awk 'NR == 2 {print $2" "$3" "$4"\n"$7" "$8" "$9}'
temperature: 10.93 C
conditions: light rain

Post back if you need more help. :slightly_smiling_face:

1 Like

Thank you very much, I will try it as soon as I am with the computer, I guess tomorrow or the day after tomorrow.

Hi, after some time I was able to try again, I copied and pasted your code in my conky, it gives the result but it prefixes the number 12 and I don’t know how to remove it.
Do you have any idea how to remove it?
Thank you very much.
weather-conky

The command works fine on my setup:

inxi -w | awk 'NR == 2 {print $2" "$3" "$4"\n"$7" "$8" "$9}'
temperature: 11.12 C
conditions: overcast clouds

If you post the full output from the inxi command, as it is returned for you, I will have another look.
Maybe you could also post your conky script?

Hi @piquet, this is my complete Conky for forecast with inxi

conky.config = {

	own_window = true,
	own_window_type = 'desktop',
	own_window_transparent = true,
	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
	own_window_colour = '#1d2021',
	own_window_class = 'Conky',
	own_window_title = 'Mabox Weather Conky',
    
    alignment = 'top_left',
	gap_x = 30,
	gap_y = 60,
	minimum_width = '400',

	use_xft = true,
	font = 'Ubuntu:size=8',
	xftalpha = 1,
	override_utf8_locale = true,
    
    
	draw_shades = false,
	default_shade_color = '#222222',
	draw_outline = false,
	default_outline_color = '#222222',
    
    default_color = '#ddc7a1',
	color0 = '#d8a757',
	color1 = '#a9b665',
    color2 = '#89b482',
	cpu_avg_samples = 2,
	

	draw_borders = false,
	stippled_borders = 0,
	border_inner_margin = 8,
	border_outer_margin = 8,
	border_width = 1,
    draw_graph_borders = true,

	background = true,
	no_buffers = true,
	imlib_cache_size = 0,
    short_units = true,
	double_buffer = true,
	update_interval = 1,
};

conky.text = [[
${color5}${alignc}${font Cantarell:size=18}${time %A} ${time %e} de ${time %B}$font
${color8}${alignc}${font Cantarell:size=18}de ${time %Y}
${color4}$hr


$color${font Cantarell:size=10} ${execpi 1800 inxi -w | awk 'NR == 2 { print $2" "$3" "$4"\n "$7" "$8" "$9}'

]];

Well I change it like this $color${font Cantarell:size=10} Temperatura: ${execpi 1800 inxi -w | awk 'NR == 2 {print $3" "$4"\n Condición: "$8" "$9}'
Y Muestra lo que quiero

weather

Glad you got it working. :slightly_smiling_face:

1 Like

Notice in here that there is a { and } around font Cantarell:size=10, but there is a missing } in the rest of the statement. Adding one final } at the very end should properly close it.

1 Like

Hi, @rdtsc I can’t see the {Y} and de } loose :no_good_woman: