SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-05-20 08:28:35

DasFox
#! Member
Registered: 2010-06-05
Posts: 74

Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

This is a conky config I'm using;

http://pastebin.com/8ihXGD8G

In 1.8.1 I didn't have any problems, so I'm at a loss to understand why the calendar  now appears out of place, here's a screen shot;

http://postimage.org/image/p3hzt9scn/full/

So for line 65 of the pastebin for the Calendar;

${offset 156}${execpi 300 DJS=`date +%_d`; cal | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color red}'"$DJS"'${color}'" "/}

How can I fix it so the calendar is under the Month and the Year, 'May 2012'?


THANKS

Last edited by DasFox (2012-05-20 08:29:55)

Offline

Be excellent to each other!

#2 2012-05-20 15:52:09

VastOne
#! Ranger
From: #! Fringe Division
Registered: 2011-04-26
Posts: 9,703
Website

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

I would start by altering {offset 156} and making it {offset 186} to see what that does to the overall conky and work it either forwards or backwards form there


VSIDO
If you build it, they will come...
Words That Build Or Destroy

Offline

#3 2012-05-20 18:15:31

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 819

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

I think each line of the calendar needs its own ${offset X}.
The way you have it right now the ${offset 156} only affects the first line of the ${execpi} output so only the "May 2012" is moved.
There was a regression in conky v1.8.1 that broke the alignment of multi line ${execpi} output.
Maybe you were taking advantage of this bug without knowing it?

Offline

#4 2012-05-21 01:58:33

DasFox
#! Member
Registered: 2010-06-05
Posts: 74

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

VastOne wrote:

I would start by altering {offset 156} and making it {offset 186} to see what that does to the overall conky and work it either forwards or backwards form there

This only moves the Month & Year the Calendar is still on the left...

arclance wrote:

I think each line of the calendar needs its own ${offset X}.
The way you have it right now the ${offset 156} only affects the first line of the ${execpi} output so only the "May 2012" is moved.
There was a regression in conky v1.8.1 that broke the alignment of multi line ${execpi} output.
Maybe you were taking advantage of this bug without knowing it?

In 1.9.0 I shouldn't be using ${execpi}?

So how do I change this line of code?

${offset 156}${execpi 300 DJS=`date +%_d`; cal | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color red}'"$DJS"'${color}'" "/}

Last edited by DasFox (2012-05-21 01:59:44)

Offline

#5 2012-05-21 02:15:58

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 819

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

DasFox wrote:
VastOne wrote:

I would start by altering {offset 156} and making it {offset 186} to see what that does to the overall conky and work it either forwards or backwards form there

This only moves the Month & Year the Calendar is still on the left...

arclance wrote:

I think each line of the calendar needs its own ${offset X}.
The way you have it right now the ${offset 156} only affects the first line of the ${execpi} output so only the "May 2012" is moved.
There was a regression in conky v1.8.1 that broke the alignment of multi line ${execpi} output.
Maybe you were taking advantage of this bug without knowing it?

In 1.9.0 I shouldn't be using ${execpi}?

So how do I change this line of code?

${offset 156}${execpi 300 DJS=`date +%_d`; cal | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color red}'"$DJS"'${color}'" "/}

You should be using ${execpi} in 1.9.0, it works the same in 1.8.0 and 1.9.0,
Something broke ${execpi} for multi-line output in 1.8.1 so ${execpi} will not work the way it did in 1.8.1 in any other version of conky.

I don't know any regex so I can't fix the line for you but I can tell you what I would try.
Try adding a command that replaces the string "\n" with "\n${offset 156}".
If sed recognizes the newline character (\n) this shoud put a ${offset 156} at the beginning of each line except the first line.
You may need to adjust the offset amount since the calendar lines are a different length than the "Month Year" line.

Last edited by arclance (2012-05-21 02:21:37)

Offline

#6 2012-05-21 03:09:40

DasFox
#! Member
Registered: 2010-06-05
Posts: 74

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

arclance can you just show me the code as you'd correct it?

Just take this code below and change it the way you would, because if I don't see an example then I don't understand...

${offset 156}${execpi 300 DJS=`date +%_d`; cal | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color red}'"$DJS"'${color}'" "/}


THANKS

Last edited by DasFox (2012-05-21 03:10:25)

Offline

#7 2012-05-21 03:34:58

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 819

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

DasFox wrote:

arclance can you just show me the code as you'd correct it?

Just take this code below and change it the way you would, because if I don't see an example then I don't understand...

${offset 156}${execpi 300 DJS=`date +%_d`; cal | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color red}'"$DJS"'${color}'" "/}


THANKS

It took me a lot of google searching since I don't use sed but this works for me

DJS=`date +%_d`; cal | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color red}'"$DJS"'${color}'" "/ | sed ':a;N;$!ba;s/\n/\n${offset 156}/g'

