dzen2 is a messages, notifications and menus software for X11. it was designed to be lightweight, fast and to support different scripts languages.
dzen2 supports XFT fonts (in options), colors and formatting, icons, graphics and actions of the keyboard/mouse. dzen2 is available in most GNU/Linux distributions. the version integrated in livarp comes from svn repositories: dzen2-0.9.5.
livarp uses dzen2 for notifications but it can be used to display infos from conky. your ~/bin directory includes the dzenbar.sh script that reads ~/.conky/conkyrc_dzen output to collect informations, then display it in a clickable statusbar.
dzen accepts different options, the format options will be discribed later:
options.....argments.................description
-fg.........#RRGGBB,color............text color
-bg.........#RRGGBB,color............background color
-fn.........police xft ou classic....font to use
-ta.........l(eft),c(enter),r(ight)..title text alignment
-sa..................................slave text alignment
-tw.........x(pixels)................title window width
-w...................................window width
-h...................................lines height, by default: font height +2px
-x...................................horizontal position from top_left_corner of the screen
-y...................................vertical position from top of the screen
-l..........n(number)................number of displayed lines in the slave window
-m...................................menu mode (see menu section of this help)
-e...................................events & actions (see events & actions section of this help)
-p..........s(econdes)...............last value persists 's' secondes (option)
-u...................................update title & slave window simultaneous
-xs.........n(number)................number of the xinerama screen to use
-v...................................dzen2 version
dzen display title and slave window this way:
the first lines passed to dzen becomes the title window while the other are displayed in the slave window.
dzen2 suspend display:
note that above descriptions are for default configuration. you can modify it with the '-e' option (see events & actions section).
-l option is used to display several lines when the pointer comes to the title window. number of lines to be displayed is passed as argument (-l 5 display 5 lines).
when the cursor leave the slave window, this window auto-hide, you can fix the window wit ha middle-click.
scroll up/down with the mouse scrolls the window slave text if it's too small for the text.
example: a good way to understand how slave window works (right click to exit dzen2):
cat ~/.bashrc | dzen2 -l 30 -p
dzen can configure some keybind/mousebind to interract with its display.
option -e syntax: -e 'event1=action1:option1:…option'n',…,action'm';…'
each event can be associated to severals actions that can have severals options.(limited to 64 for each but you can modify it in the sources, action.h file).
-e 'button1=exec:xterm:firefox;entertitle=uncollapse;button3=exit'
events list for dzen2
keyboard events:
Every key can be bound to an action (see below). The format is:
key_KEYNAME where KEYNAME is the name of the key as defined in keysymdef.h (usually: /usr/include/X11/keysymdef.h).
The part after 'XK_' in keysymdef.h must be used for KEYNAME.
supported actions:
if no events/actions are specified dzen defaults to:
-e 'button3=exit:13'
-e 'entertitle=uncollapse,grabkeys; enterslave=grabkeys;leaveslave=collapse,ungrabkeys; button1=menuexec;button2=togglestick;button3=exit:13; button4=scrollup;button5=scrolldown; key_Escape=ungrabkeys,exit'
-e 'enterslave=grabkeys;leaveslave=ungrabkeys; button4=scrollup;button5=scrolldown; key_Left=scrollup;key_Right=scrolldown; button1=menuexec;button3=exit:13 key_Escape=ungrabkeys,exit'
Dzen provides two menu modes, vertical and horizontal menus. You can access these modes by adding 'v'(ertical) or 'h'(horizontal) to the '-m' option. If nothing is specified dzen defaults to vertical menus.
dzen2 -p -l 4 -m < file dzen2 -p -l 4 -m v < file
dzen2 -p -l 4 -m h < file
all actions beginning with "menu" work on the selected menu entry.
menu mode only makes sense if '-l
horizontal menus have no title window, so all actions affecting the title window will be silently discarded in this mode..
This option provides facilities to update the title and slave window at the same time.
the way it works is best described by an example: we want to display an updating clock in the title and some log output in the slave window:
while true; do date # output goes to the title window dmesg | tail -n 10 # output goes to the slave window sleep 1 done | dzen2 -l 10 -u
For this to work correctly it is essential to provide exactly the number of lines to the slave window as defined by the parameter to '-l'.
this feature allows to dynamically (at runtime) format the text dzen displays and control its behaviour.
currently the following commands are supported:
^ca(1,mpc toggle)^ca(3,mpc stop)[^ca(4,mpc prev)^ca(5,mpc next)mpd^ca()^ca()|^ca(4,mpc volume +3)^ca(5,mpc volume -3)vol^ca()^ca()]^ca()^ca()
see “events & actions” section for details about commands.
These commands can appear anywhere and in any combination in dzen's input.
The color can be specified either as symbolic name (e.g. red,darkgreen, etc.) or as #rrggbb hex-value (e.g. #ffffaa).
echo "^fg(red)I'm red text ^p(+20)^fg(blue)I am blue" | dzen2 -w 300 -p
echo "^bg(#ffaaaa)The ^fg(yellow)text to ^bg(blue)^fg(orange)colorize" | dzen2 -w 300 -p
echo "^fg(grey70)Some text containing ^^ characters" | dzen2 -w 300 -p
echo "^i(dzicons/mail.xbm) I am an envelope ^fg(yellow)and ^i(dzicons/bat_full_02.xbm) I'm a baterry." | dzen2 -w 300 -p
echo "6x4 rectangle ^r(6x4) ^fg(red)12x8 ^r(12x8) ^fg(yellow)and finally 100x15 ^r(100x15)" | dzen2 -w 300 -p
echo "^ib(1)^fg(red)^ro(100x15)^p(-98)^fg(blue)^r(20x10)^fg(orange)^p(3)^r(40x10)^p(4)^fg(darkgreen)^co(12)^p(2)^c(10)" | dzen2 -x 20 -y 20 -w 120 -p
(echo "This is a message"; sleep 10) | dzen2 -bg darkred -fg grey80
(echo Header; cal; sleep 20) | dzen2 -w 300 -l 8
(echo Header; while true; do echo test$((i++)); sleep 1; done) | dzen2 -w 300 -l 12
dzen2 -w 200 -l 4 -p -m < dzenmenu.txt
where dzenmenu.txt is (each entry after “Menu” is a command to execute)
Menu
urxvtc
rox-filer
firefox
geany
echo -e "xterm\nxclock\nxeyes\nxfontsel" | dzen2 -w 300 -l 4 -m h -p
have fun with dzen2 :)