You are not logged in.

#201 2009-09-25 22:56:43

lymphatik
Member
From: Somewhere else
Registered: 2009-03-07
Posts: 119

Re: dzen & xmobar Hacking Thread

Hi,

I was able to set up a quite nice layout for xmonad and dzen. However I am unable to see any icon for the weather. I double checked in the shell that I typed the path to the icon correctly and everything seemed ok.

I also thought that I did not assigned enough space for the icon but I have a space of 20 by 20 for them.

So  I do not really get why it is not working as I basically copied dzen wiki?

I also tried dmpipe without any succes. Here is what I am doing so if any of you had a set up for dmplex I would greatly appreciate. (by the way I am using zsh as shell)

mkfifo dmpipe
#tail -f dmpipe | dmplex | dzen2 -h 20 -x 1000 -ta r -fn '-*-liberation mono-*-r-*-*-10-*-*-*-*-*-*-*' -e '' &
#"1 "$volume > dmpipe
#"2 "$weather > dmpipe

FYI: my different dzen and script mem consumption

zsh (9) 7.3 M
sleep (4) 540k
dzen (5) 4.3 M

I will soon try to move to conky+dzen to see if I could improve that. And come back with new numbers

screen
tMmY4cA
rtop.sh

#!/bin/zsh

local colorText="#999F9F"
local FG='#aaaaaa'
local BG='black'
local FONT='-*-liberation mono-*-r-*-*-10-*-*-*-*-*-*-*'
local ICONPATH='/home/lymphatik/.xmonad/icons'
local BARH=8 # Height of gdbar
local BARW=50 # Width of gdbar
local WIFI=eth1
local MAXPOS="100"
local BARBG='#E1F2F7' # bg color gdbar
local BARFG='#999F9F' # fg color gdbar

local FW="mpc seek +5"      # 5 sec forwards
local RW="mpc seek -5"      # 5 sec backwards
local NEXTS="mpc next"      # previous song
local PREVS="mpc prev"      # next song
local TOGGS="mpc toggle"    # play/pause

calendar(){
    TODAY=$(expr `date +'%d'` + 0)
    MONTH=`date +'%m'`
    YEAR=`date +'%Y'`
 
    while true
        do
            date +'%a.%d.%m %H:%M'
     
            # current month, highlight header and today
            cal | sed -r -e "1,2 s/.*/^fg(white)&^fg()/" -e "s/(^| )($TODAY)($| )/\1^bg(white)^fg(#111)\2^fg()^bg()\3/"
        
            # next month, hilight header
            [ $MONTH -eq 12 ] && YEAR=`expr $YEAR + 1`
            cal `expr \( $MONTH + 1 \) % 12` $YEAR | sed -e "1,2 s/.*/^fg(white)&^fg()/"
            sleep 60;
        done
}

calendar | dzen2 -x 1120 -h 20 -w 160 -l 18 -ta r -sa c -fn $FONT &

# todo only change color of the icon
volume(){
#while [ $? -ne 1  -a  $? -ge 0  ]  && echo -n '^fg()'
    while true
        do
            if (amixer sget Master | grep -qF '[off]')
                then
                    color='#484C48'
                    icon=${ICONPATH}/spkr_02.xbm
                else
                    color='#999F9F'
                    icon=${ICONPATH}/spkr_01.xbm
            fi
            perc=$(amixer sget Master | sed -ne 's/^.*Front Left: .*\[\([0-9]*\)%\].*$/\1/p')
            echo "$perc" | gdbar -fg $color -s o -bg $BARBG -h $BARH -w $BARW -l "^fg($color)^i($icon)^p(2)^fg()"
            inotifywait -t 30 /dev/snd/controlC0 -qq
        done
}

volume | dzen2 -x 1115 -h 20 -w 65 -ta r -fn $FONT -e 'button1=exec:amixer -c 0 set Master toggle -q: amixer -c 0 set PCM toggle -q: amixer -c 0 set Surround toggle -q: amixer -c 0 set Center toggle -q: amixer -c 0 set LFE toggle -q;button4=exec:amixer -c 0 set Master 2dB+ -q: amixer -c 0 set PCM 2dB+ -q: amixer -c 0 set Surround 2dB+ -q: amixer -c 0 set Center 2dB+ -q: amixer -c 0 set LFE 2dB+ -q;button5=exec:amixer -c 0 set Master 2dB- -q: amixer -c 0 set PCM 2dB- -q: amixer -c 0 set Surround 2dB- -q: amixer -c 0 set Center 2dB- -q: amixer -c 0 set LFE 2dB- -q' &