It produced output like this in a terminal.

       May 2012 
${offset 156} Su Mo Tu We Th Fr Sa 
${offset 156}        1  2  3  4  5 
${offset 156}  6  7  8  9 10 11 12 
${offset 156} 13 14 15 16 17 18 19 
${offset 156} ${color red}20${color} 21 22 23 24 25 26 
${offset 156} 27 28 29 30 31 

So try this in your .conkyrc and see what happens, it works with conky v1.9.0 for me.

${offset 156}${execpi 300 DJS=`date +%_d`; cal | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color red}'"$DJS"'${color}'" "/ | sed ':a;N;$!ba;s/\n/\n${offset 156}/g'}

The first ${offset 156} controls the position of the "Month Year" line and the ${offset 156} in the ${execpi} controls the position of the other lines.

Last edited by arclance (2012-05-21 03:43:39)

Offline

#8 2012-05-21 04:15:36

DasFox
#! Member
Registered: 2010-06-05
Posts: 74

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

Thanks arclance! smile

Now that I stop and look at this, do I really need to use the calendar like this with all the Sed, or is there a simpler cleaner way I can do this?

I found out this is working the same;

${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color red}'"$DJS"'$color'/}

How can I add the offset to the end of this?

THANKS

Last edited by DasFox (2012-05-21 04:42:18)

Offline

#9 2012-05-21 05:13:13

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 819

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

DasFox wrote:

Thanks arclance! smile

Now that I stop and look at this, do I really need to use the calendar like this with all the Sed, or is there a simpler cleaner way I can do this?

I found out this is working the same;

${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color red}'"$DJS"'$color'/}

How can I add the offset to the end of this?

THANKS

Like this.

${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color red}'"$DJS"'$color'/ | sed ':a;N;$!ba;s/\n/\n${offset 156}/g'}

Someone who is more familiar with sed might be able to combine those two seds though.

Offline

#10 2012-05-23 01:05:31

DasFox
#! Member
Registered: 2010-06-05
Posts: 74

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

arclance wrote:
DasFox wrote:

Thanks arclance! smile

Now that I stop and look at this, do I really need to use the calendar like this with all the Sed, or is there a simpler cleaner way I can do this?

I found out this is working the same;

${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color red}'"$DJS"'$color'/}

How can I add the offset to the end of this?

THANKS

Like this.

${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color red}'"$DJS"'$color'/ | sed ':a;N;$!ba;s/\n/\n${offset 156}/g'}

Someone who is more familiar with sed might be able to combine those two seds though.

So would this last method be better then the first?

Thank you very much arclance! wink

By the way does anyone know how to further improve this, does it need to be with sed?


THANKS

Offline

#11 2012-05-23 01:39:37

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 819

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

DasFox wrote:

So would this last method be better then the first?

Thank you very much arclance! wink

By the way does anyone know how to further improve this, does it need to be with sed?


THANKS

I don't use sed much so I can't say which method is better.

You don't have to use sed, you could write a program in something like python or lua to do the same thing.

I have a python script that reads the calendar file from a program like Evolution or Thunderbird and outputs a calendar with the days with appointments highlighted.
It could easily be modified to change the alignment to match what you have now if you wanted to use it.

Last edited by arclance (2012-05-23 01:39:48)

Offline

#12 2012-05-23 06:05:32

DasFox
#! Member
Registered: 2010-06-05
Posts: 74

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

arclance wrote:
DasFox wrote:

So would this last method be better then the first?

Thank you very much arclance! wink

By the way does anyone know how to further improve this, does it need to be with sed?


THANKS

I don't use sed much so I can't say which method is better.

You don't have to use sed, you could write a program in something like python or lua to do the same thing.

I have a python script that reads the calendar file from a program like Evolution or Thunderbird and outputs a calendar with the days with appointments highlighted.
It could easily be modified to change the alignment to match what you have now if you wanted to use it.


So it's either using Sed or writing a script?

What I mean is, if you just use the conky code to make a calendar sed is the normal method?


THANKS

Last edited by DasFox (2012-05-23 06:05:53)

Offline

#13 2012-05-24 19:48:38

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 819

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

DasFox wrote:

So it's either using Sed or writing a script?

What I mean is, if you just use the conky code to make a calendar sed is the normal method?


THANKS

Yes it's either sed (or some other command for processing strings) or writing a script.
Using sed is fine, I would use whatever method you are most comfortable with modifying yourself.

Offline

#14 2012-05-30 01:22:27

DasFox
#! Member
Registered: 2010-06-05
Posts: 74

Re: Updated To Conky 1.9.0 - Now Calendar Is Off Centered?

Ok I wasn't sure if sed is ok, or if there was a better way...


THANKS

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo