「Dwm」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(en:Dwmへの転送ページ)
 
(文字列「http://www.youtube.com/」を「https://www.youtube.com/」に置換)
(2人の利用者による、間の7版が非表示)
1行目: 1行目:
  +
{{DISPLAYTITLE:dwm}}
#redirect[[en:Dwm]]
 
  +
[[Category:動的ウィンドウマネージャ]]
  +
[[de:Dwm]]
  +
[[en:Dwm]]
  +
[[es:Dwm]]
  +
[[fr:DWM]]
  +
[[ru:Dwm]]
  +
[[zh-hans:Dwm]]
  +
{{Related articles start}}
  +
{{Related|dmenu}}
  +
{{Related|wmii}}
  +
{{Related articles end}}
  +
[http://dwm.suckless.org/ dwm] は [[Xorg]] の動的ウィンドウマネージャです。タイル・スタック・フルスクリーンレイアウトでウィンドウを管理し、さらに[[#パッチ|パッチ]]を使うことで他のレイアウトも利用できます。レイアウトは動的に適用することができるため、アプリケーションを使用する環境と作業を最適化することが可能です。dwm はきわめて軽量かつ高速であり、C で書かれていてソースコードの行数を2000行以下から増やさないという設計目標を掲げています。[[xrandr]] や Xinerama による[[マルチディスプレイ]]もサポートしています。
  +
  +
== インストール ==
  +
  +
{{note|ソースから dwm をコンパイルしない場合、dwm のカスタマイズはできません。ソースコードを編集して設定を変更することになっているためです。詳しくは [[#設定]] を見て下さい。}}
  +
  +
{{AUR|dwm}} パッケージを[[インストール]]してください。もしくは [[ABS]] や {{AUR|dwm-git}} (開発版) パッケージを使って、必要に応じてソースを変更して dwm をソースからコンパイルしてください。[[Xorg]] 用の軽量・高速なダイナミックメニューである [[dmenu]] もインストールすると良いでしょう。
  +
  +
== dwm の起動 ==
  +
  +
[[ディスプレイマネージャ]]のメニューから ''Dwm'' を選択してください。
  +
  +
もしくは、{{Ic|startx}} や [[SLiM]] ログインマネージャで dwm を起動する場合、以下を {{ic|~/.xinitrc}} に追加します:
  +
exec dwm
  +
  +
== 設定 ==
  +
  +
[[#インストール]] でも触れたように、dwm の設定はコンパイル時にソースコード ({{ic|config.h}}, {{ic|config.mk}}, {{ic|dwm.c}}) を編集することで行います。
  +
  +
変更を加えたら、PKGBUILD のチェックサムを更新してください。[[PKGBUILD#md5sums]] を参照。もしくは、{{ic|--skipinteg}} スイッチを付けて ''makepkg'' を実行することで整合性のチェックをスキップできます。
  +
  +
そして、dwm をコンパイル・インストールしてください:
  +
$ makepkg -fi
  +
  +
設定の変更が正しく行われていれば、上記のコマンドで dwm がコンパイルされ、パッケージがビルド・インストールされます。問題が発生した場合は、出力を確認してください。
  +
  +
最後に、dwm を再起動することで変更が適用されます。
  +
  +
{{Tip|簡単に再コンパイルできるように {{ic|.bashrc}} ファイルに {{ic|alias redwm<nowiki>=</nowiki>'cd ~/dwm; updpkgsums; makepkg -fi --noconfirm; killall dwm'}} と記述してエイリアスを作成しても良いでしょう。}}
  +
  +
=== パッチ ===
  +
  +
公式ウェブサイトには dwm に機能を追加する多数の [http://dwm.suckless.org/patches/ パッチ] を記載しています。これらのパッチは主として {{ic|dwm.c}} ファイルに変更を加えますが {{ic|config.h}} ファイルを変更することもあります。パッチの適用については、[[ABS でパッチを適用]]を見て下さい。
  +
  +
==== ウィンドウタイリングパッチ ====
  +
  +
デフォルトのタイリングモードでは縦に画面が分割されますが、[http://dwm.suckless.org/patches/bottom_stack Bottom Stack] パッチは横方向に画面を分割するタイリングモードを追加します。同じく、bstack horizontal はタイルを水平に分割します。[http://dwm.suckless.org/patches/gapless_grid gaplessgrid] パッチはウィンドウをグリッドのようにタイル化させることができます。
  +
  +
dwm ではデフォルトで、全てのタグに選択したレイアウトが適用されます。タグにあわせて異なるレイアウトを使うようにするには [http://dwm.suckless.org/patches/pertag pertag] パッチを使って下さい。
  +
  +
=== config.h のカスタマイズ ===
  +
  +
{{ic|config.h}} ファイルには dwm の基本的な設定が保存されています。ほとんどの設定は特に説明しなくてもわかるはずです。設定に関する詳しい情報は [http://dwm.suckless.org/customisation/ dwm のウェブサイト] を見て下さい。
  +
  +
==== カスタムキーバインド/ショートカットの追加 ====
  +
  +
カスタムキーバインドを作成するには {{ic|config.h}} に2つエントリが必要です。1つは {{ic|/* commands */}} セクションの下に記述し、もう1つは {{ic|1=static Key keys[] = {}} セクションの下に記述します。
  +
  +
static const char *''keybindname''[] = { "''command''", "''flags''", "''arguments''", NULL };
  +
  +
{{ic|''keybindname''}} は何でもかまいません。{{ic|''command''}}, {{ic|''flags''}}, {{ic|''arguments''}} も何でもかまいませんが {{ic|""}} で囲む必要があります。
  +
  +
例:
  +
  +
{{ic|1={ MODKEY, XK_''key'', spawn, {.v = ''keybindname'' } <nowiki>}</nowiki>}} would bind {{ic|Mod+''key''}} to the command defined previously.
  +
  +
{{ic|1={ MODKEY<nowiki>|</nowiki>ShiftMask, XK_''key'', spawn, {.v = ''keybindname'' } <nowiki>}</nowiki>}} would bind {{ic|Mod+Shift+''key''}} Use ControlMask for {{ic|Ctrl}} key.
  +
  +
Single keys such as {{ic|Fn}} or multimedia keys have to be bound with the hex codes obtainable from the program ''xev''.
  +
  +
{{ic|1={ 0, 0xff00, spawn, {.v = ''keybindname'' } <nowiki>}</nowiki>}} would bind foo key {{ic|0xff00}} to {{ic|''keybindname''}}.
  +
  +
キーコードに関する情報は[[特別なキーボードキー#キーコード]]を見て下さい。
  +
  +
=== config.mk のカスタマイズ ===
  +
  +
{{Warning|ソースからコンパイルしたソフトウェアを直接インストールするのは推奨されません。インストールしたファイルを [[pacman]] が追跡できなくなるからです。}}
  +
  +
{{ic|config.mk}} ファイルは Makefile によって include されます。GNU ''make'' で dwm をコンパイル・実行する方法を設定できます。
  +
  +
パッケージを作成せずに、ソースから直接 dwm をインストールするときは、{{ic|config.mk}} を変更して適当なプレフィックスを設定してください:
  +
  +
{{Ic|PREFIX}} を修正:
  +
PREFIX = /usr
  +
X11 include フォルダ:
  +
X11INC = /usr/include/X11
  +
X11 lib ディレクトリ:
  +
X11LIB = /usr/lib/X11
  +
  +
{{Tip|If you only wish to test configuration changes without affecting systemwide dwm, change {{ic|PREFIX}} to a local directory such as {{ic|${HOME}/.local}}. Note that if you are compiling using the {{AUR|dwm}} [[PKGBUILD]], you should change the {{ic|PREFIX}} in the PKGBUILD instead as this will take precedence over {{ic|config.mk}} - see the ''package()'' function - and you should also change the {{ic|pkgname}}.}}
  +
  +
=== ステータスバーの設定 ===
  +
  +
{{Note|以下の設定を使うには {{Pkg|xorg-xsetroot}} パッケージのインストールが必要です。}}
  +
  +
Dwm はルートウィンドウの名前を読み取ってステータスバーに送信します。ルートウィンドウは他の全てのウィンドウが描画されるウィンドウで、ウィンドウマネージャによって作成されます。他のウィンドウと同じように、ルートウィンドウにもタイトル/名前が存在しますが、ルートウィンドウはバックグラウンドで動作するため基本的に名前は定義されていません。
  +
  +
dwm のステータスバーに表示したい情報は {{ic|~/.xinitrc}} や ([[ディスプレイマネージャ]]を使っている場合) {{ic|~/.xprofile}} で {{ic|xsetroot -name ""}} コマンドを使うことで定義します。例:
  +
{{bc|xsetroot -name "Thanks for all the fish!"}}
  +
  +
Dynamically updated information should be put in a loop which is forked to background - see the example below:
  +
{{bc|
  +
# Statusbar loop
  +
while true; do
  +
xsetroot -name "$( date +"%F %R" )"
  +
sleep 1m # Update time every minute
  +
done &
  +
  +
# Autostart section
  +
pcmanfm &
  +
  +
exec dwm
  +
}}
  +
上記の場合 [[wikipedia:ISO_8601|ISO 8601]] 形式で日付が表示され、起動時に [[PCManFM]] が実行されます。
  +
  +
{{note|It is not recommended to set the update interval equal to zero or remove the "sleep" line entirely since this will cause CPU usage to rise substantially (you can assess the effect with ''top'' and [[powertop]]).}}
  +
  +
ステータスバーのサンプルは [http://dwm.suckless.org/dwmstatus/ suckless wiki] にあります。
  +
  +
==== Conky ステータスバー ====
  +
  +
{{Ic|xsetroot -name}} を使うことでステータスバーに [[Conky]] を出力することができます:
  +
(conky | while read LINE; do xsetroot -name "$LINE"; done) &
  +
exec dwm
  +
  +
この場合、コンソールにテキストを出力するように [[Conky]] を設定する必要があります。以下はデュアルコア CPU で統計を表示させる conkyrc の例です:
  +
{{bc|
  +
<nowiki>conky.config = {
  +
out_to_console = true,
  +
out_to_x = false,
  +
background = false,
  +
update_interval = 2,
  +
total_run_times = 0,
  +
use_spacer = 'none',
  +
};
  +
conky.text = [[
  +
$mpd_smart :: ${cpu cpu1}% / ${cpu cpu2}% ${loadavg 1} ${loadavg 2 3} :: ${acpitemp}c :: $memperc% ($mem) :: ${downspeed eth0}K/s ${upspeed eth0}K/s :: ${time %a %b %d %I:%M%P}
  +
]];</nowiki>
  +
}}
  +
  +
アイコンや色のオプションについては、[[dzen]] を見て下さい。
  +
  +
== 基本的な使い方 ==
  +
  +
以下のセクションだけでなく、dwm の基本的な使用方法については [http://dwm.suckless.org/tutorial dwm チュートリアル] も見て下さい。
  +
  +
=== dmenu を使う ===
  +
  +
[[dmenu]] を起動するには、{{ic|Mod1}} + {{ic|P}} を押します ({{ic|Mod1}} はデフォルトでは {{ic|Alt}} キーです)。必要であればキーは変えられます。そして、トップバーに表示されるまで、実行したいバイナリの最初の文字列を入力します。左と右の方向キーでバイナリを選択してエンターを押します。
  +
  +
=== ウィンドウのコントロール ===
  +
  +
==== ウィンドウにタグを変更 ====
  +
  +
ウィンドウのタグの変更は簡単です。カーソルをウィンドウに乗せて、ウィンドウをフォーカスされた状態にしてください。そして、{{ic|Shift}} + {{ic|Mod1}} + {{ic|x}} を押します。{{ic|x}} はウィンドウを移動したいタグの番号に置き換えてください。デフォルトでは {{ic|Mod1}} は {{ic|Alt}} キーになっています。
  +
  +
==== ウィンドウを閉じる ====
  +
  +
dwm を使ってウィンドウを終了するには、{{ic|Shift}} + {{ic|Mod1}} + {{ic|c}} を押して下さい。
  +
  +
==== ウィンドウレイアウト ====
  +
  +
By default, dwm will operate in tiled mode. This can be observed by new windows on the same tag growing smaller and smaller as new windows are opened. The windows will, together, take up the entire screen (except for the menu bar) at all times. There are, however, two other modes: floating and monocle. Floating mode should be familiar to users of non-tiling window managers; it allows users to rearrange windows as they please. Monocle mode will keep a single window visible at all times.
  +
  +
To switch to floating mode, simply press {{ic|Mod1}} + {{ic|F}}. {{ic|Mod1}} is, by default, the {{ic|Alt}} key. To check if you are in floating mode, you should see something like this next to the numbered tags in the top right corner of the screen: ><>.
  +
  +
To switch to monocole mode, press {{ic|Mod1}} + {{ic|M}}. To check if you are in monocle mode, you can see an M in square brackets (if no windows are open on that tag) or a number in square brackets (which corresponds with the number of windows open on that tag). Thus, a tag with no windows open would display this: [M], and a tag with 'n' windows open would display this: [n].
  +
  +
To return to tiled mode, press {{ic|Mod1}} + {{ic|T}}. You will see a symbol which looks like this: []= .
  +
  +
他のウィンドウレイアウトを使う方法は、[[#ウィンドウタイリングパッチ]]を見て下さい。
  +
  +
=== dwm の終了 ===
  +
  +
dwm を終了するには、{{ic|Shift}} + {{ic|Mod1}} + {{ic|q}} を押して下さい。
  +
  +
== ヒントとテクニック ==
  +
  +
=== ログアウトやプログラムを終了しないで dwm を再起動 ===
  +
  +
For restarting dwm without logging out or closing applications, change or add a startup script so that it loads dwm in a ''while'' loop, see below:
  +
{{bc|
  +
while true; do
  +
# Log stderror to a file
  +
dwm 2> ~/.dwm.log
  +
# No error logging
  +
#dwm >/dev/null 2>&1
  +
done
  +
}}
  +
  +
dwm can now be restarted without destroying other X windows by pressing the usual Mod-Shift-Q combination.
  +
  +
It is a good idea to place the above startup script into a separate file, {{ic|~/bin/startdwm}} for instance, and execute it through {{ic|~/.xinitrc}}. From this point on, when you wish to end the X session, simply execute {{Ic|killall xinit}}, or bind it to a convenient key. Alternatively, you could setup your dwm session script so that it relaunches dwm only if the binary changes. This could be useful in the case where you change a setting or update the dwm code base.
  +
  +
{{bc|1=
  +
# relaunch DWM if the binary changes, otherwise bail
  +
csum=$(sha1sum $(which dwm))
  +
new_csum=""
  +
while true
  +
do
  +
if [ "$csum" != "$new_csum" ]
  +
then
  +
csum=$new_csum
  +
dwm
  +
else
  +
exit 0
  +
fi
  +
new_csum=$(sha1sum $(which dwm))
  +
sleep 0.5
  +
done
  +
}}
  +
  +
=== 右 Alt キーを Mod4 (Windows キー) として使う ===
  +
  +
When using Mod4 (the Super/Windows Key) as the {{Ic|MODKEY}}, it may be equally convenient to have the right Alt key ({{ic|Alt_R}}) act as {{ic|Mod4}}. This will allow you to perform otherwise awkward keystrokes one-handed, such as zooming with {{ic|Alt_R}}+{{ic|Enter}}.
  +
  +
まず、{{ic|Alt_R}} に割り当てられているキーコードを確認してください:
  +
xmodmap -pke | grep Alt_R
  +
  +
Then simply add the following to the startup script (e.g. {{ic|~/.xinitrc}}), changing the keycode ''113'' if necessary to the result gathered by the previous {{Ic|xmodmap}} command:
  +
xmodmap -e "keycode 113 = Super_L" # reassign Alt_R to Super_L
  +
xmodmap -e "remove mod1 = Super_L" # make sure X keeps it out of the mod1 group
  +
  +
After doing so, any functions that are triggered by the {{ic|Super_L}} key press will also be triggered by an {{ic|Alt_R}} key press.
  +
  +
{{note|[[#config.h のカスタマイズ|config.h]] の #define オプションで modkey を切り替えることができます。}}
  +
  +
=== dwm のバーのフォントの周りの空白 ===
  +
  +
デフォルトでは、dwm のバーではフォントのサイズが 2px 追加されます。これを変更するには、{{ic|dwm.c}} の以下の行を変更してください:
  +
{{bc|1=bh = dc.h = dc.font.height + 2;}}
  +
  +
=== マウス追随フォーカスの無効化 ===
  +
  +
マウス追随フォーカスを無効化するには、{{ic|dwm.c}} の以下の行をコメントアウトします:
  +
{{bc|1=[EnterNotify] = enternotify, }}
  +
Note that this change can cause some difficulties; the first click on an inactive window will only bring the focus to it. To interact with window contents (buttons, fields etc) you need to click again. Also, if you have several monitors, you may notice that the keyboard focus does not switch to another monitor activated by clicking.
  +
  +
=== 特定のウィンドウをフロートさせる ===
  +
  +
For some windows, such as preferences dialogs, it does not make sense for these windows to be tiled - they should be free-floating instead. For example, to make Firefox's preferences dialog float, add the following to your rules array in {{ic|config.h}}:
  +
{ "Firefox", NULL, "Firefox Preferences", 1 << 8, True, -1 },
  +
  +
== トラブルシューティング ==
  +
  +
=== Java アプリケーションの挙動がおかしい問題の修正 ===
  +
  +
JRE 6u20 現在、[[Java]] から dwm がウィンドウマネージャとして認識されないために、dwm で Java アプリケーションの挙動がおかしくなることがあります。マウスを離したときにメニューが閉じてしまうなどの問題が確認されています。まず、{{Pkg|wmname}} パッケージをインストールしてください。
  +
  +
そして、''wmname'' を使って Java が認識する WM の名前を設定します:
  +
$ wmname LG3D
  +
  +
{{Note|この設定を使うと Chromium など特定のプログラムをタイルにしたときに問題が起こることがあります。}}
  +
上記の設定は永続的ではないため、上のコマンドを {{ic|.xinitrc}} や {{ic|.xprofile}} に追加してください。
  +
  +
もしくは、{{ic|/etc/profile.d/jre.sh}} で {{ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}} を有効にする方法もあります。
  +
  +
=== 解像度やモニターを変更したときにトップバーが表示されない ===
  +
  +
{{Note|以下のパッチは[[公式リポジトリ]]の dwm-6.0 に適用するためのものです。dwm の開発版ではすでにパッチがマージされています。}}
  +
  +
When resizing or connecting/disconnecting different monitors there may be a remnant of the topbar stuck on the screen which cannot be removed. To fix this bug, rebuild dwm with [http://ix.io/fea this patch].
  +
  +
=== ターミナルウィンドウの周りに空白が生まれる ===
  +
  +
If there are empty gaps of desktop space outside terminal windows, it is likely due to the terminal's font size. Either adjust the size until finding the ideal scale that closes the gap, or toggle {{Ic|resizehints}} to ''False'' in {{ic|config.h}}:
  +
static Bool resizehints = False; /* True means respect size hints in tiled resizals */
  +
  +
This will cause dwm to ignore resize requests from all client windows, not just terminals. The downside to this workaround is that some terminals may suffer redraw anomalies, such as ghost lines and premature line wraps, among others.
  +
  +
== 参照 ==
  +
  +
* [http://dwm.suckless.org/ dwm の公式ウェブサイト]
  +
* [https://www.youtube.com/watch?v=GQ5s6T25jCc Introduction to dwm video]
  +
* [[dmenu]] - dwm の開発者が作ったシンプルなアプリケーションランチャー
  +
* The [https://bbs.archlinux.org/viewtopic.php?id=57549/ dwm thread] on the forums
  +
* [https://bbs.archlinux.org/viewtopic.php?id=92895/ Hacking dwm thread]
  +
* Check out the forums' [https://bbs.archlinux.org/viewtopic.php?id=57768/ wallpaper thread] for a selection of dwm wallpapers
  +
*[https://bbs.archlinux.org/viewtopic.php?id=74599 Show off your dwm configuration forum thread]
  +
* [http://wongdev.com/blog/dwm-tags-are-not-workspaces/ dwm: Tags are not workspaces]

2018年2月6日 (火) 23:43時点における版

関連記事

dwmXorg の動的ウィンドウマネージャです。タイル・スタック・フルスクリーンレイアウトでウィンドウを管理し、さらにパッチを使うことで他のレイアウトも利用できます。レイアウトは動的に適用することができるため、アプリケーションを使用する環境と作業を最適化することが可能です。dwm はきわめて軽量かつ高速であり、C で書かれていてソースコードの行数を2000行以下から増やさないという設計目標を掲げています。xrandr や Xinerama によるマルチディスプレイもサポートしています。

インストール

ノート: ソースから dwm をコンパイルしない場合、dwm のカスタマイズはできません。ソースコードを編集して設定を変更することになっているためです。詳しくは #設定 を見て下さい。

dwmAUR パッケージをインストールしてください。もしくは ABSdwm-gitAUR (開発版) パッケージを使って、必要に応じてソースを変更して dwm をソースからコンパイルしてください。Xorg 用の軽量・高速なダイナミックメニューである dmenu もインストールすると良いでしょう。

dwm の起動

ディスプレイマネージャのメニューから Dwm を選択してください。

もしくは、startxSLiM ログインマネージャで dwm を起動する場合、以下を ~/.xinitrc に追加します:

exec dwm

設定

#インストール でも触れたように、dwm の設定はコンパイル時にソースコード (config.h, config.mk, dwm.c) を編集することで行います。

変更を加えたら、PKGBUILD のチェックサムを更新してください。PKGBUILD#md5sums を参照。もしくは、--skipinteg スイッチを付けて makepkg を実行することで整合性のチェックをスキップできます。

そして、dwm をコンパイル・インストールしてください:

$ makepkg -fi

設定の変更が正しく行われていれば、上記のコマンドで dwm がコンパイルされ、パッケージがビルド・インストールされます。問題が発生した場合は、出力を確認してください。

最後に、dwm を再起動することで変更が適用されます。

ヒント: 簡単に再コンパイルできるように .bashrc ファイルに alias redwm='cd ~/dwm; updpkgsums; makepkg -fi --noconfirm; killall dwm' と記述してエイリアスを作成しても良いでしょう。

パッチ

公式ウェブサイトには dwm に機能を追加する多数の パッチ を記載しています。これらのパッチは主として dwm.c ファイルに変更を加えますが config.h ファイルを変更することもあります。パッチの適用については、ABS でパッチを適用を見て下さい。

ウィンドウタイリングパッチ

デフォルトのタイリングモードでは縦に画面が分割されますが、Bottom Stack パッチは横方向に画面を分割するタイリングモードを追加します。同じく、bstack horizontal はタイルを水平に分割します。gaplessgrid パッチはウィンドウをグリッドのようにタイル化させることができます。

dwm ではデフォルトで、全てのタグに選択したレイアウトが適用されます。タグにあわせて異なるレイアウトを使うようにするには pertag パッチを使って下さい。

config.h のカスタマイズ

config.h ファイルには dwm の基本的な設定が保存されています。ほとんどの設定は特に説明しなくてもわかるはずです。設定に関する詳しい情報は dwm のウェブサイト を見て下さい。

カスタムキーバインド/ショートカットの追加

カスタムキーバインドを作成するには config.h に2つエントリが必要です。1つは /* commands */ セクションの下に記述し、もう1つは static Key keys[] = { セクションの下に記述します。

static const char *keybindname[]   = { "command", "flags", "arguments", NULL };

keybindname は何でもかまいません。command, flags, arguments も何でもかまいませんが "" で囲む必要があります。

例:

{ MODKEY, XK_key, spawn, {.v = keybindname } } would bind Mod+key to the command defined previously.

{ MODKEY|ShiftMask, XK_key, spawn, {.v = keybindname } } would bind Mod+Shift+key Use ControlMask for Ctrl key.

Single keys such as Fn or multimedia keys have to be bound with the hex codes obtainable from the program xev.

{ 0, 0xff00, spawn, {.v = keybindname } } would bind foo key 0xff00 to keybindname.

キーコードに関する情報は特別なキーボードキー#キーコードを見て下さい。

config.mk のカスタマイズ

警告: ソースからコンパイルしたソフトウェアを直接インストールするのは推奨されません。インストールしたファイルを pacman が追跡できなくなるからです。

config.mk ファイルは Makefile によって include されます。GNU make で dwm をコンパイル・実行する方法を設定できます。

パッケージを作成せずに、ソースから直接 dwm をインストールするときは、config.mk を変更して適当なプレフィックスを設定してください:

PREFIX を修正:

PREFIX = /usr

X11 include フォルダ:

X11INC = /usr/include/X11

X11 lib ディレクトリ:

X11LIB = /usr/lib/X11
ヒント: If you only wish to test configuration changes without affecting systemwide dwm, change PREFIX to a local directory such as ${HOME}/.local. Note that if you are compiling using the dwmAUR PKGBUILD, you should change the PREFIX in the PKGBUILD instead as this will take precedence over config.mk - see the package() function - and you should also change the pkgname.

ステータスバーの設定

ノート: 以下の設定を使うには xorg-xsetroot パッケージのインストールが必要です。

Dwm はルートウィンドウの名前を読み取ってステータスバーに送信します。ルートウィンドウは他の全てのウィンドウが描画されるウィンドウで、ウィンドウマネージャによって作成されます。他のウィンドウと同じように、ルートウィンドウにもタイトル/名前が存在しますが、ルートウィンドウはバックグラウンドで動作するため基本的に名前は定義されていません。

dwm のステータスバーに表示したい情報は ~/.xinitrc や (ディスプレイマネージャを使っている場合) ~/.xprofilexsetroot -name "" コマンドを使うことで定義します。例:

xsetroot -name "Thanks for all the fish!"

Dynamically updated information should be put in a loop which is forked to background - see the example below:

# Statusbar loop
while true; do
   xsetroot -name "$( date +"%F %R" )"
   sleep 1m    # Update time every minute
done &

# Autostart section
pcmanfm & 

exec dwm

上記の場合 ISO 8601 形式で日付が表示され、起動時に PCManFM が実行されます。

ノート: It is not recommended to set the update interval equal to zero or remove the "sleep" line entirely since this will cause CPU usage to rise substantially (you can assess the effect with top and powertop).

ステータスバーのサンプルは suckless wiki にあります。

Conky ステータスバー

xsetroot -name を使うことでステータスバーに Conky を出力することができます:

(conky | while read LINE; do xsetroot -name "$LINE"; done) &
exec dwm

この場合、コンソールにテキストを出力するように Conky を設定する必要があります。以下はデュアルコア CPU で統計を表示させる conkyrc の例です:

conky.config = {
out_to_console = true,
out_to_x = false,
background = false,
update_interval = 2,
total_run_times = 0,
use_spacer = 'none',
};
conky.text = [[
$mpd_smart :: ${cpu cpu1}% / ${cpu cpu2}%  ${loadavg 1} ${loadavg 2 3} :: ${acpitemp}c :: $memperc% ($mem) :: ${downspeed eth0}K/s ${upspeed eth0}K/s :: ${time %a %b %d %I:%M%P}
]];

アイコンや色のオプションについては、dzen を見て下さい。

基本的な使い方

以下のセクションだけでなく、dwm の基本的な使用方法については dwm チュートリアル も見て下さい。

dmenu を使う

dmenu を起動するには、Mod1 + P を押します (Mod1 はデフォルトでは Alt キーです)。必要であればキーは変えられます。そして、トップバーに表示されるまで、実行したいバイナリの最初の文字列を入力します。左と右の方向キーでバイナリを選択してエンターを押します。

ウィンドウのコントロール

ウィンドウにタグを変更

ウィンドウのタグの変更は簡単です。カーソルをウィンドウに乗せて、ウィンドウをフォーカスされた状態にしてください。そして、Shift + Mod1 + x を押します。x はウィンドウを移動したいタグの番号に置き換えてください。デフォルトでは Mod1Alt キーになっています。

ウィンドウを閉じる

dwm を使ってウィンドウを終了するには、Shift + Mod1 + c を押して下さい。

ウィンドウレイアウト

By default, dwm will operate in tiled mode. This can be observed by new windows on the same tag growing smaller and smaller as new windows are opened. The windows will, together, take up the entire screen (except for the menu bar) at all times. There are, however, two other modes: floating and monocle. Floating mode should be familiar to users of non-tiling window managers; it allows users to rearrange windows as they please. Monocle mode will keep a single window visible at all times.

To switch to floating mode, simply press Mod1 + F. Mod1 is, by default, the Alt key. To check if you are in floating mode, you should see something like this next to the numbered tags in the top right corner of the screen: ><>.

To switch to monocole mode, press Mod1 + M. To check if you are in monocle mode, you can see an M in square brackets (if no windows are open on that tag) or a number in square brackets (which corresponds with the number of windows open on that tag). Thus, a tag with no windows open would display this: [M], and a tag with 'n' windows open would display this: [n].

To return to tiled mode, press Mod1 + T. You will see a symbol which looks like this: []= .

他のウィンドウレイアウトを使う方法は、#ウィンドウタイリングパッチを見て下さい。

dwm の終了

dwm を終了するには、Shift + Mod1 + q を押して下さい。

ヒントとテクニック

ログアウトやプログラムを終了しないで dwm を再起動

For restarting dwm without logging out or closing applications, change or add a startup script so that it loads dwm in a while loop, see below:

while true; do
    # Log stderror to a file 
    dwm 2> ~/.dwm.log
    # No error logging
    #dwm >/dev/null 2>&1
done

dwm can now be restarted without destroying other X windows by pressing the usual Mod-Shift-Q combination.

It is a good idea to place the above startup script into a separate file, ~/bin/startdwm for instance, and execute it through ~/.xinitrc. From this point on, when you wish to end the X session, simply execute killall xinit, or bind it to a convenient key. Alternatively, you could setup your dwm session script so that it relaunches dwm only if the binary changes. This could be useful in the case where you change a setting or update the dwm code base.

# relaunch DWM if the binary changes, otherwise bail
csum=$(sha1sum $(which dwm))
new_csum=""
while true
do
    if [ "$csum" != "$new_csum" ]
    then
        csum=$new_csum
        dwm
    else
        exit 0
    fi
    new_csum=$(sha1sum $(which dwm))
    sleep 0.5
done

右 Alt キーを Mod4 (Windows キー) として使う

When using Mod4 (the Super/Windows Key) as the MODKEY, it may be equally convenient to have the right Alt key (Alt_R) act as Mod4. This will allow you to perform otherwise awkward keystrokes one-handed, such as zooming with Alt_R+Enter.

まず、Alt_R に割り当てられているキーコードを確認してください:

xmodmap -pke | grep Alt_R

Then simply add the following to the startup script (e.g. ~/.xinitrc), changing the keycode 113 if necessary to the result gathered by the previous xmodmap command:

xmodmap -e "keycode 113 = Super_L"  # reassign Alt_R to Super_L
xmodmap -e "remove mod1 = Super_L"  # make sure X keeps it out of the mod1 group

After doing so, any functions that are triggered by the Super_L key press will also be triggered by an Alt_R key press.

ノート: config.h の #define オプションで modkey を切り替えることができます。

dwm のバーのフォントの周りの空白

デフォルトでは、dwm のバーではフォントのサイズが 2px 追加されます。これを変更するには、dwm.c の以下の行を変更してください:

bh = dc.h = dc.font.height + 2;

マウス追随フォーカスの無効化

マウス追随フォーカスを無効化するには、dwm.c の以下の行をコメントアウトします:

[EnterNotify] = enternotify,

Note that this change can cause some difficulties; the first click on an inactive window will only bring the focus to it. To interact with window contents (buttons, fields etc) you need to click again. Also, if you have several monitors, you may notice that the keyboard focus does not switch to another monitor activated by clicking.

特定のウィンドウをフロートさせる

For some windows, such as preferences dialogs, it does not make sense for these windows to be tiled - they should be free-floating instead. For example, to make Firefox's preferences dialog float, add the following to your rules array in config.h:

 { "Firefox",     NULL,       "Firefox Preferences",        1 << 8,         True,     -1 },

トラブルシューティング

Java アプリケーションの挙動がおかしい問題の修正

JRE 6u20 現在、Java から dwm がウィンドウマネージャとして認識されないために、dwm で Java アプリケーションの挙動がおかしくなることがあります。マウスを離したときにメニューが閉じてしまうなどの問題が確認されています。まず、wmname パッケージをインストールしてください。

そして、wmname を使って Java が認識する WM の名前を設定します:

$ wmname LG3D
ノート: この設定を使うと Chromium など特定のプログラムをタイルにしたときに問題が起こることがあります。

上記の設定は永続的ではないため、上のコマンドを .xinitrc.xprofile に追加してください。

もしくは、/etc/profile.d/jre.shexport _JAVA_AWT_WM_NONREPARENTING=1 を有効にする方法もあります。

解像度やモニターを変更したときにトップバーが表示されない

ノート: 以下のパッチは公式リポジトリの dwm-6.0 に適用するためのものです。dwm の開発版ではすでにパッチがマージされています。

When resizing or connecting/disconnecting different monitors there may be a remnant of the topbar stuck on the screen which cannot be removed. To fix this bug, rebuild dwm with this patch.

ターミナルウィンドウの周りに空白が生まれる

If there are empty gaps of desktop space outside terminal windows, it is likely due to the terminal's font size. Either adjust the size until finding the ideal scale that closes the gap, or toggle resizehints to False in config.h:

static Bool resizehints = False; /* True means respect size hints in tiled resizals */

This will cause dwm to ignore resize requests from all client windows, not just terminals. The downside to this workaround is that some terminals may suffer redraw anomalies, such as ghost lines and premature line wraps, among others.

参照