Page 1 of 3

dzen

Posted: Thu Apr 30, 2015 10:34 am
by rhowaldt
i actually have nothing to show. i was looking for a thread about dzen configs and couldn't find it so i made one in the hope that people would post theirs, because for now i do not seem to be able to figure out how to get my info properly piped into dzen. tried adapting my custom i3status script but it seems dzen is a tad more complex. so please, post your configs!

Re: dzen

Posted: Thu Apr 30, 2015 1:06 pm
by kexolino
I don't have anything to show either (I used dzen for a while with OB, but the config is lost), but take a look at the dzen section on dotshare.it until someone comes along.

Re: dzen

Posted: Thu Apr 30, 2015 1:10 pm
by pidsley

Re: dzen

Posted: Thu Apr 30, 2015 2:20 pm
by rhowaldt
hahahaha, actually i did! i just completely forgot to mention them in my first post simply because they didn't give me the answers i wanted (or, so i felt, sob sob). so disillusionment instead of laziness this time :D

what i hoped for was a nice discussion about the how and what of dzen. i am currently thorougly confused by dzen's config and attempted to use lemonbar to replace it, but it turns out lemonbar doesn't work so well when it comes to fonts, and those are too important to ignore. so i am veering back to dzen, hoping to finally be able to find a way to use a decent fucking xft font instead of all the fugly xfontsel shit. although that is probably lack of knowledge as well - i'm sure there are some nice fonts to be had. all i really want is to use a good font that supports a whole bunch of Unicode characters, and fucking misc-fixed isn't doing it for me.

Re: dzen

Posted: Thu Apr 30, 2015 2:20 pm
by machinebacon

Re: dzen

Posted: Thu Apr 30, 2015 2:33 pm
by rhowaldt
damn. i really suck at Google. should've known z3bra had written something about it, and that git-search never even occurred to me. i was just hoping drew would post a cool example ;)

thanks, will continue my struggle!

Re: dzen

Posted: Thu Apr 30, 2015 4:43 pm
by stark
earsplit has some great stuff too: https://github.com/windelicato/dotfiles ... ad/scripts and https://bbs.archlinux.org/viewtopic.php?id=40637

dzen has no support for fallback fonts so you either need to use xbm files for the icons or use a font which has the glyphs you need, this is the only part that I dislike about dzen ( and it's inactive development ) other than that gdbar and gcpubar is pretty cool !

Re: dzen

Posted: Thu Apr 30, 2015 4:52 pm
by dkeg
Rho, what font issues are you having with bar? I'd be happy to share my status bar using lemon bar for you. Also there was a thread around fonts recently. Since then I have created a short script to do the fc-cache shit. There is a fork of lemon bar that supports xft fonts, but you shouldn't need it. We'll get it sorted.

Now, as far as dzen, never used it actually.

Let me know what I can share with you. I'm at work but can get whatever you want this evening. Hang in there.

Edit: here is the thread
http://linuxbbq.org/bbs/viewtopic.php?f ... nts#p36883

Re: dzen

Posted: Thu Apr 30, 2015 5:09 pm
by stark
Oh and lemonbar has support for fallback fonts ( you can use 5 fonts by default, 1 is the main other four for fallback purposes, and even this number can be increased if needed )

For example this is how I setup fonts in lemonbar scripts:

Code: Select all

lemon="-benis-lemon-medium-r-normal--10-110-75-75-m-50-iso8859-1"
siji="-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1"

echo "blah" | lemonbar -d -f $lemon -f $siji

Re: dzen

Posted: Thu Apr 30, 2015 6:12 pm
by rhowaldt
i have managed to get it to work now with dzen2, indeed as stark said using icons (stlarch), in my case i used conky to pipe to dzen2 and i3bar starts dzen2 and and and... it seems a bit too complex. at least i have a result for the day that doesn't look terrible.

thanks to both of you for the tips, i will have a look and feel more confident in getting bar to work now. i suppose i was just having font misunderstandings and wrongly figured the problem was with lemonbar...

oh, while we're talking: am i right that i3 does not support docking of an external bar (dzen2 or lemonbar) without having to go through its i3bar/i3status system? i now used a quick fix where i just place dzen2 over i3status so it blocks it.. it's not great, but it works.

Re: dzen

Posted: Thu Apr 30, 2015 6:20 pm
by stark
Yeah, sadly you can't intergrate lemonbar or dzen2 in i3 like you can in bspwm or xmonad. You just mess with the x and y offsets to place it on top of i3bar. You can try out bspwm ( very similar to hlwm ) if you want to use lemonbar as your primary bar plus, it's a really nice wm and has some really cool features, you can do all the manual tiling that you can do in i3 and no container or layout concept and it's smaller and in many ways better than i3 in my opnion :)

Re: dzen

Posted: Fri May 01, 2015 9:37 am
by rhowaldt
thanks for that stark, i might look into bspwm. i really enjoy the navigation in i3 and it comes quite natural to me to do it that way, and in hlwm i find it difficult that i can't seem to move around windows in the same easy manner. this might also just be a keybinds thing, but who knows, still figuring it out.

Re: dzen

Posted: Fri May 01, 2015 10:28 am
by machinebacon
Rho, why not spectrwm? It does have a bar, but you can still overlay it or use a custom one. IMO, spectrwm is the most 'intuitive' tiling WM, but YMMV :)

