You are not logged in.
buttons wrote:...I really, really want to use these full-colour xpms but the cpu usage is too high on my laptop for something that updates every second. I'll stick to my zsh scripts (running every 5-15 minutes) for these, but the rest looks pretty useful.
Hey buttons, out of curiosity how much of a difference are you seeing with the xpm's? I'm using a full bar of xpm images, but I only see about a 1% difference in cpu usage (and at that level, it's hard to say whether it's actually from the xpm's) between my xpm-enabled conkyrc and plain text conkyrc.
With conky-cli|dzen2 updating every 1 second, my cpu utilization is about 2%/1% idling (dual core). With the xpms drawn, it's about 2%/3%.
With my bash|dzen2 config updating every 3 seconds, I was idling at 10%/10% and spiking up to 30% every other second.
!
It depends on what's in your monitoring app, obviously, but I was seeing 0 CPU usage idling zsh|dzen2, and now about 1-2% CPU usage idling with conky|dzen2. Both with a couple xpms.
Thing is, the conky script (with xpms) updates much, much, much more often than my dzen (I have one called dzenlong, which updates weather and pacman every 15 minutes), while conky updates each second. The problem is with the constant updates.
Currently I'm using the following:
CPU: gpubar 0.0
Battery: gdbar + zsh + dzen, XBM 0.0
Weather and Updates: perl scripts + dzen + XPM 0.0
Date: dzen + zsh 0.0
I guess CPU and battery are the only ones updating every second, but with XBM (not colour!) they don't use any CPU even with zsh.
Cthulhu For President!
Offline
You are aware that conky's update interval can be changed in .conkyrc, right? I use 2 seconds, but you could easily change it to 15 secs or even 10 minutes:
update_interval 15
#update_interval 600
That's food for thought though and thanks for posting your findings (I've been wanting to benchmark a bit more myself, but I'm busy with finals.)
thayer williams ~ cinderwick.ca
Offline
Sure, but then the nicest parts of conky (easy cpu, mem, netspeed, etc) are mostly useless. Of course, I could make a SEPARATE conky/dzen, but then I'm already using separate dzens...
Blarg.
I think the worst problem is 1280 is just not enough pixels to fit all the crap I'd like to put in a bar
EDIT: Good luck with finals! I just had my final yesterday, now I'm avoiding christmas-break work
Last edited by buttons (2007-12-14 04:52:10)
Cthulhu For President!
Offline
Aaaand then again, conky is enormously convenient!
Um...simple battery icon switcher for dzen:
#!/bin/zsh
# vim: ft=zsh ts=4
icon() {
ac_state=`cat /proc/acpi/ac_adapter/AC/state |grep off-line`
if [[ $ac_state == "" ]]; then
print -n "^i(/home/buttons/.bitmaps/power-ac.xbm)"
else
print -n "^i(/home/buttons/.bitmaps/power-bat.xbm)"
fi
}
print "$(icon)"
Yeah, you could probably put that IN the conky code, but I prefer ${exec} for cleanliness.
We'll see if I hate it and switch back to 4 dzens I kinda miss gcpubar already.
Cthulhu For President!
Offline
If anyone is using weather.com's official interface perl script, I discovered today that weather.com had changed their icons somewhat, and the ones you'll find linked from Rob's site aren't totally correct. For instance, the icon for Partly Cloudy shows up as "HOT". At 6C, that's not the word I would've used.
So anyway, when you sign up for weather.com's xml thingie they give you a link to their SDK, which is a zip file full of icons and some other useless things. Go into the 32x32 folder and run the following (requires imagemagick):
#!/bin/sh
for i in `ls`; do
convert -resize 14x14 $i $i
convert $i `echo $i | sed -e 's/\.png/-scaled\.xpm/'`
rm $i
done
Good as new! A whole directory full of nice, scaled xpms for your use.
Should look like this:
There now, that's a bit more truthful than "HOT."
Cthulhu For President!
Offline
I know this is a little off topic but what gtk theme do you use buttons?
Offline
I know this is a little off topic but what gtk theme do you use buttons?
Divinorum. The green version, obv
Cthulhu For President!
Offline
If anyone is using weather.com's official interface perl script, I discovered today that weather.com had changed their icons somewhat, and the ones you'll find linked from Rob's site aren't totally correct. For instance, the icon for Partly Cloudy shows up as "HOT". At 6C, that's not the word I would've used.
So anyway, when you sign up for weather.com's xml thingie they give you a link to their SDK, which is a zip file full of icons and some other useless things. Go into the 32x32 folder and run the following (requires imagemagick):
Thanks for pointing this out. The weather script also cotains some alternative icons which are somewhat ugly, though the ones from weather.com are really nice and most importantly correct .
#!/bin/sh for i in `ls`; do convert -resize 14x14 $i $i convert $i `echo $i | sed -e 's/\.png/-scaled\.xpm/'` rm $i done
Good as new! A whole directory full of nice, scaled xpms for your use.
If you don't mind, a slightly slimmer version:
for i in *.png; do convert -scale 14x14 "$i" "${i%%.*}-scaled.xpm"; done
Should look like this:
http://img518.imageshack.us/img518/6748 … iewjw9.pngThere now, that's a bit more truthful than "HOT."
Cool setup
Last edited by gotmor (2007-12-16 02:32:49)
Offline
If you don't mind, a slightly slimmer version:
for i in *.png; do convert -scale 14x14 "$i" "${i%%.*}-scaled.xpm"; done
Not at all! Actually I did it in like 10 steps at first. Shell scripting was never my first love
Should look like this:
http://img518.imageshack.us/img518/6748 … iewjw9.pngThere now, that's a bit more truthful than "HOT."
Cool setup
Thanks!
Cthulhu For President!
Offline
As posted in the screenshots thread:
#!/bin/zsh # vim:ft=zsh ts=4 myvol() { percentage=`amixer |grep -A 6 \'Front\' |awk {'print $5'} |grep -m 1 % |sed -e 's/[][%]//g'` ismute=`amixer |grep -A 6 \'Front\'|awk {'print $7'} |grep -m 1 "[on|off]" | sed -e 's/[][]//g'` if [[ $ismute == "off" ]]; then print -n "$(echo "0" | gdbar -fg '#aecf96' -bg gray40 -h 7 -w 60)" else print -n "$(echo $percentage |gdbar -fg '#aecf96' -bg gray40 -h 7 -w 60)" fi } while true; do print "^i(/home/buttons/.bitmaps/volume.xbm)$(myvol)" sleep 1 done
Obviously you'll have to change the path to the bitmap, and unless you have a strange soundcard as I do, you'll probably want 'Master' rather than 'Front' as well. And if your soundcard apparently only outputs mono and has no mute function, like my Audigy ::mutter::, change the awk command in percentage to be print $4 and ignore the mute bit.
Credits go to Theomachos for providing a battery script to get me started.
I tried to get this working but the bar and percentage stays at zero.
Here's the relevant code:
# Volume
myvol() {
percentage=`amixer | grep -A 6 "Master" | awk {'print $5'} | grep -m 1 % | sed -e 's/[][%]//g'`
print -n "$(echo $percentage | gdbar -fg '#aecf96' -bg gray40 -h 7 -w 60)"
}
# Main
while true; do
VOLUME=$(myvol)
echo "^fg(#80AA83)^p(0)^i(${ICONPATH}/volume.xbm)^fg()${VOLUME}"
sleep $SLEEP
done | dzen2 -x 3 -y -3 -ta l -p -e
But:
amixer | grep -A 6 "Master" | awk {'print $5'} | grep -m 1 % | sed -e 's/[][%]//g'
outputs the correct volume percentage of the Master Volume Playback from my Audigy 2 ZS card.
What's wrong here?
Offline
What's wrong here?
Hmm. I just tried out your code, and it works for me. This isn't giving you any errors or anything if you run it from the command line? You haven't done something very silly like pipe this through bash/sh or forgotten to install gdbar from the dzen package, right?
I can't think of what's wrong if your percentage command works.
Try out just running your script from the command line (sans the | dzen after done) and post the output.
Cthulhu For President!
Offline
quarks wrote:What's wrong here?
Hmm. I just tried out your code, and it works for me. This isn't giving you any errors or anything if you run it from the command line? You haven't done something very silly like pipe this through bash/sh or forgotten to install gdbar from the dzen package, right?
I can't think of what's wrong if your percentage command works.
Try out just running your script from the command line (sans the | dzen after done) and post the output.
It works now, I forgot about the line number (which oddly didn't show in the terminal).
The function is now:
myvol() {
percentage=`amixer | grep -A 6 "Master" | awk {'print $4'} | grep -m 1 % | sed -e 's/[][%]//g'| sed -e 's/5://g'`
print -n "$(echo $percentage | gdbar -fg '#aecf96' -bg gray40 -h 7 -w 60)"
}
Offline
It works now, I forgot about the line number (which oddly didn't show in the terminal).
The function is now:myvol() { percentage=`amixer | grep -A 6 "Master" | awk {'print $4'} | grep -m 1 % | sed -e 's/[][%]//g'| sed -e 's/5://g'` print -n "$(echo $percentage | gdbar -fg '#aecf96' -bg gray40 -h 7 -w 60)" }
While your code may perfectly work, it does a bit to much spawing to extract a single value in my opinion.
So, I'd like to suggest a different solution:
This is what "amixer sget Master" outputs in my case:
Simple mixer control 'Master',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 23 [74%]
Front Right: Playback 23 [74%]
We are interested in the percentage value in between [ ]. Further we assume left/right levels are the same:
myvol() {
print `amixer sget Master|sed -ne 's/^.*Left: .*\[\([0-9]*\)%\]$/\1/p'` | gdbar
}
Have fun, Rob.
Offline
While your code may perfectly work, it does a bit to much spawing to extract a single value in my opinion.
So, I'd like to suggest a different solution:
This is what "amixer sget Master" outputs in my case:
Simple mixer control 'Master',0 Capabilities: pvolume Playback channels: Front Left - Front Right Limits: Playback 0 - 31 Mono: Front Left: Playback 23 [74%] Front Right: Playback 23 [74%]
We are interested in the percentage value in between [ ]. Further we assume left/right levels are the same:
myvol() { print `amixer sget Master|sed -ne 's/^.*Left: .*\[\([0-9]*\)%\]$/\1/p'` | gdbar }
Have fun, Rob.
Thanks, that's definetely better although I'm not sure how to get that working.
I'm not familiar with sed regex.
My output of that command is:
Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined
Playback channels: Mono
Limits: Playback 0 - 100
Mono: Playback 40 [40%] [-24.00dB]
Could you show me wat sed regular expressions to use for this?
Offline
My output of that command is:
Simple mixer control 'Master',0 Capabilities: pvolume pvolume-joined Playback channels: Mono Limits: Playback 0 - 100 Mono: Playback 40 [40%] [-24.00dB]
Could you show me wat sed regular expressions to use for this?
Sure
sed -ne 's/^.*Mono: .*\[\([0-9]*\)%\].*$/\1/p'
Basically your line starts with "Mono" (matched by: "^.*Mono:") in contrast to "Front left" and has some more things after the percentage value (matched by: ".*$").
Everything else is the same as above..
Bye, Rob.
Offline
quarks wrote:My output of that command is:
Simple mixer control 'Master',0 Capabilities: pvolume pvolume-joined Playback channels: Mono Limits: Playback 0 - 100 Mono: Playback 40 [40%] [-24.00dB]
Could you show me wat sed regular expressions to use for this?
Sure
sed -ne 's/^.*Mono: .*\[\([0-9]*\)%\].*$/\1/p'
Basically your line starts with "Mono" (matched by: "^.*Mono:") in contrast to "Front left" and has some more things after the percentage value (matched by: ".*$").
Everything else is the same as above..Bye, Rob.
Thanks, that works great.
Oh and while I'm still here; how can I integrate gcpubar in a function of an existing script?
E.g. like here: http://robm.selfip.net/wiki.sh/-main/DzenAndXmonad
Seems like I can only get it working when I use a second script.
Offline
Thanks, that works great.
Nice!
Oh and while I'm still here; how can I integrate gcpubar in a function of an existing script?
E.g. like here: http://robm.selfip.net/wiki.sh/-main/DzenAndXmonad
Seems like I can only get it working when I use a second script.
You can perfectly integrate it into a function.
Calculating the cpu usage needs at least 2 samples over some interval of time, here comes gcpubar's "-c" option into use.
And as we do not want to wait too long for the calculation we choose a small interval with the "-i" option to retrieve our samples.
The more samples we collect over time the more accurate/stable is the result, the drawback is that it will take longer until we get the actual result.
gcpubar -c 2 -i 0.2
The only problem with this method is that gcpubar will show all values, i.e. "-c 5" will print out 5 usage values, although we are only interested in the last one.
The solution is simple:
COUNT=3
IVAL=0.2
gcpubar -c $COUNT -i $IVAL | tail -1
HTH, Rob.
Offline
Rob,
I've been asked by a couple users as to whether dzen can provide 'clickable' workspace names for xmonad, similar to wmii or dwm. Is such a thing possible, or on a TODO list somewhere? I haven't tried xmobar myself, but I don't think it can do this either. Personally, I can live without it, but I admit it would be nice for those one-handed-taco-eating-times!
thayer williams ~ cinderwick.ca
Offline
Rob,
I've been asked by a couple users as to whether dzen can provide 'clickable' workspace names for xmonad, similar to wmii or dwm. Is such a thing possible, or on a TODO list somewhere? I haven't tried xmobar myself, but I don't think it can do this either. Personally, I can live without it, but I admit it would be nice for those one-handed-taco-eating-times!
Yes, it can in (horizontal) menu mode, though the real issue here is xmonad. It does not provide any means to remote control it
Example:
for i in ws:1 ws:2 ws:3 ws:4; do echo $i; done | dzen2 -m h -l 4 -p -e 'button1=menuprint;button3=exit'
Last edited by gotmor (2007-12-16 19:54:56)
Offline
quarks wrote:Thanks, that works great.
Nice!
Oh and while I'm still here; how can I integrate gcpubar in a function of an existing script?
E.g. like here: http://robm.selfip.net/wiki.sh/-main/DzenAndXmonad
Seems like I can only get it working when I use a second script.You can perfectly integrate it into a function.
Calculating the cpu usage needs at least 2 samples over some interval of time, here comes gcpubar's "-c" option into use.
And as we do not want to wait too long for the calculation we choose a small interval with the "-i" option to retrieve our samples.
The more samples we collect over time the more accurate/stable is the result, the drawback is that it will take longer until we get the actual result.gcpubar -c 2 -i 0.2
The only problem with this method is that gcpubar will show all values, i.e. "-c 5" will print out 5 usage values, although we are only interested in the last one.
The solution is simple:COUNT=3 IVAL=0.2 gcpubar -c $COUNT -i $IVAL | tail -1
HTH, Rob.
Yes, works beautifully!
Now I just need to add the HDD usage script and the script is complete.
Offline
I have installed dzen2-gadgets, but it still complains about gdbar not being found, what's wrong?
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline
Hello,
I'm just writing to inform you that dzen's wiki has moved to:
http://dzen.geekmode.org/wiki/wiki.cgi/-main/
I will keep a permanent redirect from the old site for some time,
though.
The wiki is open for everyone, so please feel free to extend and
enhance it.
Bye, Rob.
Offline
Ok, now I have shamefully solved my gdbar problem, but I have another one. My refresh rate for the volume is set to 1 (sleep 1), so it flashes constantly. Is there any way to have the volume displayed real time and not having the bar flickering?
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline
Ok, now I have shamefully solved my gdbar problem, but I have another one. My refresh rate for the volume is set to 1 (sleep 1), so it flashes constantly. Is there any way to have the volume displayed real time and not having the bar flickering?
It shouldn't do this, even on .5s. Are you sure you don't have something else trying to overwrite that area?
The answer to your second question appears to be no, unfortunately. From limited research, it looks like there are some laptop acpi modules that can control this, but that's it.
For what it's worth, I stopped using volume monitors because they use too much CPU calling amixer and parsing the output. An interesting project for someone would be to hack amixer to accept a parameter that causes it to only display the primary volume expressed as an integer, a la:
%amixer -z
70
I'm still not sure it would be worth it from a CPU-usage perspective...
Cthulhu For President!
Offline
Thanks buttons,
I have noticed that CPU consumption as well, I think I'll stick with Sonata. I can control the volume through it.
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline