You are not logged in.

#1 2007-06-28 07:47:00

cry0x
Member
Registered: 2007-04-11
Posts: 91

Conky polling rate

I wasn't sure whether to put this here or in the laptop section, but I figured that it was more conky-related than anything.


I'm running Arch on a macbook, and the ACPI readings on the battery are very sensitive. In other words, if I ask the system what the charge status is too often, it will eventually break and give me no reading. A reboot, or even a reinstall does not correct the issue. The one thing that does though, is a quick boot into OSX (via live CD, I have only Arch on this machine) and reboot into Linux. The readings are accurate once again.


When I was using GNOME I went two months without seeing this issue. Recently I switched to openbox, and use conky and conky's "battery" command to give the status via ACPI. After three hours of running this setup, the readings broke. I had heard that a frequent polling rate could affect the status. So I'm wondering if there is a way to tell conky to only get battery status via ACPI every few minutes, instead of every 30 seconds as it appears to be right now?


edit: fixed some grammar errors sad

Last edited by cry0x (2007-06-28 07:55:37)


Who is this doin' this synthetic type of alpha beta psychedelic funkin'?

Offline

#2 2007-06-28 07:57:10

WhiteMagic
Member
Registered: 2007-03-01
Posts: 85

Re: Conky polling rate

I don't know if it's possible to do change the update interval inside a single config file on a per command basis. However you could create two conky files one for your normal stuff and another one which does only the battery and perhaps other stuff that doesnt change frequently and set the update rate in that file to 30 seconds or whatever turns out to work.

Offline

#3 2007-06-28 22:07:50

somedrew
Member
From: Canada
Registered: 2007-05-14
Posts: 140

Re: Conky polling rate

Yup, execi would do the trick. It'll run a given shell command at a specific interval (so you won't have to change the global refresh rate). smile
Something like the following in your conkyrc would print out the battery reading directly from acpi every 2 minutes:

${execi 120 acpi}

You can alway do some formatting with cut to get the desired look.

http://conky.sourceforge.net/variables.html

cheers,

Last edited by somedrew (2007-06-28 22:10:15)

Offline

#4 2007-06-28 22:22:37

cry0x
Member
Registered: 2007-04-11
Posts: 91

Re: Conky polling rate

somedrew wrote:

Yup, execi would do the trick. It'll run a given shell command at a specific interval (so you won't have to change the global refresh rate). smile
Something like the following in your conkyrc would print out the battery reading directly from acpi every 2 minutes:

${execi 120 acpi}

You can alway do some formatting with cut to get the desired look.

http://conky.sourceforge.net/variables.html

cheers,

I'm not familiar with the "cut" you are speaking of. Right now I'm just doing ${execi 45 acpi -b} which returns a fairly long string:
BATTERY1: DISCHARGING, 99%, 03:32:34 REMAINING
What I'd like to display is DISCHARGING, 99%


Who is this doin' this synthetic type of alpha beta psychedelic funkin'?

Offline

#5 2007-06-28 22:43:30

smurnjiff
Member
Registered: 2007-06-25
Posts: 211

Re: Conky polling rate

A mixture of awk and sed can do that for you.  If you don't have them, then

pacman -S awk sed

Then place this in your .conkyrc

${execi 120 acpi -b | awk '{print $3, $4}' | sed -e s/,//2}

This would produce something like: "charging, 50%".


Edit: Fixed the code to only remove one comma.

Last edited by smurnjiff (2007-06-28 22:54:18)

Offline

#6 2007-06-29 21:32:52

somedrew
Member
From: Canada
Registered: 2007-05-14
Posts: 140

Re: Conky polling rate

cry0x wrote:

I'm not familiar with the "cut" you are speaking of. Right now I'm just doing ${execi 45 acpi -b} which returns a fairly long string:
BATTERY1: DISCHARGING, 99%, 03:32:34 REMAINING
What I'd like to display is DISCHARGING, 99%

Something like the following should do it if you want to use cut to filter the output. You may need to play around with the characters a bit. 'man cut' will let ya know the what, why, and hows of cut.
It's not as nice as the awk and sed suggestion, but gets the job done for me.

${execi 45 acpi -b | cut -c17-100}

cheers,

Last edited by somedrew (2007-06-29 21:41:48)

Offline

#7 2007-06-29 22:22:18

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Conky polling rate

Bookmarked smile.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#8 2007-06-30 00:15:13

smurnjiff
Member
Registered: 2007-06-25
Posts: 211

Re: Conky polling rate

Something like the following should do it if you want to use cut to filter the output. You may need to play around with the characters a bit. 'man cut' will let ya know the what, why, and hows of cut.
It's not as nice as the awk and sed suggestion, but gets the job done for me.

${execi 45 acpi -b | cut -c17-100}

This doesn't work when the AC is unplugged.  It produces discharging, 98%, 3:22:12 remaining

instead of: discharging, 98%

That's why I used sed and awk instead of cut.

Offline

#9 2007-06-30 02:57:37

cry0x
Member
Registered: 2007-04-11
Posts: 91

Re: Conky polling rate

You guys are fantastic. I need to read up on sed and awk... they appear to be very useful utilities.
Once again thankyou!

Last edited by cry0x (2007-06-30 02:57:57)


Who is this doin' this synthetic type of alpha beta psychedelic funkin'?

Offline

#10 2007-07-01 07:51:53

somedrew
Member
From: Canada
Registered: 2007-05-14
Posts: 140

Re: Conky polling rate

smurnjiff wrote:

Something like the following should do it if you want to use cut to filter the output. You may need to play around with the characters a bit. 'man cut' will let ya know the what, why, and hows of cut.
It's not as nice as the awk and sed suggestion, but gets the job done for me.

${execi 45 acpi -b | cut -c17-100}

This doesn't work when the AC is unplugged.  It produces discharging, 98%, 3:22:12 remaining

instead of: discharging, 98%

That's why I used sed and awk instead of cut.

It's an easy fix: If you want to cut it off after the percentage, just count the characters until that point and add that to the cut pipe (or just use awk and sed). I like to see the time remaining and left that in the command.

cheers

Last edited by somedrew (2007-07-01 07:57:59)

Offline

Board footer

Powered by FluxBB