Re: dzen

Posted: Fri May 01, 2015 11:14 am
by rhowaldt
good question. i'd be quicker to use spectrwm if it was still called scrotwm. i like names. however, the answer is simply that it seems i need to experiment with different WMs to get an idea for what i want and which is best. a bit late to the party i'm afraid in that regard :D

Re: dzen

Posted: Fri May 01, 2015 11:27 am
by dkeg
Definitely rho, progression will come naturally. Some to try down the line; herbstluftwm(again!, and if you like names, then this is the one!), monstser, spectrwm. In no particular order.

Re: dzen

Posted: Fri May 01, 2015 11:33 am
by rhowaldt
indeed herbstluftwm was the first one i tried after i3 (i always liked i3 as a name as well, plus many of you guys were raving about it at some point), because of that name. wonderful. i'll give it another go. still trying to get comfortable in this whole wm-switching and ricing situation :)

Re: dzen

Posted: Wed May 06, 2015 8:23 am
by rhowaldt
am currently struggling to find a way to have dzen update on the change of a value. say we take the volume for example. since i already had a script that handled volume changes, i had that script write out to a file called current_volume, and planned to have my panel.sh script check for a change every x seconds. however, the "every x seconds" thing is exactly what i do not want in this case. it seems so much simpler to simply be able to send a change to dzen directly whenever i change the volume. however, i'm not sure how to do it. in case anybody has ideas, i'm happy to hear. its probably something quite simple i'm missing.

scripts: panel.sh

Code: Select all

#!/bin/bash

hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
monitor=${1:-0}
geometry=( $(herbstclient monitor_rect "$monitor") )
if [ -z "$geometry" ] ;then
    echo "Invalid monitor $monitor"
    exit 1
fi
# geometry has the format W H X Y
x=${geometry[0]}
y=${geometry[1]}
panel_width=${geometry[2]}
panel_height=13
font='GohuFont-7'
#font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
bgcolor=$(hc get frame_border_normal_color)
selbg=$(hc get window_border_active_color)
selfg='#333333'

####
# Try to find textwidth binary.
# In e.g. Ubuntu, this is named dzen2-textwidth.
if which textwidth &> /dev/null ; then
    textwidth="textwidth";
elif which dzen2-textwidth &> /dev/null ; then
    textwidth="dzen2-textwidth";
else
    echo "This script requires the textwidth tool of the dzen2 project."
    exit 1
fi
####
# true if we are using the svn version of dzen2
# depending on version/distribution, this seems to have version strings like
# "dzen-" or "dzen-x.x.x-svn"
if dzen2 -v 2>&1 | head -n 1 | grep -q '^dzen-\([^,]*-svn\|\),'; then
    dzen2_svn="true"
else
    dzen2_svn=""
fi

if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
    # mawk needs "-W interactive" to line-buffer stdout correctly
    # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
    uniq_linebuffered() {
      awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
    }
else
    # other awk versions (e.g. gawk) issue a warning with "-W interactive", so
    # we don't want to use it there.
    uniq_linebuffered() {
      awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
    }
fi

hc pad $monitor $panel_height

