Forum › Forums › General › Tips and Tricks › CLI or conky
Tagged: Conky
- This topic has 38 replies, 12 voices, and was last updated Jun 18-12:18 am by Brian Masinick.
-
AuthorPosts
-
January 22, 2022 at 6:53 am #75771Member
blur13
::No, I meant specifically the “one liner” ie one line of output. So, for example, the following:
curl wttr.in/Stockholm?format=”%l:+%c+%w+%t\n”
gives
Stockholm: ⛅ ↘11km/h -6°C
If you can get THAT to show the wind speed in m/s then I’ll be impressed by your DDG-fu 😉
January 22, 2022 at 10:43 am #75788MemberPPC
::@blur13 – My ddg-fu allowed me only to find https://github.com/chubin/wttr.in , where the “on liner” options are stated- no option to use the (for me, very strange m/s measure for Wind velocity – the indication of hurricane speeds in your country will sound very alien, to me, for example- not that we have many hurricanes here) meters per second…
So, you may have to consider processing directly the end result with grep,sed, etc, or exporting the results, process them to your liking and then present the results on the terminal/conky… Not fun, I know, sorry 🙁I found out many nice little pieces of info, like finding out the phases of the moon and sunrise and sunset time…
P.
January 22, 2022 at 11:03 am #75792Member
blur13
::PPC,
I guess its a Scandinavian thing, smhi.se/dmi.dk/yr.no all report windspeed in m/s. Having the windspeed in km/h is almost like having the temperature in degrees F, difficult to use since I have nothing to relate it to. I know what 6 m/s “feels like” from experience. No clue what 10 km/h feels like.
Other than that the one line wttr.in is a pretty neat feature.
January 22, 2022 at 11:16 am #75794Member
blur13
::Ok, just to show off my google-fu skills:
curl wttr.in/stockholm?format="%C+%w+%t\n"\&MSunny →1.1m/s -5°C
Found this searching the issues in the wttr github,
https://github.com/chubin/wttr.in/issues/415
He should really consider adding that very useful piece of information in the help file.
January 22, 2022 at 11:35 am #75795MemberPPC
::@blur13 : I thought a little but about your wind measure problem… If my math is right this should display wind velocity in a way that you are used to:
wind_speed_in_km_h=$(curl wttr.in/Stockholm?format=%w| sed 's/[^0-9]*//g') echo $wind_speed_in_km_h v1=2 wind_speed_in_m_s=$(echo $wind_speed_in_km_h / 3.6 | bc ) echo $wind_speed_in_m_s m/sPlease check the math- I think diving the km/h value to m/s is right, it’s, adjust the line that does the math accordingly…
My ddg-fu was used to find the sed command to extract the number part from the result- this little trick an be handy in my scripts 🙂Edit: Just noticed your post, I think my way works, without showing the decimal points, but, of course, I bow to your far superior ddg-fu, sensei, 🙂
P.
- This reply was modified 1 year, 3 months ago by PPC.
January 22, 2022 at 11:47 am #75797Member
blur13
::PPC (or sed-fu master),
Impressive, here is another one for you to ponder
curl wttr.in/?format="Sunrise:+%S\nZenith:++%z\nSunset:++%s"Sunrise: 08:18:29
Zenith: 11:58:34
Sunset: 15:39:32Why on earth I’d want to know the “seconds” is beyond me, completely useless info and takes up valuable screen/conky space. Any cool way you can figure out to just display the HH:MM?
January 22, 2022 at 12:31 pm #75806Anonymous
January 22, 2022 at 1:12 pm #75809MemberPPC
::@blur13 – easy as pie- here’s an example:
curl wttr.in/?format="Sunrise:++%s"|cut --complement -c 16-20
This cuts the characters 16 to 20 from the end of the outputb. You’ll have to adapt that to the Zenith and Sunset results (because the text has a different number of characters).
if you want everything displayed on the same line, just import the results of this command to variables, then echo everthing in one go:
Example:sunrise=$(curl wttr.in/?format="Sunrise:++%s"|cut --complement -c 16-20) zenith=... sunset= ... echo $sunrise $zenit $sunsetThat’s all little “grasshopper”
P.- This reply was modified 1 year, 3 months ago by PPC.
January 22, 2022 at 1:37 pm #75811Member
blur13
::Thanks!
Doesnt this look pretty:${execi 60 curl -s wttr.in/?format="Sunrise:+%S"|cut --complement -c 15-20} | ${execi 60 curl -s wttr.in/?format="%s"|cut --complement -c 6-20}Sunrise: 08:18 | 15:39
execi 60 (ie updates every minute) might seem a bit excessive for something that really only needs updating once a day. The problem is that if I suspend the system, on wake up it doesnt refresh in the conky until the execi timer is reached. So for execi 60 it will update 60 seconds after wake up. It would be much better if it executed on wakeup, and then at whatever execi $seconds is specified.
January 23, 2022 at 10:07 am #75897Anonymous
::In the syntax of the conky version1.9 there is still the command
pre_execYou could use this command like this
${goto 10}Weather #${font DejaVu Sans:size=8.5}${texeci 1200 curl -s 'wttr.in/Stockholm?format=+%l+%c+%t+%w+%P+%h+%m+&M'} ${font DejaVu Sans:size=8.5}${pre_exec curl -s 'wttr.in/Stockholm?format=+%l+%S+%s&M'}${font}January 23, 2022 at 11:24 am #75901Member
blur13
::Thank you! I’ll try that!
I think the problem might be that conky runs before my internet connection is established. Maybe if I disabled conky in the desktop-session config file and moved it to the startup file, adding it to the end with a “sleep 20” right before.
January 30, 2022 at 6:56 pm #76435Anonymous
::
(the colors can be changed according to taste)I present here the antiX-Conky modified by me
to the community.I have included above the Greek spelling of antiX as published by @anticapitalista. If you don’t want that, you can comment out or comment in lines 1 and 2.
Below I have included the simplest Accuweather weather from @TBG. This can also be removed, if you don’t want it, by commenting out lines 135-144. The last line 145, a blank line, must be kept.
For those who want to have the weather, the following preparations must be made:
1. in a terminal enter this command
git clone https://gitlab.com/teobigusgeekus/Accuweather_conky_script.git
that will create the directory “Accuweather_conky_script” in your /home, where the script and the necessary data will be.2. open a browser with the link address: ( https://www.accuweather.com/ ) and search your city. When you find it, copy the whole line.(Ctrl+l)
3. go to the directory Accuweather_conky_script and search the script “accuweather” and open it. In lines 12-16 you already see such address lines. Paste your copied one according to this pattern. Comment the line from Kastoria from (#). Save the script and close it.
Check and make the script executable.4. create a directory .fonts in your /home.
Download the font monofur with your browser at the address ( https://www.dafont.com/search.php?q=monofur ) into your download directory. Unzip the .zip file and copy/move the monof55.ttf and monof56.ttf into the newly created and hidden folder .fonts . Do the same with the fonts ConkyWeather.ttf and ConkyWindNESW.otf from the Accuweather_conky_script directory.
If you have these 4 fonts in .fonts you have to make your system familiar with them. To do this, open a terminal again and enter the command (as user):
fc-cache -v -f
That’s it.
Now you can call the conky in the terminal (I assume you have killed an already running conky before, otherwise this new one will be on top).Since the terminal is still open
conky -c ~/.conkyrc1 &
You see how the script fetches the data. When it’s done, the conky will appear on the desk. But maybe Conky is too fast and the data is “getting used to”. Therefore kill the Conky in a second terminal with
pkill -xf "conky -c /home/user/.conkyrc1" &
wait a bit and start it again in the first terminal after you killed the conky process there with Ctrl+c.Have fun!
conkyrc1
# Standard antiX .conkyrc file # For conky editing help and commands visit = Casey's Conky Reference with Examples {http://www.ifxgroup.net/conky.htm} # modified @male 2022-01-30 # set to yes if you want Conky to be forked in the background background yes short_units yes cpu_avg_samples 1 net_avg_samples 1 # X font when Xft is disabled, you can pick one with program xfontsel #font 7x12 #font 6x10 #font 7x13 font 8x12 #font 7x12 # Use Xft? use_xft yes # Xft font when Xft is enabled xftfont gentium:size=10 #ftfont DejaVu Sans:size=10 #xftfont DejaVu Sans:bold:size=9 #xftfont DejaVu Sans:size=9 # Create own window instead of using desktop (required in nautilus, pcmanfm and rox desktops) own_window yes own_window_transparent yes own_window_hints undecorated,below,sticky,skip_taskbar own_window_type normal #desktop # Text alpha when using Xft xftalpha 1.0 # Update interval in seconds update_interval 1 # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes no_buffers yes # Draw shades? draw_shades no # Draw outlines? draw_outline no # Draw borders around text draw_borders no # Stippled borders? stippled_borders 0 # border margins #border_margin 10 # border width border_width 2 # Default colors and also border colors default_color white default_shade_color white default_outline_color white color1 ffffff color2 fffff0 color3 ff8800 color4 ffff00 color5 77ccff color6 5599cc # Text alignment, other possible values are commented # alignment top_left alignment top_right #alignment bottom_left #alignment bottom_right # Minimum size of text area minimum_size 200 700 maximum_width 200 gap_x 20 gap_y 40 # Add spaces to keep things from moving about? This only affects certain objects. use_spacer none #right override_utf8_locale yes uppercase no # if_up_strictness link: up | link | address if_up_strictness address TEXT #${alignc}${font gentium:size=16}${pre_exec cat /etc/antix-version | cut -c1-8} ${alignc}${font DejaVu Sans:bold:size=14}άντιξ-21 ${alignc}${color6}${font gentium:size=9}${kernel}${color} Uptime:${alignr}${uptime}${font} Desktop:${alignr}${execi 60 disp=${DISPLAY#:}; disp=${disp%.[0-9]}; cat $HOME/.desktop-session/desktop-code.$disp 2>/dev/null} res:${alignr}${pre_exec xdpyinfo | sed -n -r "s/^\s*dimensions:.*\s([0-9]+x[0-9]+).*/\1/p"} dpi:${alignr}${pre_exec sed -nr "s/^\s*Xft.dpi:\s*([0-9]+(x[0-9]+)?).*/\1/p" $HOME/.Xresources | grep "[0-9]" || echo 96} Automount: ${alignr}${execi 60 grep -q "^automount=TRUE" $HOME/.desktop-session/automount.conf 2>/dev/null && echo "enabled" || echo "disabled"} ${color}Init:${alignr}${pre_exec detect-init.sh} Load:${font gentium:size=7}${alignr}${loadavg}${color3}(1, 5, 15 min)${color}${font} CPU:${alignr}${cpu}% ${alignr}${cpugraph cpu0 20,170 9955cc 5599cc -l} Disk:${alignr}${diskio /dev/sda4} ${alignr}${diskiograph /dev/sda4 20,170 5599cc 9955cc -l}${if_up eth0} eth0 up: $alignr ${upspeedf eth0} ${alignr}${upspeedgraph eth0 20,170 fffff0 ff8800 -l} eth0 down: $alignr ${downspeedf eth0} ${alignr}${downspeedgraph eth0 20,170 ff8800 fffff0 -l}${endif}${if_up eth1} eth1 up: $alignr ${upspeed eth1} ${alignr}${upspeedgraph eth1 20,170 fffff0 ff8800 -l} eth1 down: $alignr ${downspeed eth1} ${alignr}${downspeedgraph eth1 20,170 ff8800 fffff0 -l}${endif}${if_up wlan0} wlan0 up: $alignr ${upspeed wlan0} ${alignr}${upspeedgraph wlan0 20,170 fffff0 ff8800 -l} wlan0 down: $alignr ${downspeed wlan0} ${alignr}${downspeedgraph wlan0 20,170 ff8800 fffff0 -l}${endif}${if_up wlan1} wlan1 up: $alignr ${upspeed wlan1} ${alignr} ${upspeedgraph wlan1 20,170 fffff0 ff8800 -l} wlan1 down: $alignr ${downspeed wlan1} ${alignr}${downspeedgraph wlan1 20,170 ff8800 fffff0 -l}${endif} ${alignr}${color6}Used ${color}/ ${color6}Total ${color} RAM:${alignr}${mem} / ${memmax} ${alignr}${memgraph 20,170 ebcb8b bf616a -l} Swap:${alignr}${swap} / ${swapmax} /root:${alignr}${fs_used /} / ${fs_size /} ${color1}${swapbar 0,210}${color} ${texeci 500 bash $HOME/Accuweather_conky_script/accuweather -f}\ ${voffset 5}${goto 10}${font conkyweather:size=35}${texeci 600 sed -n '22p' $HOME/Accuweather_conky_script/curr_cond}${font monofur:size=25}${goto 80}${texeci 600 sed -n '2p' $HOME/Accuweather_conky_script/curr_cond}° ${voffset -5}${goto 6}${font monofur:size=9}CURRENTLY: ${goto 70}${texeci 600 sed -n '4p' $HOME/Accuweather_conky_script/curr_cond} ${goto 6}WIND: ${goto 70}${texeci 600 sed -n '5p' $HOME/Accuweather_conky_script/curr_cond} ${texeci 600 sed -n '6p' $HOME/Accuweather_conky_script/curr_cond}${goto 160}${voffset -10}${font ConkyWindNESW:size=30}${texeci 600 sed -n '27p' $HOME/Accuweather_conky_script/curr_cond}\ ${voffset 2}${goto 6}${font monofur:size=9}PRESSURE: ${goto 70}${texeci 600 sed -n '8p' $HOME/Accuweather_conky_script/curr_cond} ${voffset 5}${goto 15}${texeci 600 sed -n '11p' $HOME/Accuweather_conky_script/daily_forecast}${goto 80}${texeci 600 sed -n '18p' $HOME/Accuweather_conky_script/daily_forecast}${goto 150}${texeci 600 sed -n '25p' $HOME/Accuweather_conky_script/daily_forecast} ${goto 10}${font conkyweather:size=25}${texeci 600 sed -n '107p' $HOME/Accuweather_conky_script/daily_forecast}${goto 80}${texeci 600 sed -n '108p' $HOME/Accuweather_conky_script/daily_forecast}${goto 150}${texeci 600 sed -n '109p' $HOME/Accuweather_conky_script/daily_forecast} ${voffset -18}${goto 30}${font monofur:size=9}${texeci 600 sed -n '12p' $HOME/Accuweather_conky_script/daily_forecast}${goto 100}${texeci 600 sed -n '19p' $HOME/Accuweather_conky_script/daily_forecast}${goto 170}${texeci 600 sed -n '26p' $HOME/Accuweather_conky_script/daily_forecast} ${goto 20}${font monofur:size=10}${texeci 600 sed -n '8p' $HOME/Accuweather_conky_script/daily_forecast|tr a-z A-Z|cut -c1-3}${goto 90}${texeci 600 sed -n '15p' $HOME/Accuweather_conky_script/daily_forecast|tr a-z A-Z|cut -c1-3}${goto 160}${texeci 600 sed -n '22p' $HOME/Accuweather_conky_script/daily_forecast|tr a-z A-Z|cut -c1-3}January 31, 2022 at 2:40 am #76446Anonymous
::Great thread everyone,
A note on curl with wttr.in is that instead of typing the city names,
you can use the zip code for the city.Moriarty, NM: ${font DejaVu Sans:bold:size=9.82}${texeci 1200 curl 'wttr.in/87035?u?q?0T?Q'}${font} ${execi 1000 acpi 2>/dev/null | grep -q . && echo "Batt: "}${execi 10 acpi -b 2>/dev/null | cut -d" " -f3,4 | sed 's/,$//'}January 31, 2022 at 3:18 am #76448Moderator
Brian Masinick
February 2, 2022 at 11:21 am #76627Anonymous
::Yes, @linuxdaddy 😉
The “area code or post code” only works in US.
This is also written in the help of wttr.in
—————————————————————
dateutils ,
the solution for forgetfulness in conky.Sometimes you forget the wedding day / birthday of uncle Paul etc.pp. This can be quite bad. So it would have to be something that remembers the dates with a click on the desktop.
apt policy dateutils apt show dateutils apt install dateutilsthe conkyrc can be “filled” with your own data 😉
# conky configuration # edited by kaivalagi # set to yes if you want Conky to be forked in the background background no # Use Xft? use_xft yes # Xft font when Xft is enabled xftfont Terminus:size=8 # Text alpha when using Xft xftalpha 0.8 # Update interval in seconds update_interval 3 # This is the number of times Conky will update before quitting. # Set to zero to run forever. total_run_times 0 # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes # Minimum size of text area minimum_size 300 5 maximum_width 350 # Draw shades? draw_shades no #yes # Draw outlines? draw_outline no # Draw borders around text draw_borders no draw_graph_borders no #yes # Stippled borders? stippled_borders 0 # border margins #border_margin 0 # border width border_width 0 # Default colors and also border colors default_color white default_shade_color black default_outline_color white # own window options own_window yes own_window_transparent yes own_window_type normal own_window_hints below,skip_taskbar,skip_pager # Text alignment, other possible values are commented alignment top_left #alignment top_right #alignment bottom_left #alignment bottom_right # Gap between borders of screen and text # same thing as passing -x at command line gap_x 380 gap_y 250 # Subtract file system buffers from used memory? no_buffers yes # set to yes if you want all text to be in uppercase uppercase no # number of cpu samples to average # set to 1 to disable averaging cpu_avg_samples 2 # number of net samples to average # set to 1 to disable averaging net_avg_samples 2 # Force UTF8? note that UTF8 support required XFT override_utf8_locale yes # Add spaces to keep things from moving about? This only affects certain objects. use_spacer right # colours color1 white # light blue color2 6892C6 # orange color3 E77320 # green color4 78BF39 # red color5 CC0000 text_buffer_size 1024 TEXT ${color1}${alignc}${time %d.%m.%Y} ${color5}${alignc}Linux${color1} since: 2008-01-01 ${alignc}${pre_exec dateutils.ddiff 2008-01-01 today -f '%yy %mm %dd'} or ${color1}${pre_exec dateutils.ddiff 2008-01-01 today -f '%d'} day(s) Date${alignr 10}Days Age: ${membar 0} 29-04-66 I ${pre_exec dateutils.ddiff 1966-04-29 today -f '%yy %mm %dd'}${goto 305}${color1}${pre_exec dateutils.ddiff 1966-04-29 today -f '%d'} 29-12-66 my wife ${pre_exec dateutils.ddiff 1966-12-29 today -f '%yy %mm %dd'}${goto 305}${color1}${pre_exec dateutils.ddiff 1966-12-29 today -f '%d'} 26-07-82 wedding day ${pre_exec dateutils.ddiff 1982-07-26 today -f '%yy %mm %dd'}${goto 305}${color1}${pre_exec dateutils.ddiff 1982-07-26 today -f '%d'} .... .... ${alignc}pension since: 15 Dec 2021 ${alignc}${pre_exec dateutils.ddiff 2021-12-15 today -f '%yy %mm %dd'} or ${color1}${pre_exec dateutils.ddiff 2021-12-15 today -f '%d'} day(s) ${alignc}own house: 27 Feb 1999 ${alignc}${pre_exec dateutils.ddiff 1999-02-27 today -f '%yy %mm %dd'} or ${color1}${pre_exec dateutils.ddiff 1999-02-27 today -f '%d'} day(s) .... ....Now you need a script to start and stop the conky.
This already existed in 2013 by very inventive people, which is also, as can be seen, arbitrarily extendable:
start_stop_conky#!/bin/bash ## Original idea by: GrouchyGaijin ## This idea by: Stinkeye - Jan 2013 ## With another tweak by: arclance ## Final tweak by: Sector11 ## click to start, click to stop ##if pgrep -f "conky -q -c /media/5/Conky/Dates.conky" ##then ## pkill -xf "conky -q -c /media/5/Conky/Dates.conky" ##else ## gnome-terminal -e "conky -q -c /media/5/Conky/Dates.conky" ##fi ## not running in a terminal ## remove: gnome-terminal -e ## Tweaked #if pgrep -f "conky -q -c $1" #then # pkill -xf "conky -q -c $1" #else # conky -q -c "$1" #fi if pgrep -f "conky -q -c /home/male/.conky/date/dateutil_conkyrc9" # pgrep -f "conky -q -c /home/male/.conky/radiotray/images/conkyrc" then pkill -xf "conky -q -c /home/male/.conky/date/dateutil_conkyrc9" # pkill -xf "conky -q -c /home/male/.conky/radiotray/images/conkyrc" else conky -q -c "/home/male/.conky/date/dateutil_conkyrc9" # conky -q -c "/home/male/.conky/radiotray/images/conkyrc" fiThe whole thing still with a starter (here in fluxbox) provided, starts with a click on Date me the Conky and lets it disappear again, if I click again on Date. Now I know about the darned forgetfulness 😉
How you create the starter in the other antiX desktops, you have to find out yourself. -
AuthorPosts
- You must be logged in to reply to this topic.