gmail(){
    while true
        do
             python ~/.xmonad/script/dzenGmailNotify/dzenGmailNotify.py
             sleep 1800;
        done
}

gmail | dzen2 -x 1075 -h 20 -w 30 -ta r -fn $FONT -e 'button1=exec:firefox mail.google.com/mail/#inbox' &

weather(){
    while echo -n ' ' 
        do
            perl ~/.xmonad/script/dzenWeather/dzen_weather.pl
            sleep 1800; # 30 min
        done
}

weather | dzen2 -x 1005 -w 60 -h 20 -l 2 -sa r -ta r -fn $FONT &

mpdbar(){
    while true; 
    do
        POS=`mpc | sed -ne 's/^.*(\([0-9]*\)%).*$/\1/p'`
        POSM="$POS $MAXPOS"
#echo -n "^i(${ICONPATH}/note.xbm) "
#TITLE=`mpc | sed -n '1p' | awk '{if ($1 != "volume:") print}'`" | tr '\n' ' '
        TITLE="`mpc | sed -n '1p' | awk '{if ($1 != "volume:") print}'`" 
        echo -n "^i(${ICONPATH}/note.xbm) $TITLE[0,20] "
        echo "$POSM" | gdbar -h $BARH -s o -w $BARW -fg $BARFG -bg $BARBG 
        sleep 1;
    done
}

mpdbar | dzen2 -x 800 -w 190 -h 20 -ta r -fn $FONT -e "button4=exec:$RW;button5=exec:$FW;button1=exec:$PREVS;button3=exec:$NEXTS;button2=exec:$TOGGS" &

dzen_weather.pl

#!/usr/bin/perl
#
# (c) 2007 by Robert Manea

use Weather::Com::Finder;

# Fill with valid values
#
my $PartnerId  = 'haha';
my $LicenseKey = 'youlou'';
my $iconpath = '/home/lymphatik/.xmonad/script/dzenWeather';

my %weatherargs = (
       'partner_id' => $PartnerId,
       'license'    => $LicenseKey,
);

my $weather_finder = Weather::Com::Finder->new(%weatherargs);

# Fill in your location
my $locations = $weather_finder->find('Rouen, France');

my $temp_today = $locations->[0]->current_conditions()->windchill();
my $icon_today = $locations->[0]->current_conditions()->icon();
my $hum_today = $locations->[0]->current_conditions()->humidity();
my $forecast = $locations->[0]->forecast();
#tomorrow
my $htemp_tomorrow = $forecast->day(1)->high();
my $ltemp_tomorrow = $forecast->day(1)->low();
my $icon_tomorrow = $forecast->day(1)->day->icon();
#day 2
my $htemp_day2 = $forecast->day(2)->high();
my $ltemp_day2 = $forecast->day(2)->low();
my $icon_day2 = $forecast->day(2)->day->icon();

my $wvar ="^i(${iconpath}/${icon_today}-scaled.xpm)^p(2)${temp_today}° ${hum_today}%\n".
          "^p(4)^i(${iconpath}/${icon_tomorrow}-scaled.xpm)^p(2)${htemp_tomorrow}° ${ltemp_tomorrow}°\n". 
          "^p(4)^i(${iconpath}/${icon_dat}-scaled.xpm)^p(2)${htemp_day2}° ${ltemp_day2}°";


print "$wvar", "\n";

Offline

#202 2009-10-07 18:18:06

mjheagle8
Member
From: /home/mjheagle8
Registered: 2009-07-12
Posts: 186

Re: dzen & xmobar Hacking Thread

hello. i want to try dzen with kde. i have a few questions:
1) how can i set window rules for it? (i want to make it slightly transparent)
2) can i make it act like a panel so other windows dont maximize over it?
thanks in advance for your help.


Desktop/Laptop - DWM :: VM - screen
Registered Linux User Number 483137 :: Victory! :: GitHub

Offline

#203 2009-10-07 19:00:54

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: dzen & xmobar Hacking Thread

1. dzen2 is not capable of transparency afaik, without using ugly a workaround such as devilspie and transset.

2. dzen2 has a "-dock" option, perhaps you should try this.

http://dzen.geekmode.org/dwiki/doku.php … ption-list

Offline

#204 2009-10-08 04:27:50

NickC
Member
From: Perth, WA
Registered: 2009-10-08
Posts: 1

Re: dzen & xmobar Hacking Thread

