You are not logged in.

#1 2009-07-16 23:37:00

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Continuous scripts in conky?

I would like to know if there is a way to run scripts that go continuously in conky. For example, I have one that displays the volume in the command line and just remains running, displaying the new volume instantly when I change the volume with the keyboard. Can I have this sort of behavior in conky without too much CPU usage? Right now, I have to wait until conky's update_interval passes until I see any changes. Making the update_interval really small increases my CPU usage by a lot, which I do not want to do.

Here is the volume script I'm talking about:

#1/bin/bash
while true; do sleep 0.1; vol=$(amixer get Master | awk -F'[]%[]' '/%/ {if ($7 == "off") { print "MM" } else { print $2 }}' | head -n 1);  echo -n -e '\r'Vol: $vol%; done

дɭɭɑӎɠїɾ

Offline

#2 2009-07-17 00:12:31

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Continuous scripts in conky?

Are you using something like this? I don't have conky so I can't test. So is once or twice per second enough, and does this cause heavy CPU usage?

{execi 1 amixer get Master | awk -F'[]%[]' '/%/ {if ($7 == "off") { print "Vol: MM" } else { print "Vol:",$2 }}'}

Offline

#3 2009-07-17 00:20:47

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Re: Continuous scripts in conky?

I tried using something like that; I even used the exact command you posted, and the problem is that the volume won't update any faster than the rest of conky will.

When I was using xmonad (now dwm), xmobar would use hardly any cpu because I set some plugins (like network status, time, etc.) to update every 30 seconds to a minute, whereas things like volume were updated every half-second. I was hoping I could get something like this with the dwm status bar, that is, all the information in my conkyrc here:

# Conky, a system monitor, based on torsmo

background no
total_run_times 0
#cpu_avg_samples 2
#net_avg_samples 2
#no_buffers yes
out_to_console yes
#out_to_stderr no
update_interval 2
#uppercase no
use_spacer none

TEXT
±${battery_time BAT1}(${battery_short BAT1}) cpu0/1: ${cpu cpu0}% ${cpu cpu1}% mem: $memperc% ($mem) ${exec /home/agi/.bin/volume.sh} ${exec /home/agi/.bin/wireless.sh} ${time %a %b %d %I:%M%P}

but with minimal cpu/memory usage (I usually have 1-3% when idle). Part of the reason I switched to dwm is that it's so light!


дɭɭɑӎɠїɾ

Offline

#4 2009-07-17 09:01:17

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: Continuous scripts in conky?

Why not make a separate small conky just for volume with a different update_interval?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#5 2009-07-17 12:04:48

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Re: Continuous scripts in conky?

That sounds like a good idea. I think i found a post on the ubuntu forums somewhere about how to do this, but would it be possible to have this new conky in the middle of the other one, or would it have to be next to it (on the left/right of all content in the first conky?)

Last edited by Allamgir (2009-07-17 12:05:30)


дɭɭɑӎɠїɾ

Offline

#6 2009-07-18 14:34:59

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: Continuous scripts in conky?

Your conky can be anywhere you want it to be. So if your current conky is:-

AAAAAAAAAAA
BBBBBBBBBBB
CCCCCCCCCCC
DDDDDDDDDD

You can take out the C line, put it in another conky, change the vertical displacement, and get the exact same layout (don't forget to leave a blank line in the first conky's TEXT for space for the 2nd conky.


EDIT: Now that I think about it, you MAY encounter problems due to conky lacking TRUE transparency. Referring back to the above example, maybe split it into three conkys (one containing A and B, the other containing your fast-updating C, and the last containing D).

Last edited by ngoonee (2009-07-18 14:36:32)


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#7 2009-07-29 10:12:09

TheBodziO
Member
From: Dukla, Poland
Registered: 2006-07-28
Posts: 230
Website

Re: Continuous scripts in conky?

How about using $mixer function? (STM)

About polling intervals: there's an idea to provide a way to update specified conky variables externally on a "signal". This is low priority but still… is there. smile


It's not the best thing when they call you a "member" you know… wink

Offline

Board footer

Powered by FluxBB