Difference between revisions of "Dzen"

From ArchWiki
Jump to: navigation, search
(Update official link)
(Replace example link to a gif showing dzen2 popups)
 
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 +
{{Out of date|The current official package works with Xft but not X Logical Font Description}}
 
[[Category:Application launchers]]
 
[[Category:Application launchers]]
 
[[Category:Eye candy]]
 
[[Category:Eye candy]]
 
[[Category:Status monitoring and notification]]
 
[[Category:Status monitoring and notification]]
 +
[[ja:Dzen]]
 
[http://robm.github.com/dzen/ Dzen] is "a general purpose messaging, notification and menuing program for X11. It was designed to be scriptable in any language and integrate well with window managers like [[dwm]], [[wmii]] and [[xmonad]] though it will work with any window manager."
 
[http://robm.github.com/dzen/ Dzen] is "a general purpose messaging, notification and menuing program for X11. It was designed to be scriptable in any language and integrate well with window managers like [[dwm]], [[wmii]] and [[xmonad]] though it will work with any window manager."
  
 
== Installation ==
 
== Installation ==
[[pacman|Install]] the {{Pkg|dzen2}} package which is available in the [[Official Repositories|official repositories]]. The official {{pkg|dzen2}} package includes Xft, XPM, and Xinerama support.
 
  
NOTICE: Xft doesn't seem to work with the official package. Alternatively, you can install the {{AUR|dzen2-xft-xpm-xinerama-svn}} package located in the [[Arch User Repository|AUR]] with Xft, XPM and Xinerama support.
+
[[Install]] the {{Pkg|dzen2}} package which is available in the [[official repositories]] which includes Xft, XPM, and Xinerama support.
 +
 
 +
{{Note|Xft doesn't seem to work with the official package. Alternatively, you can install the {{AUR|dzen2-xft-xpm-xinerama-git}} package located in the [[AUR]] with Xft, XPM and Xinerama support.}}
  
 
== Configuration ==
 
== Configuration ==
 +
 
Dzen is able to read font and color settings from [[X resources]]. As an example, you can add following lines to {{ic|~/.Xresources}}:
 
Dzen is able to read font and color settings from [[X resources]]. As an example, you can add following lines to {{ic|~/.Xresources}}:
 
  dzen2.font:      -*-fixed-*-*-*-*-*-*-*-*-*-*-*-*
 
  dzen2.font:      -*-fixed-*-*-*-*-*-*-*-*-*-*-*-*
Line 15: Line 19:
 
  dzen2.background: black
 
  dzen2.background: black
  
== Tips & Tricks ==
+
== Tips and tricks ==
  
 
=== Using custom fonts with dzen ===
 
=== Using custom fonts with dzen ===
Some fonts like {{Pkg|terminus-font}} are installed in {{ic|/usr/share/fonts/local}}, which is not added to the font path by default. If you would like to use these custom fonts with dzen2 you can either add the path to your local fonts directory into {{ic|/etc/X11/xorg.conf}}:
 
Section "Files"
 
      ...
 
      FontPath    "/usr/share/fonts/local"
 
      ...
 
EndSection
 
  
Or, if you do not have permission to change {{ic|xorg.conf}}, you can add the following to {{ic|~/.xinitrc}}:
+
Dzen follows the [[X Logical Font Description]] so it will only find fonts in the X font path. See [[Fonts#Older applications]] for details.
xset +fp /usr/share/fonts/local
+
xset fp rehash
+
  
For further information see the [[Font Configuration]] and [[Fonts]] articles.
+
=== Dzen and Conky ===
  
=== Dzen & Conky ===
 
 
[[Conky]] can be used to pipe information directly to dzen for output in a status bar.   
 
[[Conky]] can be used to pipe information directly to dzen for output in a status bar.   
This can be done with Conky in the official repositories and also with {{AUR|conky-cli}}, a stripped-down version of the Conky status utility from the [[Arch User Repository|AUR]].
+
This can be done with Conky in the official repositories and also with {{AUR|conky-cli}}, a stripped-down version of the Conky status utility from the [[AUR]].
  
 
The following example displays the average load values in red and the current time in the default dzen foreground colour:
 
The following example displays the average load values in red and the current time in the default dzen foreground colour:
Line 58: Line 53:
 
</nowiki>}}
 
</nowiki>}}
 
Simply execute {{ic|dzconky}} in your startup scripts.
 
Simply execute {{ic|dzconky}} in your startup scripts.
 +
 +
=== Clickable areas and popups ===
 +
 +
dzen2 allows you to define clickable areas using {{ic|^ca(''button'', ''command'')Text^ca()}}.
 +
You can use this property to create popups giving arbitrary information, as seen in various screenshot gifs like [http://i.imgur.com/bZegioR.gif this].
 +
 +
A simple example can be:
 +
{{hc|sysinfo_popup.sh|<nowiki>
 +
#/bin/bash
 +
 +
#A simple popup showing system information
 +
 +
HOST=$(uname -n)
 +
KERNEL=$(uname -r)
 +
UPTIME=$( uptime | sed 's/.* up //' | sed 's/[0-9]* us.*//' | sed 's/ day, /d /'\
 +
          | sed 's/ days, /d /' | sed 's/:/h /' | sed 's/ min//'\
 +
            |  sed 's/,/m/' | sed 's/  / /')
 +
PACKAGES=$(pacman -Q | wc -l)
 +
UPDATED=$(awk '/upgraded/ {line=$0;} END { $0=line; gsub(/[\[\]]/,"",$0); \
 +
          printf "%s %s",$1,$2;}' /var/log/pacman.log)
 +
 +
(
 +
echo "System Information" # Fist line goes to title
 +
# The following lines go to slave window
 +
echo "Host: $HOST "
 +
echo "Kernel: $KERNEL"
 +
echo "Uptime: $UPTIME "
 +
echo "Pacman: $PACKAGES packages"
 +
echo "Last updated on: $UPDATED"
 +
) | dzen2 -p -x "500" -y "30" -w "220" -l "5" -sa 'l' -ta 'c'\
 +
    -title-name 'popup_sysinfo' -e 'onstart=uncollapse;button1=exit;button3=exit'
 +
 +
# "onstart=uncollapse" ensures that slave window is visible from start.
 +
</nowiki>}}
 +
Save this script and make it executable and then use the {{ic|^ca()}} attribute in your conkyrc (or the script that you pipe to dzen2) to trigger it.
 +
{{ic|^ca(1,''<path to your script>'')Sysinfo^ca()}}
 +
 +
This will bind the script to mouse button 1 and execute it when it is clicked over the text.
  
 
=== Enabling Xft support for dzen ===
 
=== Enabling Xft support for dzen ===
  
{{Note|You need to install the {{pkg|libxft}} package.}}
+
{{Note|You need to install the {{Pkg|libxft}} package.}}
  
 
As of SVN revision 241 (development), dzen2 has optional support for Xft. To enable Xft support, build dzen2 with these options by editing {{ic|config.mk}}:
 
As of SVN revision 241 (development), dzen2 has optional support for Xft. To enable Xft support, build dzen2 with these options by editing {{ic|config.mk}}:
Line 67: Line 100:
 
{{hc|config.mk|<nowiki>
 
{{hc|config.mk|<nowiki>
 
  ## Option: With Xinerama and XPM and XFT
 
  ## Option: With Xinerama and XPM and XFT
  LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXinerama -lXpm `pkg-config --libs xft`
+
  LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXinerama -lXpm $(pkg-config --libs xft)
  CFLAGS = -Wall -Os ${INCS} -DVERSION=\"${VERSION}\" -DDZEN_XINERAMA -DDZEN_XPM -DDZEN_XFT `pkg-config --cflags xft`
+
  CFLAGS = -Wall -Os ${INCS} -DVERSION=\"${VERSION}\" -DDZEN_XINERAMA -DDZEN_XPM -DDZEN_XFT $(pkg-config --cflags xft)
 
</nowiki>}}
 
</nowiki>}}
  
Line 75: Line 108:
  
 
== See also ==
 
== See also ==
* [https://sites.google.com/site/gotmor/dzen Official website], [http://dzen.geekmode.org/dwiki/doku.php?id=dzen:mainindex wiki], and [http://code.google.com/p/dzen/ source]
+
 
 +
* [http://robm.github.com/dzen/ Official website], [https://github.com/robm/dzen/wiki/_pages wiki], and [https://github.com/robm/dzen source]
  
 
'''Forum threads'''
 
'''Forum threads'''
 
* 2007-12-04 - Arch Linux - [https://bbs.archlinux.org/viewtopic.php?id=40637 dzen & xmobar Hacking Thread]
 
* 2007-12-04 - Arch Linux - [https://bbs.archlinux.org/viewtopic.php?id=40637 dzen & xmobar Hacking Thread]

Latest revision as of 20:16, 13 May 2016

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: The current official package works with Xft but not X Logical Font Description (Discuss in Talk:Dzen#)

Dzen is "a general purpose messaging, notification and menuing program for X11. It was designed to be scriptable in any language and integrate well with window managers like dwm, wmii and xmonad though it will work with any window manager."

Installation

Install the dzen2 package which is available in the official repositories which includes Xft, XPM, and Xinerama support.

Note: Xft doesn't seem to work with the official package. Alternatively, you can install the dzen2-xft-xpm-xinerama-gitAUR package located in the AUR with Xft, XPM and Xinerama support.

Configuration

Dzen is able to read font and color settings from X resources. As an example, you can add following lines to ~/.Xresources:

dzen2.font:       -*-fixed-*-*-*-*-*-*-*-*-*-*-*-*
dzen2.foreground: #22EE11
dzen2.background: black

Tips and tricks

Using custom fonts with dzen

Dzen follows the X Logical Font Description so it will only find fonts in the X font path. See Fonts#Older applications for details.

Dzen and Conky

Conky can be used to pipe information directly to dzen for output in a status bar. This can be done with Conky in the official repositories and also with conky-cliAUR, a stripped-down version of the Conky status utility from the AUR.

The following example displays the average load values in red and the current time in the default dzen foreground colour:

~/.conkyrc
 background no
 out_to_console yes
 out_to_x no
 update_interval 1.0
 total_run_times 0
 use_spacer none
 
 TEXT
 ^fg(\#ff0000)${loadavg 1 2 3} ^fg()${time %a %b %d %I:%M%P}
~/bin/dzconky
 #!/bin/sh
 
 FG='#aaaaaa'
 BG='#1a1a1a'
 FONT='-*-terminus-*-r-normal-*-*-120-*-*-*-*-iso8859-*'
 conky | dzen2 -e - -h '16' -w '600' -ta r -fg $FG -bg $BG -fn $FONT &

Simply execute dzconky in your startup scripts.

Clickable areas and popups

dzen2 allows you to define clickable areas using ^ca(button, command)Text^ca(). You can use this property to create popups giving arbitrary information, as seen in various screenshot gifs like this.

A simple example can be:

sysinfo_popup.sh
 #/bin/bash

 #A simple popup showing system information

 HOST=$(uname -n)
 KERNEL=$(uname -r)
 UPTIME=$( uptime | sed 's/.* up //' | sed 's/[0-9]* us.*//' | sed 's/ day, /d /'\
          | sed 's/ days, /d /' | sed 's/:/h /' | sed 's/ min//'\
            |  sed 's/,/m/' | sed 's/  / /')
 PACKAGES=$(pacman -Q | wc -l)
 UPDATED=$(awk '/upgraded/ {line=$0;} END { $0=line; gsub(/[\[\]]/,"",$0); \
          printf "%s %s",$1,$2;}' /var/log/pacman.log)

 (
 echo "System Information" # Fist line goes to title
 # The following lines go to slave window
 echo "Host: $HOST "
 echo "Kernel: $KERNEL"
 echo "Uptime: $UPTIME "
 echo "Pacman: $PACKAGES packages"
 echo "Last updated on: $UPDATED"
 ) | dzen2 -p -x "500" -y "30" -w "220" -l "5" -sa 'l' -ta 'c'\
    -title-name 'popup_sysinfo' -e 'onstart=uncollapse;button1=exit;button3=exit'

 # "onstart=uncollapse" ensures that slave window is visible from start.

Save this script and make it executable and then use the ^ca() attribute in your conkyrc (or the script that you pipe to dzen2) to trigger it.

^ca(1,<path to your script>)Sysinfo^ca()

This will bind the script to mouse button 1 and execute it when it is clicked over the text.

Enabling Xft support for dzen

Note: You need to install the libxft package.

As of SVN revision 241 (development), dzen2 has optional support for Xft. To enable Xft support, build dzen2 with these options by editing config.mk:

config.mk
 ## Option: With Xinerama and XPM and XFT
 LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXinerama -lXpm $(pkg-config --libs xft)
 CFLAGS = -Wall -Os ${INCS} -DVERSION=\"${VERSION}\" -DDZEN_XINERAMA -DDZEN_XPM -DDZEN_XFT $(pkg-config --cflags xft)

To check libxft support, you can use this command:

echo "hello world" | dzen2 -fn 'Times New Roman' -p

See also

Forum threads