brisbin33 wrote:
    stngth=`iwconfig wlan0 | awk -F '=' '/Quality/ {print $2}' | cut -d '/' -f 1`
    bars=`expr $stngth / 10`
    case $bars in
      0)  bar='[-------]' ;;
      1)  bar='[#------]' ;;
      2)  bar='[##-----]' ;;
      3)  bar='[###----]' ;;
      4)  bar='[####---]' ;;
      5)  bar='[#####--]' ;;
      6)  bar='[######-]' ;;
      7)  bar='[#######]' ;;
      *)  bar='[--!!!--]' ;;
    esac
    echo $essid$bar
  fi

Just thought I'd point out you can do a similar bar within awk itself, and so avoid extra processing in the shell.   Since you're already using awk, you might as well do the lot with awk.  Also, I like to avoid as many external commands as possible to minimise the shell's resource use (every external command spawns a sub-shell, which is very slow in terms of processing), so I use this instead of calling gdbar or dbar.  This is for a small volume graph:

amixer | awk 'BEGIN { FS="[\\[\\]]" } ; /  Front/ { printf "%i%%[%-5.*s]", $2, ($2+10)/20, "=====" ; exit }'

which produces, for example, "83%[==== ]", or "25%[==   ]".

For those who want the details, BEGIN, FS , "/  Front" and "exit" are setting things up to get the first line of output from amixer that has the string "  Front", putting the volume into parameter $2, and then quitting without processing any more lines since I'm only interested in the Master volume.

The guts are in the printf statement, which you could use for any type of bar graph.  It outputs the volume as an integer percent "%i%%" from the first of printf's parameters ($2), then a '[' char, then a '=' for each 20%, then spaces and a ']' char. "%-5.*s" means a string left-aligned 5 chars wide, with the number of chars to output from the next in the list of printf's parameters ("($2+10)/20"), and the chars themselves from the next after that of printf's parameters ("====="). 

HTH,
Nick

Offline

#205 2009-10-16 17:41:38

mjheagle8
Member
From: /home/mjheagle8
Registered: 2009-07-12
Posts: 186

Re: dzen & xmobar Hacking Thread

Ashren wrote:

1. dzen2 is not capable of transparency afaik, without using ugly a workaround such as devilspie and transset.

2. dzen2 has a "-dock" option, perhaps you should try this.

http://dzen.geekmode.org/dwiki/doku.php … ption-list

-dock is an invalid option. has it changed or something?


Desktop/Laptop - DWM :: VM - screen
Registered Linux User Number 483137 :: Victory! :: GitHub

Offline

#206 2009-10-20 23:32:18

metal.lunchbox
Member
Registered: 2009-10-20
Posts: 1

Re: dzen & xmobar Hacking Thread

However I am unable to see any icon for the weather

The weather icons are .xpm and dzen does not compile with xpm or xinerama support by default. to remedy this download the source:

  svn co http://dzen.google.code/svn/trunk dzensrc

make sure you have libxpm-dev and recompile/install with the apropriate bits commented/uncommented in the config.mk file.

Offline

#207 2009-10-21 01:19:57

lymphatik
Member
From: Somewhere else
Registered: 2009-03-07
Posts: 119

Re: dzen & xmobar Hacking Thread

thanks it worked perfectly

Offline

#208 2009-11-24 19:19:41

tvale
Member
From: Portugal
Registered: 2008-12-11
Posts: 175

Re: dzen & xmobar Hacking Thread

I'm sorry if this isn't the better thread for this action, but I compiled dzen2 with XFT support but I can't set them.
For example:

tvale@~ % echo "Hello, world" | dzen2 -fn 'Droid Sans Mono' -p 
dzen: error, cannot load font: 'Droid Sans Mono'

Or even:

tvale@~ % echo "Hello, world" | dzen2 -fn "Monospace" -p
dzen: error, cannot load font: 'Monospace'

Can anyone help me please? :s

Offline

#209 2009-11-24 19:30:53

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: dzen & xmobar Hacking Thread

dzen2 -fn "Verdana-8" works here.  i believe you need FONTNAME-POINTSIZE

Offline

#210 2009-11-24 19:34:31

tvale
Member
From: Portugal
Registered: 2008-12-11
Posts: 175

Re: dzen & xmobar Hacking Thread

dzen: error, cannot load font: 'Verdana-8'

I don't use a xorg.conf, but the Xorg.0.log show that /usr/share/fonts/TTF is there.

Offline

#211 2009-11-24 19:39:47

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: dzen & xmobar Hacking Thread

try dzen2-svn from aur? that's what i'm using.

Offline

#212 2009-11-24 19:58:03

tvale
Member
From: Portugal
Registered: 2008-12-11
Posts: 175

Re: dzen & xmobar Hacking Thread

Well, that did it. Weird, maybe the community package doesn't support XFT?
Thank you! smile

