1
^fg(lightgreen)^r(190x4)^fg(#6fbf47)^r(38x4)^fg(darkgreen)^r(9x4)
2
^fg(#6fbf47) dzen, (c) 2007 by Robert Manea
3
^fg(darkgreen)^r(9x4)^fg(#6fbf47)^r(38x4)^fg(lightgreen)^r(190x4)
5
A general purpose messaging, notification and menu program
8
The "gadgets" subdirectory contains some tools that you can
9
use in combination with dzen.
11
Script archive with a collection of interesting ideas:
12
^fg(lightblue) http://gotmor.googlepages.com/dzenscriptarchive
19
^co(4x4) scriptable in any language
21
^co(4x4) dynamic colorizer
23
^co(4x4) icons support
25
^co(4x4) keyboard support
27
^co(4x4) single line and/or windows holding multiple lines
29
^co(4x4) menu functionality
31
^co(4x4) in-text formating language
33
^co(4x4) flexible event/action mechanism
35
^co(4x4) hideable, collapsable
37
^co(4x4) Xinerama support
40
^fg(#6fbf47)Requirements
41
^fg(#6fbf47)------------
42
In order to build dzen you need the Xlib header files.
45
^fg(#6fbf47)Installation
46
^fg(#6fbf47)------------
47
Edit config.mk to match your local setup (dzen is installed into
48
the /usr/local namespace by default).
50
Afterwards enter the following command to build and install dzen (if
53
^fg(grey85)make clean install
56
Optionally if you want to use dzen's gadgets:
59
^fg(grey85)make clean install
62
^fg(Khaki)Note: By default dzen will ^fg(red)not^fg(Khaki) be compiled with Xinerama and XPM support.
63
^fg(Khaki)Uncomment the respective lines in config.mk to change this.
68
Feature requests, patches or anything else related to dzen can be send
69
to: ^fg(Khaki)rob dot manea at gmail dot com
72
^fg(#6fbf47)Running dzen
73
^fg(#6fbf47)------------
74
dzen accepts a couple of options:
79
-ta alignement of title window content
80
l(eft), c(center), r(ight)
81
-tw title window width
82
-sa alignment of slave window, see "-ta"
83
-l lines, ^fg(#6fbf47)see (1)
84
-e events and actions, ^fg(#6fbf47)see (2)
85
-m menu mode, ^fg(#6fbf47)see (3)
86
-u update contents of title and
87
slave window simultaneously, ^fg(#6fbf47)see (4)
88
-p persist EOF (optional timeout in seconds)
91
-h line height (default: fontheight + 2 pixels)
93
-xs number of Xinerama screen
94
-v version information
96
^fg(#6fbf47)see (5)^fg(), for the in-text formating language.
100
^fg(#6fbf47)X resources
101
^fg(#6fbf47)-----------
103
Dzen is able to read font and color setting from X resources.
104
As an example you can add following lines to ~/.Xresources
106
^fg(Khaki)dzen2.font: -*-fixed-*-*-*-*-*-*-*-*-*-*-*-*
107
^fg(Khaki)dzen2.foreground: #22EE11
108
^fg(Khaki)dzen2.background: black
112
^fg(#6fbf47)Window layout
113
^fg(#6fbf47)-------------
115
Dzen's window layout is as follows:
117
^fg(red) ------------------------------------------
118
^fg(red) | Title window, single line |
119
^fg(red) `------------------------------------------´
121
^fg(#6fbf47) | scrollable |
122
^fg(#6fbf47) | Slave window |
123
^fg(#6fbf47) | multiple lines |
124
^fg(#6fbf47) | lines to display simultaneously |
125
^fg(#6fbf47) | controlled with the |
126
^fg(#6fbf47) | '-l' option |
129
^fg(#6fbf47) `------------------------------------------´
131
The first line you provide to dzen always goes to the title window,
132
all other consecutive lines will be drawn to the slave window unless
133
you explicitly overide this with the ^fg(#6fbf47)(5) In-text formating language
140
Q1: I don't want a slave window, what to do?
142
A1: Do not provide the '-l' option, all lines will be displayed
143
in the title window, this is the default behaviour.
146
Q2: I used the '-l' option but no slave window appears.
148
A2: With the default event/action handling the slave window will
149
only be displayed if you hoover with the mouse over the title
150
window. See ^fg(#6fbf47)(2) Events and actions ^fg()if you'd like to change
154
Q3: If I echo some text or cat a file dzen closes itself imediatelly.
156
A3: There are 2 different approaches dzen uses to terminate itself,
157
see next section ^fg(#6fbf47)Termination^fg().
160
Q4: Ok, the title and slave thing works, can I update the
161
contents of both windows at the same time?
163
A4: Sure, see ^fg(#6fbf47)(4) Simultaneous updates ^fg()or use the in-text
164
command ^^tw() to explicitly draw to the title windwow.
165
See ^fg(#6fbf47)(5) In-Text formating language ^fg()for further details
167
Q5: Can i chnage color of my input at runtime?
169
A5: Yes, you can change both background and foreground colors and
170
much more See ^fg(#6fbf47)(5) In-Text formating language^fg().
173
Q6: Can I use dzen as a menu?
175
A6: Yes, both vertical and horizontal menus are supported.
176
See ^fg(#6fbf47)(3) Menu ^fg()for further details.
181
^fg(#6fbf47)Termination:
182
^fg(#6fbf47)------------
183
dzen uses two different approaches to terminate itself:
185
^co(4x4) Timed termination: if EOF is received -> terminate
186
- unless the '-p' option is set
187
· '-p' without argument persist forever
188
· '-p' with argument n persist for n seconds
190
^co(4x4) Interactive termination: if mouse button3 is clicked -> terminate
191
- this is the default behaviour, ^fg(#6fbf47)see (2)
192
- in some modes the Escape key terminates too, ^fg(#6fbf47)see (2)
196
^fg(#6fbf47)Return values:
197
^fg(#6fbf47)--------------
198
0 - dzen received EOF
199
1 - some error occured, inspect the error message
200
user defined - set with 'exit:retval' action, ^fg(#6fbf47)see (2)
204
^fg(#6fbf47)(1) Option "-l": Slave window
205
^fg(#6fbf47)--------------------------------
207
Enables support for displaying multiple lines. The parameter to "-l"
208
specifies the number of lines to be displayed.
210
These lines of input are held in the slave window which becomes active as soon
211
as the pointer enters the title (default action) window.
213
If the mouse leaves the slave window it will be hidden unless it is set
214
sticky by clicking with Button2 into it (default action).
216
Button4 and Button5 (mouse wheel) will scroll the slave window up
217
and down if the content exceeds the window height (default action).
221
^fg(#6fbf47)(2) Option '-e': Events and actions
222
^fg(#6fbf47)-----------------------------------
224
dzen allows the user to associate actions to events.
226
The command line syntax is as follows:
227
-e 'event1=action1:option1:...option<n>,...,action<m>;...;event<l>'
229
Every event can take any number of actions and every action can take any number
230
of options. (By default limited to 64 each, easily changable in action.h)
233
^fg(grey70) -e 'button1=exec:xterm:firefox;entertitle=uncollapse,unhide;button3=exit'
237
^fg(grey70)button1=exec:xterm:firefox;
238
on Button1 event (Button1 press on the mouse) execute xterm and
240
^fg(Khaki)Note: xterm and firefox are options to the exec action
242
^fg(grey70)entertitle=uncollapse,unhide;
243
on entertitle (mouse pointer enters the title window) uncollapse
244
slave window and unhide the title window
246
^fg(grey70)button3=exit
247
on button3 event exit dzen
250
^fg(#6fbf47)Supported events:
251
^fg(#6fbf47)-----------------
253
onstart Perform actions right after startup
254
onexit Perform actions just before exiting
255
onnewinput Perform actions if there is new input for the slave window
256
button1 Mouse button1 released
257
button2 Mouse button2 released
258
button3 Mouse button3 released
259
button4 Mouse button4 released (usually scrollwheel)
260
button5 Mouse button5 released (usually scrollwheel)
261
button6 Mouse button6 released
262
button7 Mouse button7 released
263
entertitle Mouse enters the title window
264
leavetitle Mouse leaves the title window
265
enterslave Mouse enters the slave window
266
leaveslave Mouse leaves the slave window
267
sigusr1 SIGUSR1 received
268
sigusr2 SIGUSR2 received
269
key_KEYNAME Keyboard events (*)
272
^fg(#6fbf47)(*) Keyboard events:
273
^fg(#6fbf47)--------------------
275
Every key can be bound to an action (see below). The format is:
276
key_KEYNAME where KEYNAME is the name of the key as defined in
277
keysymdef.h (usually: /usr/include/X11/keysymdef.h). The part
278
after 'XK_' in keysymdef.h must be used for KEYNAME.
282
^fg(#6fbf47)Supported actions:
283
^fg(#6fbf47)------------------
285
exec:command1:..:n execute all given options
286
menuexec executes selected menu entry
287
exit:retval exit dzen and return 'retval'
288
print:str1:...:n write all given options to STDOUT
289
menuprint write selected menu entry to STDOUT
290
collapse collapse (roll-up) slave window
291
uncollapse uncollapse (roll-down) slave window
292
togglecollapse toggle collapsed state
293
stick stick slave window
294
unstick unstick slave window
295
togglestick toggle sticky state
296
hide hide title window
297
unhide unhide title window
298
togglehide toggle hide state
299
raise raise window to view (above all others)
300
lower lower window (behind all others)
301
scrollhome show head of input
302
scrollend show tail of input
303
scrollup:n scroll slave window n lines up (default n=1)
304
scrolldown:n scroll slave window n lines down (default n=1)
305
grabkeys enable keyboard support
306
ungrabkeys disable keyboard support
307
grabmouse enable mouse support
308
only needed with specific windowmanagers, such as fluxbox
309
ungrabmouse release mouse
310
only needed with specific windowmanagers, such as fluxbox
313
^fg(Khaki)Note: If no events/actions are specified dzen defaults to:
315
^fg(#6fbf47)Title only mode:
316
^fg(#6fbf47)----------------
321
^fg(#6fbf47)Multiple lines and vertical menu mode:
322
^fg(#6fbf47)--------------------------------------
324
-e 'entertitle=uncollapse,grabkeys;
325
enterslave=grabkeys;leaveslave=collapse,ungrabkeys;
326
button1=menuexec;button2=togglestick;button3=exit:13;
327
button4=scrollup;button5=scrolldown;
328
key_Escape=ungrabkeys,exit'
331
^fg(#6fbf47)Horizontal menu mode:
332
^fg(#6fbf47)---------------------
334
-e 'enterslave=grabkeys;leaveslave=ungrabkeys;
335
button4=scrollup;button5=scrolldown;
336
key_Left=scrollup;key_Right=scrolldown;
337
button1=menuexec;button3=exit:13
338
key_Escape=ungrabkeys,exit'
341
^fg(Khaki)If you define any events/actions, there is no default behaviour,
342
^fg(Khaki)i.e. you will have to specify _all_ events/actions you want to
347
^fg(#6fbf47)(3) Option '-m', Menu
348
^fg(#6fbf47)---------------------
350
Dzen provides two menu modes, vertical and horizontal menus. You can
351
access these modes by adding 'v'(ertical) or 'h'(orizontal) to the
352
'-m' option. If nothing is specified dzen defaults to vertical menus.
354
Vertical menu, both invocations are equivalent:
355
^fg(grey70)dzen2 -p -l 4 -m < file
356
^fg(grey70)dzen2 -p -l 4 -m v < file
359
^fg(grey70)dzen2 -p -l 4 -m h < file
362
All actions beginning with "menu" work on the selected menu entry.
364
^fg(Khaki)Note: Menu mode only makes sense if '-l <n>' is specified!
366
^fg(Khaki)Horizontal menus have no title window, so all actions
367
^fg(Khaki)affecting the title window will be silently discarded
368
^fg(Khaki)in this mode.
372
^fg(#6fbf47)(4) Option '-u', Simultaneous updates
373
^fg(#6fbf47)-------------------------------------
375
This option provides facilities to update the title and slave window at
378
The way it works is best described by an example:
382
We want to display an updating clock in the title and some log
383
output in the slave window.
387
^fg(grey70)while true; do
388
^fg(grey70)date # output goes to the title window
389
^fg(grey70)dmesg | tail -n 10 # output goes to the slave window
391
^fg(grey70)done | dzen2 -l 10 -u
393
For this to work correctly it is essential to provide exactly the number
394
of lines to the slave window as defined by the parameter to '-l'.
398
^fg(#6fbf47)(5) In-text formating language:
399
^fg(#6fbf47)-------------------------------
401
This feature allows to dynamically (at runtime) format the text dzen
404
Currently the following commands are supported:
410
^^fg(color) set foreground color
411
^^fg() without arguments, sets default fg color
412
^^bg(color) set background color
413
^^bg() without arguments, sets default bg color
418
^^i(path) draw icon specified by path
419
Supported formats: XBM and optionally XPM
421
^^r(WIDTHxHEIGHT) draw a rectangle with the dimensions
423
^^ro(WIDTHxHEIGHT) rectangle outline
425
^^c(RADIUS) draw a circle with size RADIUS pixels
426
^^co(RADIUS) circle outline
431
^^p(PIXEL) position next input amount of PIXELs to the right
432
or left of the current position
433
a.k.a. relative positioning
435
^^pa(PIXEL) position next input at PIXEL
436
a.k.a. absolute positioning
437
For maximum predictability ^^pa() should only be
438
used with '-ta l' or '-sa l'
442
^^tw() draw to title window
443
This command has some annoyances, as only
444
the input after the command will be drawn
445
to the title window, so it is best used
446
only once and as first command per line
447
Subject to be improved in the future.
449
^^cs() clear slave window
450
This command must be the first and only command
453
^^ib(VALUE) ignore background setting, VALUE can be either
454
1 to ignore or 0 to not ignore the bg color set
456
This command is useful in combination with ^^pa()
457
in order to position the input inside other already
461
^^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)
463
^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)
467
These commands can appear anywhere and in any combination in dzen's
470
The color can be specified either as symbolic name (e.g. red,
471
darkgreen, etc.) or as #rrggbb hex-value (e.g. #ffffaa).
473
Icons must be in the XBM or optionally XPM format, see the "bitmaps"
474
directory for some sample icons. With the standard "bitmap" application
475
you can easily draw your own icons.
477
^fg(Khaki)Note: Displaying XPM (pixmap) files imposes a somewhat
478
^fg(Khaki)higher load than lightweight XBM files, so use
479
^fg(Khaki)them with care in tight loops.
482
Doubling the '^^' character removes the special meaning from it.
488
^^fg(red)I'm red text ^^fg(blue)I am blue
491
^fg(red)I'm red text ^fg(blue)I am blue
495
^^bg(#ffaaaa)The ^^fg(yellow)text to ^^bg(blue)^^fg(orange)colorize
498
^bg(#ffaaaa)The ^fg(yellow)text to ^bg(blue)^fg(orange)colorize
502
^^fg(white)Some text containing ^^^^ characters
505
^fg(white)Some text containing ^^ characters
509
^^i(bitmaps/envelope.xbm) I am an envelope ^^fg(yellow)and ^^i(bitmaps/battery.xbm) I'm a baterry.
512
^i(bitmaps/envelope.xbm) I am an envelope ^fg(yellow)and ^i(bitmaps/battery.xbm) I'm a baterry.
515
Input for rectangles:
516
6x4 rectangle ^^r(6x4) ^^fg(red)12x8 ^^r(12x8) ^^fg(yellow)and finally 100x15 ^^r(100x15)
519
6x4 rectangle ^r(6x4) ^fg(red)12x8 ^r(12x8) ^fg(yellow)and finally 100x15 ^r(100x15)
522
Input for relative positioning:
523
Some text^^p(100)^^fg(yellow)100 pixels to the right^^p(50)^^fg(red)50 more pixels to the right
526
Some text^p(100)^fg(yellow)100 pixels to the right^p(50)^fg(red)50 more pixels to the right
532
^fg(#6fbf47)Examples:
533
^fg(#6fbf47)---------
535
^co(4x4) Display message and timeout after 10 seconds:
536
^fg(grey85) (echo "This is a message"; sleep 10) | dzen2 -bg darkred -fg grey85 -fn fixed
539
^co(4x4) Display message and never timeout:
540
^fg(grey85) echo "This is a message"| dzen2 -p
543
^co(4x4) Display updating single line message:
544
^fg(grey85) for i in $(seq 1 20); do A=${A}'='; print $A; sleep 1; done | dzen2
547
^co(4x4) Display header and a message with multiple lines:
548
^fg(grey85) (echo Header; cal; sleep 20) | dzen2 -l 8
550
Displays "Header" in the title window and the output of cal in the
551
8 lines high slave window.
554
^co(4x4) Display updating messages:
555
^fg(grey85) (echo Header; while true; do echo test$((i++)); sleep 1; done) | dzen2 -l 12
557
The slave window will update contents if new input has arrived.
560
^co(4x4) Display log files:
561
^fg(grey85) (su -c "echo LOGFILENAME; tail -f /var/log/messages") | dzen2 -l 20 -x 100 -y 300 -w 500
564
^co(4x4) Monthly schedule with remind:
565
^fg(grey85) (echo Monthly Schedule; remind -c1 -m) | dzen2 -l 52 -w 410 -p -fn lime -bg '#e0e8ea' -fg black -x 635
568
^co(4x4) Simple menu:
569
^fg(grey85) echo "Applications" | dzen2 -l 4 -p -m < menufile
572
^co(4x4) Horizontal menu without any files:
573
^fg(grey85) {echo Menu; echo -e "xterm\nxclock\nxeyes\nxfontsel"} | dzen2 -l 4 -m h -p
576
^co(4x4) Extract PIDs from the process table:
578
^fg(grey85) {echo Procs; ps -a} | dzen2 -m -l 12 -p \
579
^fg(grey85) -e 'button1=menuprint;button3=exit;button4=scrollup:3;button5=scrolldown:3;entertitle=uncollapse;leaveslave=collapse' \
580
^fg(grey85) | awk '{print $1}'
583
^co(4x4) Dzen as xmonad (see http://xmonad.org) statusbar:
585
^fg(grey85) status.sh | dzen2 -ta r -fn '-*-profont-*-*-*-*-11-*-*-*-*-*-iso8859' -bg '#aecf96' -fg black \
586
^fg(grey85) -p -e 'sigusr1=raise;sigusr2=lower;onquit=exec:rm /tmp/dzen2-pid;button3=exit' & echo $! > /tmp/dzen2-pid