{
    ### Event generator ###
    # based on different input data (mpc, date, hlwm hooks, ...) this generates events, formed like this:
    #   <eventname>\t<data> [...]
    # e.g.
    #   date    ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29

    #mpc idleloop player &
    while true ; do
        # "date" output is checked once a second, but an event is only
        # generated if the output changed compared to the previous run.
        date -u +$'date\t^fg(#c3c3c3)%d%m%y ^fg(#000000)^bg(#3d5a72) %H:%M '
        sleep 1 || break
    done > >(uniq_linebuffered) &
    childpid=$!
    hc --idle
    kill $childpid
} 2> /dev/null | {
    IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
    visible=true
    date=""
    windowtitle=""
    while true ; do

        ### Output ###
        # This part prints dzen data based on the _previous_ data handling run,
        # and then waits for the next event to happen.

        bordercolor="#3d5a72"
        separator="^bg()^fg($selbg)|"
        # draw tags
        for i in "${tags[@]}" ; do
            case ${i:0:1} in
                '#')
                    echo -n "^bg($selbg)^fg($selfg)"
                    ;;
                '+')
                    echo -n "^bg(#9CA668)^fg(#141414)"
                    ;;
                ':')
                    echo -n "^bg()^fg(#ffffff)"
                    ;;
                '!')
                    echo -n "^bg(#FF0675)^fg(#141414)"
                    ;;
                *)
                    echo -n "^bg()^fg(#ababab)"
                    ;;
            esac
            if [ ! -z "$dzen2_svn" ] ; then
                # clickable tags if using SVN dzen
                echo -n "^ca(1,\"${herbstclient_command[@]:-herbstclient}\" "
                echo -n "focus_monitor \"$monitor\" && "
                echo -n "\"${herbstclient_command[@]:-herbstclient}\" "
                echo -n "use \"${i:1}\") ${i:1} ^ca()"
            else
                # non-clickable tags if using older dzen
                echo -n " ${i:1} "
            fi
        done
        echo -n "$separator"
        # small adjustments
        moc_running=$(pidof "mocp" > /dev/null && echo 1)
        if [ $moc_running -eq 1 ]; then
			muz=$(mocp -Q %file | sed -e 's_/.*/__' -e 's/\.[^\.]*$//' -e 's/_/ /g')
			muz_tl=$(mocp -Q %tl)
			muz_tt=$(mocp -Q %tt)
			muzline="$muz ($muz_tl/$muz_tt)"
        else
			muzline=""
        fi
        vol=$(amixer get Master | awk -F'[][]' '/Mono:/ {sub(/%/, ""); print $2; exit}')
        wifi=$(awk 'NR==3 {printf("%2.2d\n", ($3/70)*100)}' /proc/net/wireless)
        right="^fg(#c3c3c3)$muzline ^fg($selbg)^i(.icons/sm4tik-icon-pack/xbm/phones.xbm) ^fg(#c3c3c3)$vol% ^fg($selbg)^i(.icons/sm4tik-icon-pack/xbm/wifi_02.xbm) ^fg(#c3c3c3)$wifi% $separator $date"
        right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
        right_text_only_icons=$(echo -n "$right_text_only" "aa")
        # get width of right aligned text.. and add some space..
        #width=$($textwidth "$font" "$right_text_only_icons")
        width=180
        echo -n "^pa($(($panel_width - $width -2)))$right"
        echo

        ### Data handling ###
        # This part handles the events generated in the event loop, and sets
        # internal variables based on them. The event and its arguments are
        # read into the array cmd, then action is taken depending on the event
        # name.
        # "Special" events (quit_panel/togglehidepanel/reload) are also handled
        # here.

        # wait for next event
        IFS=$'\t' read -ra cmd || break
        # find out event origin
        case "${cmd[0]}" in
            tag*)
                #echo "resetting tags" >&2
                IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
                ;;
            date)
                #echo "resetting date" >&2
                date="${cmd[@]:1}"
                ;;
            quit_panel)
                exit
                ;;
            togglehidepanel)
                currentmonidx=$(hc list_monitors | sed -n '/\[FOCUS\]$/s/:.*//p')
                if [ "${cmd[1]}" -ne "$monitor" ] ; then
                    continue
                fi
                if [ "${cmd[1]}" = "current" ] && [ "$currentmonidx" -ne "$monitor" ] ; then
                    continue
                fi
                echo "^togglehide()"
                if $visible ; then
                    visible=false
                    hc pad $monitor 0
                else
                    visible=true
                    hc pad $monitor $panel_height
                fi
                ;;
            reload)
                exit
                ;;
            focus_changed|window_title_changed)
                windowtitle="${cmd[@]:2}"
                ;;
            #player)
            #    ;;
        esac
    done

    ### dzen2 ###
    # After the data is gathered and processed, the output of the previous block
    # gets piped to dzen2.

} 2> /dev/null | dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height \
    -e 'button3=;button4=exec:herbstclient use_index -1;button5=exec:herbstclient use_index +1' \
    -ta l -bg "$bgcolor" -fg '#c3c3c3'
volume

Code: Select all

#!/bin/bash

case $1 in
+)
       amixer set Master 1dB+ ;;
-)
       amixer set Master 1dB- ;;
t)
       amixer set Master toggle -q ;;
*)
       exit;;
esac

VOLUME=$(amixer get Master | awk -F'[][]' '/Mono:/ {sub(/%/, ""); print $2; exit}')
echo "$VOLUME" 1> /home/test/.config/herbstluftwm/current_volume

$(popup-herbst.sh "Vol. $VOLUME")

Re: dzen

Posted: Wed May 06, 2015 8:54 am
by machinebacon

Code: Select all

#!/bin/bash
# dzen2restarter
if [ "$(pidof dzen2)" ] ; then killall dzen2; sleep 1s; panel.sh; exit
This would be called before 'exit' in your volume script.

or maybe it doesn't work :D

Re: dzen

Posted: Thu May 07, 2015 2:55 am
by pidsley
(edit) -- I had some ideas, but on re-reading I think they were crap, so I deleted them. Sorry -- I don't really know much about bars (or herbst).

Re: dzen

Posted: Fri May 08, 2015 10:15 am
by rhowaldt
^ no problem pids :)