Offline

#213 2009-11-24 19:59:25

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: dzen & xmobar Hacking Thread

the community package does not.  i thought you said you manually compiled in xft support (through abs or whatever).

Offline

#214 2009-11-24 20:05:15

tvale
Member
From: Portugal
Registered: 2008-12-11
Posts: 175

Re: dzen & xmobar Hacking Thread

Well I did, I changed the PKGBUILD of the community package.
My bad.

Offline

#215 2009-11-30 08:43:23

muchzill4
Member
From: Poland
Registered: 2009-03-30
Posts: 30

Re: dzen & xmobar Hacking Thread

Hello,
I've got a problem with dzen. Aligning it to be perfectly exact. I'm outputting conky-cli to dzen, and it's behaviour is really weird. Well I've read somewhere one the forums, that ^p(_CENTER) put between elements you want on the edges of the screen does the trick, but for me it only puts some extra space inbetween. So I tried to do it with ^p(_LEFT) and ^p(_RIGHT), but ^p(_RIGHT) seems to move content too far to the right. It's obious - if the position of X is set to _RIGHT everything will be displayed after it, so over the edge of the bar. Is there any nice way to make stuff alight both left and right on one dzen bar? Doing ^p(-X) won't do the trick, cause when conky content changes dynamically it may not have enough space and dissapear over the edge of the screen.

