You are not logged in.

#1 2009-06-21 15:27:55

Barghest
Member
From: Hanau/Germany
Registered: 2008-01-03
Posts: 563

[dzen2] 100% cpu usage

Hi,

currently I try to build a status bar that I want to use with musca.

To build this I stole some elements from other users to since I don't know very very little about this sad

I know noticed that when I use dzen my cpu usage is at 100%. In htop the dzen scripts only show up with 1 percent but I have a red cpu bar that only goes down when I stop dzen_musca.sh script.

Here is my script dzen_musca.sh

#!/bin/sh
 
FN='-xos4-terminus-*-*-*-*-10-*-*-*-*-*-*-*'
BG='#222222'
FG='#aaaaaa'
 W=980
 X=0
 Y=1050

 
  
 dzen() { dzen2 -fg $FG -bg $BG -x $BASE -y 1 -h 21 -w $WIDTH $*;}
 
 set_pos()
{
    BASE=$1
    WIDTH=$2
}

BASE=0
WIDTH=0
 
 set_pos 0 980
 while true; do
     ws=`musca -c "silent show groups" | awk -v ORS=" " '{ print ($2=="*"?"^fg(#ffffff)^bg(#535d6c)":"^fg(#aaaaaa)^bg(#222222)")$3} END{printf "\n"}'`
     window=`musca -c "silent show windows"  | awk -v ORS=" " '{ print ($2=="*"?"^fg(#ffffff)^bg(#535d6c)":"^fg(#aaaaaa)^bg(#222222)")$3} END{printf "\n"}'`
     time=`date +"%d. %B, %H:%M"`
        echo "^fg()^bg() $ws^bg(#222222):: $window"
done | dzen -ta l &

set_pos 1473 122
 while true; do
time=`date +"%d. %B, %H:%M"`
     echo "^fg(#aaaaaa)^bg(#222222)$time"
 done | dzen -ta r  &
 
set_pos 973 500
conky -qc ~/.config/dzonky/dzonky-mpd | dzen -ta r & 
 
exit 0

and the one for mpd:

background no
out_to_console yes
update_interval 3
use_spacer none

TEXT
^i(/home/thomas/.icons/dzen/note.xbm) ${if_mpd_playing}$mpd_artist - $mpd_title${else}Stopped${endif} ::

So, anything I can improve here?

Thanks!

Last edited by Barghest (2009-06-21 18:12:55)

Offline

#2 2009-06-21 18:15:46

Barghest
Member
From: Hanau/Germany
Registered: 2008-01-03
Posts: 563

Re: [dzen2] 100% cpu usage

Ok, I replaced the while : do part for the date with a conky-cli

set_pos 1473 122
 conky -qc ~/.config/dzonky/dzonky-clock | dzen -ta r  &

And I'm on 80% cpu usage. I guess it is caused by the part that reads the group and the window name. Is there a way to get this with lesser cpu usage?

After spending some more time I think I'm on a decent usage level.

I added TIME_INT=0.3

and added sleep $TIME_INT; before done | dzen2

Sometime I notice the delay but I guess I have to live with it?

Last edited by Barghest (2009-06-21 18:50:40)

Offline

Board footer

Powered by FluxBB