gnome-wm 経由で compiz を起動する。

Debian Wiki の compiz エントリをはじめ、どこの Compiz 導入手順書を見ても、セッション開始時の起動方法として次のようなものが紹介されている。

Restart your X.org server and login into GNOME. Open a terminal and issue the following command:


compiz --replace

If everything is correct you will be able to use all compiz resources.

You may want to start your compiz automatically with GNOME:
Add "compiz --replace" to "Desktop -> Preferences -> Sessions -> Startup Programs".

いや、違う、違う、違うんだよ!! 本来であれば、$HOME/.gnomerc に

WINDOW_MANAGER=compiz
export WINDOW_MANAGER

と書くだけであとは /usr/bin/gnome-wm がよしなにやってくれるはずなのだ (もしくは gconf-editor で /desktop/gnome/applications/window_manager/default を書き換え)。ところが、そう期待して設定しても、まともに動いてくれない。これには gnome-wm に秘密があった。

実は gnome-wm は単なるシェルスクリプトで、ウィンドウマネージャごとに異なっている可能性のあるセッションを指定するオプションの差異を吸収するために用意されている。ソースコードを見ると一目瞭然だ。

# Now create options OPT1 and OPT2 based on the windowmanager used
OPT1=
OPT2=
if [ ! -z "$SMID" ] ; then
  case `basename $WINDOW_MANAGER` in
    sawfish|sawmill|metacity)
      OPT1=--sm-client-id=$SMID
      ;;
    openbox)
      OPT1=--sm-client-id
      OPT2=$SMID
      ;;
    enlightenment|twm)
      OPT1=-clientId
      OPT2=$SMID
      ;;
    lwm)
      OPT1=-s
      OPT2=$SMID
      ;;
    #FIXME: add all other windowmanagers here with their proper options
  esac
fi

これは lenny で使われている gnome-session-2.14.3 に同梱のスクリプトの一部を抜粋したものだが、見る限り compiz がサポートされていないようだ。GNOMEsubversion レポジトリを見てみると、r4148 (see also Bug #350848) で修正されている。

単なるシェルスクリプトだし、目的から言って上位バージョンで互換性が損なわれることもなさそうだ。あっさり置き換えてしまおう。

$ cd /usr/bin/ && sudo wget -r http://svn.gnome.org/svn/gnome-session/trunk/gnome-session/gnome-wm

はい、すみません。相当やんちゃです。DNS Spoofing とかされていないことを祈りましょう (違)