I already have 3 dzen instances @ my xmonad (one with layouts/workspaces, one with date [didn't want to mess with multiplexer] and one in the bottom to display some other system monitors etc) so I'd rather not create another instance of dzen. Possible? What do you advise?

Offline

#216 2009-12-17 05:16:27

YamiFrankc
Member
From: Mexico
Registered: 2009-06-19
Posts: 177
Website

Re: dzen & xmobar Hacking Thread

How can i make dzen appear on all my multiple monitors?
And someone know of a font with the Arch logo? or something i could use to make it red if i have updates to do and gray if im up to date/


Thanks and greetings.

Offline

#217 2009-12-17 06:33:54

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: dzen & xmobar Hacking Thread

YamiFrankc:

If you are using Xinerama use the -xs switch. http://dzen.geekmode.org/dwiki/doku.php … ption-list

For the font use Openlogos. http://aur.archlinux.org/packages.php?ID=17219

And here is a basic example of a script that does what you ask for:

# Set up at crontab that syncs your db regularly - like every 30 minutes:  */30 * * * * pacman -Sy
paccheck=$(pacman -Qu | wc -l)

if [ $paccheck -gt 0 ]; then
   echo "A" | dzen2 -fg red -fn openlogos-22 -p &
else
   echo "A" | dzen2 -fn openlogos-22 -p &
fi

Use dzen2-svn from the aur. http://aur.archlinux.org/packages.php?ID=19926

Offline

#218 2009-12-18 19:24:38

YamiFrankc
Member
From: Mexico
Registered: 2009-06-19
Posts: 177
Website

Re: dzen & xmobar Hacking Thread

Thanks Ashren.

Im using Conky-cli to all other things, but found a thing i cant solve. Seems like the colors i set up on my conky file don't go to to dzen.

TEXT
{$color red} ${mpd_elapsed}/${mpd_length} ${mpd_smart} [${mpd_status}] ${color }

When i output it to dzen i just get gray fg.

How can i color make it colorful?

Last edited by YamiFrankc (2009-12-18 19:26:30)


Thanks and greetings.

Offline

#219 2009-12-18 19:36:37

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: dzen & xmobar Hacking Thread

That is because dzen2 does not recognize the conky syntax. With conky-cli you are combining conky and dzen2 with different syntaxes using conky to create the output and dzen2 to render it. So in order for dzen2 to recognize the colors you want your example should be configured using dzen2's syntax for colors:

TEXT
^fg(red) ${mpd_elapsed}/${mpd_length} ${mpd_smart} [${mpd_status}]

Offline

#220 2009-12-28 20:45:39

markp1989
Member
Registered: 2008-10-05
Posts: 431

Re: dzen & xmobar Hacking Thread

just discovered dzen2 it rocks smile

is there any way to make the text scroll across like a news banner on tv?

thanks Markp1989


Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD

Offline

#221 2009-12-28 20:50:25

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: dzen & xmobar Hacking Thread

markp1989: Perhaps you could get some inspiration from this: http://dzen.geekmode.org/dwiki/doku.php … ittscanner script.

I think it will take some serious tinkering to acheive.

Edit: Found this script by Xyne; http://bbs.archlinux.org/viewtopic.php?id=53761 try using it with conky-cli and see if it works.

Last edited by Ashren (2009-12-28 22:11:37)

Offline

#222 2010-01-13 16:20:51

Chance
Member
Registered: 2008-12-05
Posts: 99

Re: dzen & xmobar Hacking Thread

Hey everyone, i currently have a setup of Gnome + Openbox + PyTyle. You might ask why i installed so many things...it's because i want to emulate awesome3/xmonad but still have nautilus. I've tried installing nautilus on top of awesome3 and it just couldn't work well because it wouldn't mount and everytime i open it, it takes over awesome3's desktop. I also couldn't figure out how to theme awesome3 with beautiful because i didn't know where the config file is.

I was wondering how config dzen in my gnome + openbox setup to have a panel like awesome3's default panel that allows me to access different workspaces, shows the windows i have opened so i can click on them, and to also show the clock and such. I'm hoping someone can tell me where the config file is after i install dzen and how to load it. Thanks!

P.S. If anyone tells me to just install awesome3 and try nautilus/thunar again i don't want to because i like how i can still freely move windows around with openbox even when i have my windows all tiled up. I will definitely think of just installing Openbox + PyTyle with nautilus and dzen if i can figure out how to work with dzen.

Offline

#223 2010-01-13 21:48:25

pharcyde
Member
From: Connecticut
Registered: 2009-03-13
Posts: 88

Re: dzen & xmobar Hacking Thread

lymphatik wrote:

Hi,
I also tried dmpipe without any succes. Here is what I am doing so if any of you had a set up for dmplex I would greatly appreciate. (by the way I am using zsh as shell)

mkfifo dmpipe
#tail -f dmpipe | dmplex | dzen2 -h 20 -x 1000 -ta r -fn '-*-liberation mono-*-r-*-*-10-*-*-*-*-*-*-*' -e '' &
#"1 "$volume > dmpipe
#"2 "$weather > dmpipe

This should work:

tail -f | dmplex | dzen2 
echo "1" | $whatever > dmpipe

Offline

#224 2010-02-26 04:12:46

Chance
Member
Registered: 2008-12-05
Posts: 99

Re: dzen & xmobar Hacking Thread

Hey everyone, a while ago i tried using xmonad and awesome and liked it a lot. But for personal reasons i decided to use openbox + gnome + pytyle instead and i love it. However, i miss the panel that awesome has and was wondering if dzen can be used to emulate that panel in openbox + gnome, or just openbox alone. I know how to install dzen, but i need help learning how to configure dzen from scratch. Help would really be appreciated.

Offline

#225 2010-04-07 01:25:10

valadil
Member
Registered: 2009-06-04
Posts: 6

Re: dzen & xmobar Hacking Thread

redbeard0531 wrote:

The only real problem I have (other than running out of pixels) is that the script doesn't quit cleanly. To reload it I have to run "killall dzonky dzen2 inotail watchfile inotifywatch ;sleep 1; dzonky". If anybody has some suggestions to work around this, I'm all ears. Also, i get segfaults if I use scrolling and ^cs(), but i use $EVENTSCLEARABLE to get around that for now.

I realize this is a really old post, but I haven't seen an answer anywhere else yet.  I dealt with a similar problem, albeit in xmobar.  You could probably apply the same logic.

Anyway, I have a while loop running forever, spitting out updates when relevant, and waiting the rest of the time.  Instead of using "while [ true ]" I set up a condition that checks if the script's parent is my xmobar.  If xmobar dies, the loop breaks and the script ends.  Incidentally, the script also checks that its command completed successfully by testing "$?", but that's just because it uses inotify-tools, which is not standard (at least in debian, which is my distro of choice (although Arch has better forums)).

Anyway, here's the script.  I use it to update the volume in my xmobar.  This doesn't use polling and it actually listens to volume changes from other users, so I'm pleased with it.  The relevant line is the while loop:

#!/bin/sh

# Prints volume changes to stdout.  
# Depends on inotify-tools package

SOUND_DEV="/dev/snd/controlC1"

volume() {
        amixer -D default sget Master,0 \
          | grep dB \
          | head -n 1 \
          | cut -f 7 -d " " \
          | sed -e's/\[//g' -e 's/\]//g' 
}

# loop only runs when inotify didn't fail (not present on all systems)
# and when parent process is xmobar.  this _should_ ensure script quits after xmonad resets
while [ $? -eq 0 ] && [[  $(ps p $PPID | grep xmobar) ]]; 
do
        volume
        inotifywait $SOUND_DEV -e ACCESS -e CLOSE_WRITE > /dev/null 2>/dev/null
done

Offline

Board footer

Powered by FluxBB