You are not logged in.
Pages: 1
Hi. As a new guy here I doubt I know anything the rest of you don't but I think I found a small issue in this file that hasn't been addressed.
For at least the last 7 months (probably longer but I didn't use conky until then) two things have been happening on the 28th of every month: the line with the days of the week loses its indentation (shifts to the left, out of alignment with the calendar dates) and the current date loses its color change. On the 29th, the issues resolves by itself.
I wanted to ask if anyone knew what was happening but I also held out hope that I could figure it out myself despite that I'm a novice when it comes to working with code.
After some research I learned the code is fairly simple:
${execpi 1800 LAR=$(date +%-d); ncal -bh | sed -e ':a;N;$!ba' -e 's/\n/\n${goto 28}/g' -e 's/\<'$LAR'\>/${color0}&${color1}/'}
What immediately jumped out at me is that
-e 's/\n/\n${goto 28}/g'
which indents every newline of the calendar, includes the date the error occurs.
LAR=$(date +%-d)
defines the variable to use in reference to the current date and
-e 's/\<'$LAR'\>/${color0}&${color1}/'
is what changes the color of that date.
So it seems that when
LAR
equals the same number that's in
${goto 28}
the code meant to change the date's color gets applied to the first indentation instead, which happens to be the line with the the days of the week. Conky doesn't know what to do with
${color}
in an indentation function, so the indentation breaks.
My solution is simply to increase the indentation to a number larger than any possible date (32 or higher) so that the only number
LAR
will ever equal is the date.
I do wonder if there might be a better way to define the variable but I haven't gotten that far.
My apologies if this has already been documented somewhere. It was basically impossible to find.
Offline
Hi @dude, thanks for finding this bug!
I found another possible fix: switch the positions of the sed commands thus:
${execpi 1800 LAR=$(date +%-d); ncal -bh | sed -e ':a;N;$!ba' -e 's/\<'$LAR'\>/${color0}&${color1}/' -e 's/\n/\n${goto 28}/g'}
so the ${goto 28} is applied after the colour substitution.
The only advantage of that is that it leaves the original author's choice of 28 for the indent unchanged. Could you check if that works for you too?
Also discovered that my system didn't have the necessary ncal installed. It needs adding to bunsen-conky's Recommends, and maybe to bunsen-meta-all too, so thanks for bringing this issue up.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Hi @dude, thanks for finding this bug!
I found another possible fix: switch the positions of the sed commands thus:
${execpi 1800 LAR=$(date +%-d); ncal -bh | sed -e ':a;N;$!ba' -e 's/\<'$LAR'\>/${color0}&${color1}/' -e 's/\n/\n${goto 28}/g'}
so the ${goto 28} is applied after the colour substitution.
The only advantage of that is that it leaves the original author's choice of 28 for the indent unchanged. Could you check if that works for you too?
Also discovered that my system didn't have the necessary ncal installed. It needs adding to bunsen-conky's Recommends, and maybe to bunsen-meta-all too, so thanks for bringing this issue up.
Well aren't you clever. That is quite an elegant fix. I will have to remember it.
Tbh the default indentation doesn't matter much to me. I combined the calendar with the clock from bigClock-lithium-light-conky.conf to reduce the number of instances running since they were both active and adjacent, and that changed the width anyway. Increasing the indentation turned out to be a perfectly good way to compensate. It was fine otherwise.
Not sure where my ncal came from. I did the manual upgrade to Bullseye in July and changed the apt sources again when Beryllium became official. If it isn't in the BunsenLabs respository then it must have come from Bullseye's.
I'm glad I could help. Being able to contribute something back feels pretty rewarding.
Offline
Not sure where my ncal came from. I did the manual upgrade to Bullseye in July and changed the apt sources again when Beryllium became official. If it isn't in the BunsenLabs respository then it must have come from Bullseye's.
I'm a bit puzzled too. It's clearly a requirement of two of the conkys in bunsen-conky. Maybe it used to be pulled in by some other package whose dependencies have changed?
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
I have used that line since 2008 and never had a problem with it.
I have it 186 conkys, the first 11 lines of the 186 line search for 'LAR=':
conky/OB-Cal.conky:107:${goto 20}${color}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color2}&${color}/' | sed ':a;N;$!ba;s/\n/\n${goto 20}/g'}
conky/KingsReckoning-Cal.conky:159:${goto 22}${color}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color2}&${color}/' | sed ':a;N;$!ba;s/\n/\n${goto 22}/g'}
conky/7_months_h.conky:164: ${goto 652}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 652}/g'}${color}${voffset 336.5}
conky/conky-BL/bl-right_S11.conky:187:${goto 32}${color1}${execpi 7200 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 32}/g'}${color}${font}
conky/conky-BL/bl-right2.conky:153:${goto 20}${color1}${execpi 7200 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 20}/g'}${color}${font}
conky/conky-BL/bl-right.conky:185:${goto 27}${color1}${execpi 7200 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 27}/g'}${color}${font}
conky/year_cal_r.conky:172:${goto 15}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 15}/g'}${color}${else}${goto 10}SU MO ${color5}Jan ${time %Y}${color} FR SA
conky/year_cal_r.conky:176:${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Feb ${time %Y}${color} FR SA
conky/year_cal_r.conky:180:${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Mar ${time %Y}${color} FR SA
conky/year_cal_r.conky:184:${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Apr ${time %Y}${color} FR SA
conky/year_cal_r.conky:188:${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}May ${time %Y}${color} FR SA
Found one that uses ${goto 28} and changed it to ${goto 21} (todays date and sure enough, an OOPS! It grabbed the 21 in the first ${goto21} = week day names
21 Feb 23 @ 10:24:00 ~
$ LAR=$(date +%-d)
21 Feb 23 @ 10:24:18 ~
$ ncal -bh | sed -e ':a;N;$!ba' -e 's/\n/\n${goto 21}/g' -e 's/\<'$LAR'\>/${color0}&${color1}/'
February 2023
${goto ${color0}21${color1}}Su Mo Tu We Th Fr Sa
${goto 21} 1 2 3 4
${goto 21} 5 6 7 8 9 10 11
${goto 21}12 13 14 15 16 17 18
${goto 21}19 20 21 22 23 24 25
${goto 21}26 27 28
${goto 21}
21 Feb 23 @ 10:24:40 ~
$
There must be a change in ncal
It use to be that cal and ncal were separate programs. They were merged into one: ncal a few years back.
21 Feb 23 @ 10:28:45 ~
$ get cal
[sudo] password for sector11:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package cal
21 Feb 23 @ 10:28:56 ~
$ get ncal
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ncal is already the newest version (12.1.7+nmu3).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
21 Feb 23 @ 10:29:06 ~
$
Must check out John's fix.
Thanks John
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
John's fix is brilliant.
I'm guessing that I never caught the problem is because a few years back I stopped using the line with the Day Names to colour the current day AND change it to Spanish on my English system, Greek was added because of Teo:
${font fira mono:medium:size=14}${alignc}${color5}${time %b %Y}${font}
${alignc}${swapbar 0,90}
${alignc}${if_match ${time %w}==0}${color5}ΚΥ${color7} ΔΕ ΤΡ ΤΕ ΠΕ ΠΑ ΣΑ${else}\
${if_match ${time %w}==1}${color7}ΚΥ ${color5}ΔΕ${color7} ΤΡ ΤΕ ΠΕ ΠΑ ΣΑ${else}\
${if_match ${time %w}==2}${color7}ΚΥ ΔΕ ${color5}ΤΡ${color7} ΤΕ ΠΕ ΠΑ ΣΑ${else}\
${if_match ${time %w}==3}${color7}ΚΥ ΔΕ ΤΡ ${color5}ΤΕ${color7} ΠΕ ΠΑ ΣΑ${else}\
${if_match ${time %w}==4}${color7}ΚΥ ΔΕ ΤΡ ΤΕ ${color5}ΠΕ${color7} ΠΑ ΣΑ${else}\
${if_match ${time %w}==5}${color7}ΚΥ ΔΕ ΤΡ ΤΕ ΠΕ ${color5}ΠΑ${color7} ΣΑ${else}\
${color7}ΚΥ ΔΕ ΤΡ ΤΕ ΠΕ ΠΑ ${color5}ΣΑ${color}${endif}${endif}${endif}${endif}${endif}${endif}
${alignc}${if_match ${time %w}==0}${color5}DO${color7} LU MA MI JU VI SÁ${else}\
${if_match ${time %w}==1}${color7}DO ${color5}LU${color7} MA MI JU VI SÁ${else}\
${if_match ${time %w}==2}${color7}DO LU ${color5}MA${color7} MI JU VI SÁ${else}\
${if_match ${time %w}==3}${color7}DO LU MA ${color5}MI${color7} JU VI SÁ${else}\
${if_match ${time %w}==4}${color7}DO LU MA MI ${color5}JU${color7} VI SÁ${else}\
${if_match ${time %w}==5}${color7}DO LU MA MI JU ${color5}VI${color7} SÁ${else}\
${color7}DO LU MA MI JU VI ${color5}SÁ${color}${endif}${endif}${endif}${endif}${endif}${endif}
${color7}${goto 15}${execpi 900 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color7}/' | sed ':a;N;$!ba;s/\n/\n${goto 15}/g'}${color}
${alignc}${swapbar 0,80}
BTW: cal still works:
21 Feb 23 @ 10:53:54 ~
$ cal
February 2023
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28
21 Feb 23 @ 10:53:58 ~
$ ncal
February 2023
Su 5 12 19 26
Mo 6 13 20 27
Tu 7 14 21 28
We 1 8 15 22
Th 2 9 16 23
Fr 3 10 17 24
Sa 4 11 18 25
21 Feb 23 @ 10:54:06 ~
$ ncal -h
February 2023
Su 5 12 19 26
Mo 6 13 20 27
Tu 7 14 21 28
We 1 8 15 22
Th 2 9 16 23
Fr 3 10 17 24
Sa 4 11 18 25
21 Feb 23 @ 10:54:18 ~
$ ncal -hb
February 2023
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28
21 Feb 23 @ 10:54:22 ~
$ ncal -b
February 2023
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28
21 Feb 23 @ 10:54:27 ~
$
Check
- man cal, and
- man ncal
Same man page.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
I have it 186 conkys
That is quite a lot! I've gone through many iterations while increasing refinement and utility but never had more than 3.
Offline
Sector11 wrote:I have it 186 conkys
That is quite a lot! I've gone through many iterations while increasing refinement and utility but never had more than 3.
You misunderstood: 186 conkys with the "LAR" line, 186 traditional type calendars.
It doesn't include "LUA" calendars.
I have over 2000 conkys
- I collect them,
- bend em,
- fold em, and mutilate em.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Oh wow, 2000! When the Conky Apocalypse occurs you will be our seed bank.
Offline
And I have deleted at least that many.
I started in 2007 and still have my first conky.
It was ugly, but I was new and trying stuff.
I create my own but also 'borrow' other conkys when I see a "How did he do that. I keep it and then tweak that into my conky when if needed.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Pages: 1