You are not logged in.

#76 2008-01-01 14:17:41

quarks
Member
From: Netherlands
Registered: 2007-05-14
Posts: 66

Re: dzen & xmobar Hacking Thread

gotmor wrote:
quarks wrote:

I'm having some trouble getting the new gcpubarG to work.
I wan't it to be a small rectangular graph like in gotmor's screenshot.  however
"gcpubarg -s g -w 200 -h 16 -gs 1 -gw 3" displays the usage options in the dzen statusbar and with just "gcpubarg" dzen doesn't even show up.

Executing "gcpubarg" on the command line gives the correct values I guess ("^fg(white)^p(1)^r(1x0+0-1" and so on).

gcpubarG is obsolete, you just need to grab the latest development version of dzen:

svn checkout http://dzen.googlecode.com/svn/trunk/ dzen

and use the gcpubar that comes with it.

Have a look at the Wiki entry for further details.

I have the latest gcpubar from the svn repo (I just renamed it to gcpubarg because I didn't remove the old gcpubar).
When I comment out "gcpubar -s graph", dzen2 starts just fine.

I use it in a function like this:

fcpu() {
    gcpubar -s graph
}

while :; do
PCPU=$(fcpu)

echo " ^fg(#EEEEEE)${PCPU}"

done | dzen2 some values...

Offline

#77 2008-01-01 19:07:38

redbeard0531
Member
Registered: 2007-12-28
Posts: 12

Re: dzen & xmobar Hacking Thread

gcpubar loops on its own, so it is designed to be piped directly into dzen. This is how I use it (relevant parts of a longer script).

alias my_dzen='dzen2 -xs 1 -h 18 -x $BASE -tw $WIDTH -fg $FG -bg $BG'

set_pos (){ # set_pos width_in_pixels
    BASE=$(echo $BASE + $WIDTH | bc)
    WIDTH=$1
}

BASE=0
WIDTH=0

set_pos 75
gcpubar -h 18 -w 50 -gs 0 -gw 1 -i 2  -s g -l "^i(${ICONPATH}/cpu.xbm)" \
  | my_dzen -fn $FONT -e '' -ta l&

Offline

#78 2008-01-02 10:41:53

aeolist
Member
Registered: 2007-06-03
Posts: 10

Re: dzen & xmobar Hacking Thread

thanks for your replies

i put dzen2-gadgets-svn on aur yesterday, it's patched for xpm + xinerama support

rob, now that you have done all the hard work with gcpubar, how about adding info for the individual cores as well?
mmm, maybe we could have a temp version as well, gonna look in the code and see how complicated it is

Last edited by aeolist (2008-01-02 10:44:48)

Offline

#79 2008-01-03 13:51:10

Don-DiZzLe
Member
From: Nederland
Registered: 2007-03-31
Posts: 233

Re: dzen & xmobar Hacking Thread

I've modified quarks's dzen script a bit for my needs, but I have a little problem with volume function, it doesnt display the current volume level. The bar stays at 0 the whole time and increasing/decreasing the volume doesnt change it. I just replaced in the percentage line from Master to PCM.

Here is the script:

#!/bin/zsh

# Gauge background colour
GAUGEBG='#323232'
# Gauge foreground colour
GAUGEFG='#8ba574'
# Path to your Dzen icons
ICONPATH=~/.dzen/bitmaps
# Network interface
INTERFACE=eth0
# Sound device for volume control
SNDDEVICE=PCM
# Date formating
DATE_FORMAT='%A, %d.%m.%Y %H:%M:%S'

# Main loop interval in seconds
SLEEP=1

# Function calling intervals in seconds
DATEIVAL=1

CPUTEMPIVAL=60

VOLUMEIVAL=1

##################################################################


# Time and date
##################################################################
DATE_FORMAT='%A, %d.%m.%Y %H:%M:%S'

fdate() {
    date +${DATE_FORMAT}
}
##################################################################


# CPU use
##################################################################
fcpu() {
   ~/.dzen/gcpubar -c 5 -i 0.1 -fg $GAUGEFG -bg $GAUGEBG -h 7 -w 70 | tail -1
}
##################################################################


# CPU temp
##################################################################
fcputemp() {
   print -n ${(@)$(</proc/acpi/thermal_zone/THRM/temperature)[2,3]}
}
##################################################################


# Network
##################################################################

# Here we remember the previous rx/tx counts
RXB=`cat /sys/class/net/${INTERFACE}/statistics/rx_bytes`
TXB=`cat /sys/class/net/${INTERFACE}/statistics/tx_bytes`



fvolume() {
    percentage=`amixer sget PCM | sed -ne 's/^.*Mono: .*\[\([0-9]*\)%\].*$/\1/p'`
    # print -n "$(echo $percentage | gdbar -fg $GAUGEFG -bg $GAUGEBG -h 7 -w 60)"

if [[ $percentage == 100 ]]
then
    print -n "$(echo $percentage | ~/.dzen/gdbar -fg '#319845' -bg $GAUGEBG -h 7 -w 60)" # Volume full
elif [[ $percentage -gt 50 ]]
then
    print -n "$(echo $percentage | ~/.dzen/gdbar -fg '#7CA655' -bg $GAUGEBG -h 7 -w 60)" # Volume half to full
elif [[ $percentage -gt 25 ]]
then
    print -n "$(echo $percentage | ~/.dzen/gdbar -fg $GAUGEFG -bg $GAUGEBG -h 7 -w 60)" # Volume quarter to half
elif [[ $percentage -lt 26 ]]
then
    print -n "$(echo $percentage | ~/.dzen/gdbar -fg '#888E82' -bg $GAUGEBG -h 7 -w 60)" # Volume low to quarter
fi

}


# Command to increase the volume
CI="amixer -c0 sset PCM 2dB+ >/dev/null"
# Command to decrease the volume
CD="amixer -c0 sset PCM 2dB- >/dev/null"




# Main function


DATECOUNTER=0;CPUTEMPCOUNTER=0;VOLUMECOUNTER=0

# Execute everything once
PDATE=$(fdate)

PCPU=$(fcpu)
PCPUTEMP=$(fcputemp)
PHD=$(fhd)
PVOLUME=$(fvolume)


# Main loop
while :; do

PCPU=$(fcpu)
PHD=$(fhd)

   if [ $DATECOUNTER -ge $DATEIVAL ]; then
     PDATE=$(fdate)
     DATECOUNTER=0
   fi



   if [ $CPUTEMPCOUNTER -ge $CPUTEMPIVAL ]; then
     PCPUTEMP=$(fcputemp)
     CPUTEMPCOUNTER=0
   fi

   if [ $VOLUMECOUNTER -ge $VOLUMEIVAL ]; then
     PVOLUME=$(fvolume)
     VOLUMECOUNTER=0
   fi


    # Get new rx/tx counts
    RXBN=`cat /sys/class/net/${INTERFACE}/statistics/rx_bytes`
    TXBN=`cat /sys/class/net/${INTERFACE}/statistics/tx_bytes`

    # Calculate the rates
    # format the values to 4 digit fields
    RXR=$(printf "%4d\n" $(echo "($RXBN - $RXB) / 1024/${SLEEP}" | bc))
    TXR=$(printf "%4d\n" $(echo "($TXBN - $TXB) / 1024/${SLEEP}" | bc))

    # Print out
    echo "| ^fg(#80AA83)^p(0)^i(${ICONPATH}/load.xbm) ^fg()${PCPU} | ^fg(#80AA83)^i(${ICONPATH}/temp.xbm)^fg()${PCPUTEMP}° | ${INTERFACE}:^fg(white)${RXR}kB/s^fg(#80AA83)^p(0)^i(${ICONPATH}/arr_down.xbm)^fg(white)${TXR}kB/s^fg(orange3)^p(0)^i(${ICONPATH}/arr_up.xbm)^fg() | ^fg()${PGTIME}| ^fg(#FFFFFF)${PDATE}  | ^fg(#80AA83)^p(0)^i(${ICONPATH}/volume.xbm)^fg()${PVOLUME}"

    # Reset old rates
    RXB=$RXBN; TXB=$TXBN

   DATECOUNTER=$((DATECOUNTER+1))
   CPUTEMPCOUNTER=$((CPUTEMPCOUNTER+1))
   VOLUMECOUNTER=$((VOLUMECOUNTER+1))

sleep $SLEEP

# Pass it to dzen
done | ~/.dzen/dzen2 -bg '#000000' -fg '#FFFFFF' -ta r -h 14 -p -e "button2=exec:$TOGGLE;button4=exec:$CI;button5=exec:$CD" -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*'

How do I fix it?

Offline

#80 2008-01-03 14:09:05

redbeard0531
Member
Registered: 2007-12-28
Posts: 12

Re: dzen & xmobar Hacking Thread

Don-DiZzLe wrote:

I've modified quarks's dzen script a bit for my needs, but I have a little problem with volume function, it doesnt display the current volume level. The bar stays at 0 the whole time and increasing/decreasing the volume doesnt change it. I just replaced in the percentage line from Master to PCM.

Here is the script:

[snip]

How do I fix it?

Whats the output of just:

amixer sget PCM

Offline

#81 2008-01-03 14:20:37

Don-DiZzLe
Member
From: Nederland
Registered: 2007-03-31
Posts: 233

Re: dzen & xmobar Hacking Thread

This is the output of that command:

control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 19 [61%] [-6.00dB] [on]
  Front Right: Playback 19 [61%] [-6.00dB] [on]

Offline

#82 2008-01-04 01:09:03

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

Ashren wrote:

I've encountered one strange bug, when firing up xmonad, the separators i.e.(^r(2x15)) sometimes grows considerably in length. Anyone else noticed this?

Happens here with fvwm too (using dzen2 build from community).
Here's my current dzen2 setup with conky-cli after a few hours of messing around.
(date, cpu, memory, file system, network, mpd)
I had a nice conky setup just yesterday, so it's a bit confusing like this, but I think I'll stick with this one for atleast a while! Next stop would be to learn them drop-downs with dzen. (I'd like just one dzen running with multiple drop-downs from it, but haven't got that far yet..)
Font: lime
Icons: self made (8x8 px)

EDIT: The bar is just as it is at the moment, colors and icons are NOT final, they're just there for a reminder.. but still, I'm keeping it.. even just for that purpose wink

Last edited by sm4tik (2008-01-04 01:26:23)

Offline

#83 2008-01-04 08:32:35

gotmor
Member
From: Germany
Registered: 2007-09-03
Posts: 84
Website

Re: dzen & xmobar Hacking Thread

sm4tik wrote:
Ashren wrote:

I've encountered one strange bug, when firing up xmonad, the separators i.e.(^r(2x15)) sometimes grows considerably in length. Anyone else noticed this?

Happens here with fvwm too (using dzen2 build from community).

Hmm, strange indeed. I never experienced that bug. I will try to isolate the problem, though.

Here's my current dzen2 setup with conky-cli after a few hours of messing around.
(date, cpu, memory, file system, network, mpd)
I had a nice conky setup just yesterday, so it's a bit confusing like this, but I think I'll stick with this one for atleast a while! Next stop would be to learn them drop-downs with dzen. (I'd like just one dzen running with multiple drop-downs from it, but haven't got that far yet..)
Font: lime
Icons: self made (8x8 px)

I like the icons a lot, please upload them to wiki http://dzen.geekmode.org/wiki/wiki.cgi/ … nIconPacks

Offline

#84 2008-01-04 20:11:24

Don-DiZzLe
Member
From: Nederland
Registered: 2007-03-31
Posts: 233

Re: dzen & xmobar Hacking Thread

I'm getting some weird errors with this script, can someone please take a look at it and see if there's something wrong with it?

status.sh:

# Configuration
DATE_FORMAT='%A, %d.%m.%Y %H:%M:%S'
CI="amixer -c0 sset PCM 2dB+ >/dev/null"
CD="amixer -c0 sset PCM 2dB- >/dev/null"
MAX=`amixer -c0 get PCM | awk '/^  Limits/ { print $5 }'`
CV="amixer -c0 get PCM | awk '/^  Front Left/ { print \$4 \" \" $MAX }'"
SNDDEVICE=PCM
INTERFACE=eth0
RXB=`cat /sys/class/net/${INTERFACE}/statistics/rx_bytes`
TXB=`cat /sys/class/net/${INTERFACE}/statistics/tx_bytes`
DZEN_ICONPATH=~/.dzen/bitmaps
#WEATHER_FORECASTER=/path/to/dzenWeather.pl

# Main loop interval in seconds
INTERVAL=1

# function calling intervals in seconds
DATEIVAL=1
CPUTEMPIVAL=1
VOLUMEIVAL=1
#WEATHERIVAL=1800

# Functions
fdate() {
    date +${DATE_FORMAT}
}

fcputemp() {
   print -n ${(@)$(</proc/acpi/thermal_zone/THRM/temperature)[2,3]}
}

fvolume() {
    eval "$CV" | ~/.dzen/gdbar -h 7 -w 60 -fg '#a8a3f5' -bg '#333'
}

fcpu() {
   ~/.dzen/gcpubar -c 5 -i 0.1
}

#fweather() {
#    $WEATHER_FORECASTER
#}


# Main

# initialize data
DATECOUNTER=0;CPUTEMPCOUNTER=0;#WEATHERCOUNTER=0
PDATE=$(fdate)
PCPUTEMP=$(fcputemp)
#PWEATHER=$(fweather)

while true; do

    PVOLUME=$(fvolume)
    PCPU=$(fcpu)

    if [ $DATECOUNTER -ge $DATEIVAL ]; then
        PDATE=$(fdate)
        DATECOUNTER=0
    fi
    if [ $CPUTEMPCOUNTER -ge $CPUTEMPIVAL ]; then
        PCPUTEMP=$(fcputemp)
        CPUTEMPCOUNTER=0
    fi

#    if [ $WEATHERCOUNTER -ge $WEATHERIVAL ]; then
#        PWEATHER=$(fweather)
#        WEATHERCOUNTER=0
#    fi

    RXBN=`cat /sys/class/net/${INTERFACE}/statistics/rx_bytes`
    TXBN=`cat /sys/class/net/${INTERFACE}/statistics/tx_bytes`
    RXR=$(printf "%4d\n" $(echo "($RXBN - $RXB) / 1024/${SLEEP}" | bc))
    TXR=$(printf "%4d\n" $(echo "($TXBN - $TXB) / 1024/${SLEEP}" | bc))

    # Arrange and print the status line
    print "^fg(#80AA83)^p(0)^i(${ICONPATH}/load.xbm) ^fg()${PCPU} | ^fg(#80AA83)^i(${ICONPATH}/temp.xbm)^fg()${PCPUTEMP}° | ${INTERFACE}:^fg(white)${RXR}kB/s^fg(#80AA83)^p(0)^i(${ICONPATH}/arr_down.xbm)^fg(white)${TXR}kB/s^fg(orange3)^p(0)^i(${ICONPATH}/arr_up.xbm)^fg() | ^fg(white)${PDATE}^fg() | ^fg(#80AA83)^p(0)^i(${ICONPATH}/volume.xbm)^fg()${PVOLUME}"

    RXB=$RXBN; TXB=$TXBN

    DATECOUNTER=$((DATECOUNTER+1))
    CPUTEMPCOUNTER=$((CPUTEMPCOUNTER+1))
#    WEATHERCOUNTER=$((WEATHERCOUNTER+1))

   sleep $INTERVAL
done | ~/.dzen/dzen2 -x 640 -bg '#000000' -fg '#FFFFFF' -ta r -h 14 -p -e "button3=exit;button4=exec:$CI;button5=exec:$CD" -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*'

the errors:

date: extra operand `%d.%m.%Y'
Try `date --help' for more information.
./status.sh: line 29: ${(@)$(</proc/acpi/thermal_zone/THRM/temperature)[2,3]}: bad substitution
(standard_in) 2: parse error
(standard_in) 2: parse error
./status.sh: line 78: print: command not found

Last edited by Don-DiZzLe (2008-01-04 20:11:50)

Offline

#85 2008-01-05 02:16:48

codemac
Member
From: North Carolina
Registered: 2005-05-13
Posts: 776
Website

Re: dzen & xmobar Hacking Thread

That is a zsh script, not an sh script.  Add #!/bin/zsh to the top of it, and then come back if there are still more problems.

Offline

#86 2008-01-05 05:18:50

Evanlec
Member
From: NH, USA
Registered: 2007-12-16
Posts: 140
Website

Re: dzen & xmobar Hacking Thread

Don-DiZzLe wrote:

I'm getting some weird errors with this script, can someone please take a look at it and see if there's something wrong with it?


the errors:

date: extra operand `%d.%m.%Y'
Try `date --help' for more information.
./status.sh: line 29: ${(@)$(</proc/acpi/thermal_zone/THRM/temperature)[2,3]}: bad substitution
(standard_in) 2: parse error
(standard_in) 2: parse error
./status.sh: line 78: print: command not found

also its unlikely that the file /proc/acpi/thermal_zone/THRM/temperature  exists on your system (it didnt on mine).

I ended up piping output from lm-sensors using the 'sensors' cmd and cutting out the relevant info (CPU Temp:)

Offline

#87 2008-01-05 11:13:04

Don-DiZzLe
Member
From: Nederland
Registered: 2007-03-31
Posts: 233

Re: dzen & xmobar Hacking Thread

Its working now, I forgot to put the #!/bin/zsh in the top of the file.

Offline

#88 2008-01-05 13:38:09

quarks
Member
From: Netherlands
Registered: 2007-05-14
Posts: 66

Re: dzen & xmobar Hacking Thread

Evanlec wrote:
Don-DiZzLe wrote:

I'm getting some weird errors with this script, can someone please take a look at it and see if there's something wrong with it?


the errors:

date: extra operand `%d.%m.%Y'
Try `date --help' for more information.
./status.sh: line 29: ${(@)$(</proc/acpi/thermal_zone/THRM/temperature)[2,3]}: bad substitution
(standard_in) 2: parse error
(standard_in) 2: parse error
./status.sh: line 78: print: command not found

also its unlikely that the file /proc/acpi/thermal_zone/THRM/temperature  exists on your system (it didnt on mine).

I ended up piping output from lm-sensors using the 'sensors' cmd and cutting out the relevant info (CPU Temp:)

Yes, it's better to use sensors.
Something like this:

fcputemp() {
   temp=`sensors | grep 'Core' | cut -c 15- | cut -c -6`
   print -n "$(echo $temp)"
}

Offline

#89 2008-01-05 14:19:24

Don-DiZzLe
Member
From: Nederland
Registered: 2007-03-31
Posts: 233

Re: dzen & xmobar Hacking Thread

Ok this is what I got so far

#!/bin/zsh

# Configuration
DATE_FORMAT='%A, %d-%m-%Y %H:%M:%S'
CI="amixer -c0 sset PCM 2dB+ >/dev/null"
CD="amixer -c0 sset PCM 2dB- >/dev/null"
MAX=`amixer -c0 get PCM | awk '/^  Limits/ { print $5 }'`
CV="amixer -c0 get PCM | awk '/^  Front Left/ { print \$4 \" \" $MAX }'"
SNDDEVICE=PCM
INTERFACE=eth0
RXB=`cat /sys/class/net/${INTERFACE}/statistics/rx_bytes`
TXB=`cat /sys/class/net/${INTERFACE}/statistics/tx_bytes`
ICONPATH=~/.dzen/bitmaps
#WEATHER_FORECASTER=/path/to/dzenWeather.pl

# Main loop interval in seconds
INTERVAL=1

# function calling intervals in seconds
DATEIVAL=1
CPUTEMPIVAL=1
VOLUMEIVAL=1
#WEATHERIVAL=1800

# Functions
fdate() {
    date +${DATE_FORMAT}
}

fcputemp() {
   temp=`sensors | grep 'Core' | cut -c 15- | cut -c -6`
   print -n "$(echo $temp)"
}

#fcputemp() {
   #print -n ${(@)$(</proc/acpi/thermal_zone/THRM/temperature)[2,3]}
#}

fvolume() {
    eval "$CV" | ~/.dzen/gdbar -h 7 -w 50 -fg '#a8a3f5' -bg '#333'
}

fcpu() {
   ~/.dzen/gcpubar -c 5 -i 0.1 -fg $GAUGEFG -bg $GAUGEBG -h 7 -w 70 | tail -1
}

#fweather() {
#    $WEATHER_FORECASTER
#}


# Main

# initialize data
DATECOUNTER=0;CPUTEMPCOUNTER=0;#WEATHERCOUNTER=0
PDATE=$(fdate)
PCPUTEMP=$(fcputemp)
#PWEATHER=$(fweather)

while true; do

    PVOLUME=$(fvolume)
    PCPU=$(fcpu)

    if [ $DATECOUNTER -ge $DATEIVAL ]; then
        PDATE=$(fdate)
        DATECOUNTER=0
    fi
    if [ $CPUTEMPCOUNTER -ge $CPUTEMPIVAL ]; then
        PCPUTEMP=$(fcputemp)
        CPUTEMPCOUNTER=0
    fi

#    if [ $WEATHERCOUNTER -ge $WEATHERIVAL ]; then
#        PWEATHER=$(fweather)
#        WEATHERCOUNTER=0
#    fi

    RXBN=`cat /sys/class/net/${INTERFACE}/statistics/rx_bytes`
    TXBN=`cat /sys/class/net/${INTERFACE}/statistics/tx_bytes`
    RXR=$(printf "%4d\n" $(echo "($RXBN - $RXB) / 1024/${SLEEP}" | bc))
    TXR=$(printf "%4d\n" $(echo "($TXBN - $TXB) / 1024/${SLEEP}" | bc))

    # Arrange and print the status line
    print "^fg(#80AA83)^p(0)^i(${ICONPATH}/load.xbm) ^fg()${PCPU} | ^fg(#80AA83)^i(${ICONPATH}/temp.xbm)^fg()${PCPUTEMP}° | ${INTERFACE}:^fg(white)${RXR}kB/s^fg(#80AA83)^p(0)^i(${ICONPATH}/arr_down.xbm)^fg(white)${TXR}kB/s^fg(orange3)^p(0)^i(${ICONPATH}/arr_up.xbm)^fg() | ^fg(white)${PDATE}^fg() | ^fg(#80AA83)^p(0)^i(${ICONPATH}/volume.xbm)^fg()${PVOLUME}"

    RXB=$RXBN; TXB=$TXBN

    DATECOUNTER=$((DATECOUNTER+1))
    CPUTEMPCOUNTER=$((CPUTEMPCOUNTER+1))
#    WEATHERCOUNTER=$((WEATHERCOUNTER+1))

   sleep $INTERVAL
done | ~/.dzen/dzen2 -x 500 -ta r -h 14 -p -e "button3=exit;button4=exec:$CI;button5=exec:$CD" -fn '-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*'

But I'm getting this error > (standard_in) 2: parse error
over and over and so on...

Offline

#90 2008-01-05 21:30:02

Evanlec
Member
From: NH, USA
Registered: 2007-12-16
Posts: 140
Website

Re: dzen & xmobar Hacking Thread

redbeard0531 wrote:

Dynamic log section in xmonad.hs:

redbeardPP = defaultPP { ppHiddenNoWindows = dzenColor "#33FF00"  ""
                      , ppHidden  = dzenColor "white"  ""
                      , ppCurrent = dzenColor "yellow" ""
                      , ppVisible = dzenColor "#FF2222" ""
                    --, ppUrgent  = dzenColor "red"    "yellow"
                      , ppSep     = " | "
                      , ppWsSep   = "\n"
                      , ppTitle   = id
                      , ppLayout  = \s -> " "
                      , ppOutput  = writeFile "/home/mstearn/.xmonad-status" 
                                        . ("^cs()\n"++)
                      } 

myLogHook = do ewmhDesktopsLogHook
               dynamicLogWithPP redbeardPP
               return ()
 

myUrgencyHook = withUrgencyHook dzenUrgencyHook 
        { args = ["-bg", "yellow", "-fg", "black" ,"-p", "3", "-xs", "1"] }

could you post the rest of your xmonad.hs ?
I can't seem to get your setup working here.
your setup looks very nice btw. Being able to click on the workspaces would be excellent!

Last edited by Evanlec (2008-01-06 20:50:15)

Offline

#91 2008-01-05 21:44:22

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

gotmor wrote:

Here's my current dzen2 setup with conky-cli after a few hours of messing around.
(date, cpu, memory, file system, network, mpd)
I had a nice conky setup just yesterday, so it's a bit confusing like this, but I think I'll stick with this one for atleast a while! Next stop would be to learn them drop-downs with dzen. (I'd like just one dzen running with multiple drop-downs from it, but haven't got that far yet..)
Font: lime
Icons: self made (8x8 px)

I like the icons a lot, please upload them to wiki http://dzen.geekmode.org/wiki/wiki.cgi/ … nIconPacks

Thanks!
I will add them as soon as I get a few more and a bit or rearranging done. (renaming and other little things)

Offline

#92 2008-01-06 13:44:46

mascanho
Member
Registered: 2008-01-04
Posts: 53

Re: dzen & xmobar Hacking Thread

gotmor wrote:

My current setup with gcpubarG:

http://dzen.geekmode.org/img/desk-cpb_th.png

Wow, thats some nice work ! would you mind posting your entire config, with all the scripts and config files you use ?

Offline

#93 2008-01-06 15:15:28

Don-DiZzLe
Member
From: Nederland
Registered: 2007-03-31
Posts: 233

Re: dzen & xmobar Hacking Thread

I second that!

Offline

#94 2008-01-07 23:40:21

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

gotmor wrote:
sm4tik wrote:
Ashren wrote:

I've encountered one strange bug, when firing up xmonad, the separators i.e.(^r(2x15)) sometimes grows considerably in length. Anyone else noticed this?

Happens here with fvwm too (using dzen2 build from community).

Hmm, strange indeed. I never experienced that bug. I will try to isolate the problem, though.

@ gotmotor : If you haven't seen it yet, here are two shots 1. buggy boxes and 2. ok boxes. The first time I noticed this was when changing the font and I thought it was a font problem. A few few days passed and I changed the font again and it happened again. I killed and restarted dzen2 a couple times (with the same font) and after that I haven't had a "wide-spread-box". Could it be something to do with fonts? (just a wild guess, since I've only encoutered this one _after_ changing the font in my dzen2_conky.sh. -- the one which loads conky-cli stuff into dzen2.) Dzen shows no errors or enything alike if the boxes are spread (if started from the terminal).

@ All : I had a thought if a scrolling "whatever you want to scroll" sort of a thing would be possible inside a dzen bar? This would be handy especially with the "too long to display" song names, etc. To make my point, look at xmms or ncmpc (or others alike). Can this sort of a behavior be done without hacking into dzen code, and if not, could it be a thing for the TODO list if it's not too complicated? I really miss this sort of a behavior in many apps and I think a "status bar" like dzen would benefit a lot from it!

Sakari

Offline

#95 2008-01-08 00:02:37

Nihathrael
Member
From: Freising, Germany
Registered: 2007-10-21
Posts: 82
Website

Re: dzen & xmobar Hacking Thread

sm4tik wrote:

@ gotmotor : If you haven't seen it yet, here are two shots 1. buggy boxes and 2. ok boxes. The first time I noticed this was when changing the font and I thought it was a font problem. A few few days passed and I changed the font again and it happened again. I killed and restarted dzen2 a couple times (with the same font) and after that I haven't had a "wide-spread-box". Could it be something to do with fonts? (just a wild guess, since I've only encoutered this one _after_ changing the font in my dzen2_conky.sh. -- the one which loads conky-cli stuff into dzen2.) Dzen shows no errors or enything alike if the boxes are spread (if started from the terminal).
Sakari

I experienced that error from time to time. It often happens after config changes, but occasionally i had the error after a normal boot. dynamic reload via mod+q always helped one the first or second try.


Unknown Horizons - Open source real-time strategy game with the comfy Anno 1602 feeling!

Offline

#96 2008-01-08 14:43:27

gotmor
Member
From: Germany
Registered: 2007-09-03
Posts: 84
Website

Re: dzen & xmobar Hacking Thread

Nihathrael wrote:
sm4tik wrote:

@ gotmotor : If you haven't seen it yet, here are two shots 1. buggy boxes and 2. ok boxes. The first time I noticed this was when changing the font and I thought it was a font problem. A few few days passed and I changed the font again and it happened again. I killed and restarted dzen2 a couple times (with the same font) and after that I haven't had a "wide-spread-box". Could it be something to do with fonts? (just a wild guess, since I've only encoutered this one _after_ changing the font in my dzen2_conky.sh. -- the one which loads conky-cli stuff into dzen2.) Dzen shows no errors or enything alike if the boxes are spread (if started from the terminal).
Sakari

I experienced that error from time to time. It often happens after config changes, but occasionally i had the error after a normal boot. dynamic reload via mod+q always helped one the first or second try.

I'll start an instance in the debugger and will try to reproduce that effect and hopefully see whats causing it.

sm4tik wrote:

@ All : I had a thought if a scrolling "whatever you want to scroll" sort of a thing would be possible inside a dzen bar? This would be handy especially with the "too long to display" song names, etc. To make my point, look at xmms or ncmpc (or others alike). Can this sort of a behavior be done without hacking into dzen code, and if not, could it be a thing for the TODO list if it's not too complicated? I really miss this sort of a behavior in many apps and I think a "status bar" like dzen would benefit a lot from it!

Well, scrolling is not on todo, although i guess you can perfectly control it externally. (The textwidth gadget might be of some help)

Basically dzen is just a display and as such does not keep any internal state of the layout, it will just render whatever you throw at it.
Scrolling parts of the bar however means that dzen needs to identify those parts and keep track of them internally.

I'd like to keep dzen as stateless as possible and rather let external scripts keep track of the layout they created.

Offline

#97 2008-01-08 21:53:11

seasponge
Member
Registered: 2008-01-08
Posts: 16

Re: dzen & xmobar Hacking Thread

does anyone else get slow/delayed response using the volume script?

Offline

#98 2008-01-08 22:37:33

gotmor
Member
From: Germany
Registered: 2007-09-03
Posts: 84
Website

Re: dzen & xmobar Hacking Thread

seasponge wrote:

does anyone else get slow/delayed response using the volume script?

You can use redbeard0531's excellent inotify solution for instant responses

Btw, I'd love to see some inotify based scripts on dzen's wiki, redbeard0531?

Offline

#99 2008-01-09 00:26:26

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: dzen & xmobar Hacking Thread

gotmor wrote:

I'd like to keep dzen as stateless as possible and rather let external scripts keep track of the layout they created.

Yes, please do that. I've been reading a bit of dzen2, and I like how it's written. Usually I'm confused when I read C, but reading your code was more natural. Now you may take that as a compliment or an insult smile

Offline

#100 2008-01-10 02:20:04

sm4tik
Member
From: Finland, Jyväskylä
Registered: 2006-11-05
Posts: 248
Website

Re: dzen & xmobar Hacking Thread

buttons wrote:
aeolist wrote:

buttons, how did you get the updates/news notification?

I used the conky one that floats around these forums.  Here it is:

~/bin/dzen_updates.pl

#! /usr/bin/perl -w
use strict;
# November 15, 2006
# Daniel Vredenburg (Vredfreak)
# This is a program that checks for package updates for Arch Linux users.

open (MYINPUTFILE, "/var/log/updates.log") or die "No such file or directory: $!";

my $i = 0;
while(<MYINPUTFILE>)
{
        if (/^(.*)\/(.*)(\..*\..*\.)/)  {
                #print " \n";
                $i++;
        }

}
if ($i == 0) {
        print "up to date";
} else {
        print "available ($i)";
}
close(MYINPUTFILE);

Sometimes I change the print commands to alter the colour when there are updates available.

Then you need this in your /etc/cron.d/hourly directory:

pacsync.sh

#!/bin/bash

# This issues a command to 1. Sync the package database, 
# 2. Check for upgradable packages, 3. print the URL of any possible upgrade. 
# The output of our command gets written to updates.log, which we will use 
# dzen_updates.pl to parse to see if there are any available updates.

pacman -Syup --noprogressbar > /var/log/updates.log

Which will of course do a package sync each hour and put the results in /var/log/updates.log.  Make sure this is writeable by root and readable by you.

Just a simple idea for use with those two. Please check it, and edit it to be more useful! This is my "copy-paste way of learning" so I really don't know how "in a right way" it is written, but it works. Basically it just prints out only the package names from /var/log/updates.log. Maybe someone can make a script to automatically calculate the height of a dzen window to match the number of packages? One could then just click or whatever the "available ($i)" and a list of packages would appear?
Just an idea I haven't seen in action yet? (it's possible I just haven't seen it though..)

#!/bin/sh
sed -ne 's/^.*i686\/\([a-z-]*\)-.*$/\1/p' < /var/log/updates.log

EDIT:
I kept on messing around and here's what I've got so far. I don't really know the difference in doing it this way, but atleast now I understand what happens around wink So a pacman update thingy ala bash
pacsync.sh

#!/bin/bash
pacman -Syup --noprogressbar |\
sed -ne 's/^.*i686\/\([a-z-]*\)-.*$/\1/p' > /var/log/updates.log

and check.sh

#!/bin/bash
updates=`wc -l < /var/log/updates.log`
if [ "$updates" == "0" ]; then
        echo "up to date"
else
        echo "available $updates"
fi

and  just a simple

cat /var/log/updates.log

gives you the updateable packages

So, from what I understand, I guess the echo's should be print's instead to make it work in dzen. Might someone want to make improvements and make a dzen_script out of it? Oh, and note, it works for i686, you might want to change the sed part of the script to make it work with arch64 also!

EDIT 2:
Forget about the print thing, I just realized it was a zsh thing smile
I'm working on a standalone pacman bar done with bash, but it's far from complete. One could aswell put the outputs inside conky, but I'm trying to make the bar useful for launching various pacman stuff. I'll keep you posted!

Last edited by sm4tik (2008-01-11 01:20:42)

Offline

Board footer

Powered by FluxBB