「Dzen」の版間の差分
(スタイル修正) |
|||
| 22行目: | 22行目: | ||
=== dzen でカスタムフォントを使う === |
=== dzen でカスタムフォントを使う === |
||
| − | Dzen は [[ |
+ | Dzen は [[X Logical Font Description]] に従って X フォントパスにあるフォントしか使いません。詳しくは[[フォント#古いアプリケーション]]を見て下さい。 |
=== Dzen と Conky === |
=== Dzen と Conky === |
||
| + | [[Conky]] から直接情報を受け取りステータスバーとして出力する事が出来ます。これは公式の版でも、より機能を制限した {{AUR|conky-cli}} でも可能です。 |
||
| − | <!-- |
||
| − | [[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]]. |
||
| − | --> |
||
| − | [[Conky]]から直接情報を受け取りステータスバーとして出力する事が出来ます。 |
||
| − | これは公式の版でも,より機能を制限した{{AUR|conky-cli}}でも可能です。 |
||
| + | 以下の例は平均負担値を赤字で、現在時刻を前景色で出力します: |
||
| − | <!-- |
||
| − | The following example displays the average load values in red and the current time in the default dzen foreground colour: |
||
| − | --> |
||
| − | 続く例は読み込みの平均値を赤字で,現在時刻を標準の文字色で出力するものです: |
||
| − | {{hc|~/.conkyrc| |
+ | {{hc|~/.conkyrc|<nowiki> |
| + | background no |
||
| − | <nowiki> |
||
| + | out_to_console yes |
||
| − | background no |
||
| + | out_to_x no |
||
| − | out_to_console yes |
||
| + | update_interval 1.0 |
||
| − | out_to_x no |
||
| + | total_run_times 0 |
||
| − | update_interval 1.0 |
||
| + | use_spacer none |
||
| − | total_run_times 0 |
||
| − | use_spacer none |
||
| − | |||
| − | TEXT |
||
| − | ^fg(\#ff0000)${loadavg 1 2 3} ^fg()${time %a %b %d %I:%M%P} |
||
| − | </nowiki> |
||
| − | }} |
||
| + | TEXT |
||
| − | {{hc|~/bin/dzconky| |
||
| + | ^fg(\#ff0000)${loadavg 1 2 3} ^fg()${time %a %b %d %I:%M%P} |
||
| − | <nowiki> |
||
| + | </nowiki>}} |
||
| − | #!/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 & |
||
| − | </nowiki> |
||
| − | }} |
||
| + | {{hc|~/bin/dzconky|<nowiki> |
||
| − | 起動時に読み込まれるファイルに{{ic|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 & |
||
| + | </nowiki>}} |
||
| + | |||
| + | 起動時に読み込まれるファイルに {{ic|dzconky}} と記述すれば起動します。 |
||
=== クリッカブルエリアとポップアップ === |
=== クリッカブルエリアとポップアップ === |
||
2017年5月13日 (土) 16:44時点における版
Dzen は X11 向けの汎用メッセージング、通知、メニュープログラムです。どの言語でもスクリプト可能なように作られており dwm, wmii, xmonad などのウィンドウマネージャとよく合いますが、ウィンドウマネージャならどれでも動作します。
目次
インストール
公式リポジトリの dzen2 パッケージをインストールしてください。Xft, XPM, Xinerama のサポートが含まれています。
設定
Dzen は X resources からフォントと色の設定を読み込むことができます。例えば、以下の行を ~/.Xresources に追加できます:
dzen2.font: -*-fixed-*-*-*-*-*-*-*-*-*-*-*-* dzen2.foreground: #22EE11 dzen2.background: black
Tips and tricks
dzen でカスタムフォントを使う
Dzen は X Logical Font Description に従って X フォントパスにあるフォントしか使いません。詳しくはフォント#古いアプリケーションを見て下さい。
Dzen と Conky
Conky から直接情報を受け取りステータスバーとして出力する事が出来ます。これは公式の版でも、より機能を制限した conky-cliAUR でも可能です。
以下の例は平均負担値を赤字で、現在時刻を前景色で出力します:
~/.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 &
起動時に読み込まれるファイルに dzconky と記述すれば起動します。
クリッカブルエリアとポップアップ
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 and 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.
dzen の Xft サポートを有効にする
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
参照
フォーラムスレッド
- 2007-12-04 - Arch Linux - dzen & xmobar Hacking Thread