FreeBSDでXorgを使う


Xorgをインストールする

# pkg install xorg      

FreeBSD on VMwareの場合はさらにVMware用各種ドライバーも追加でインストールする

# pkg install xf86-input-vmmouse
# pkg install xf86-video-vmware
# pkg install open-vm-tools

FreeBSD on Raspberry Pi/Pi2 の場合はさらに SCFB(System Console Frame Buffer) ドライバーと evdevドライバーも追加でインストールする

# pkg install xf86-video-scfb
# pkg install xf86-input-evdev

FreeBSD on Raspberry Pi/Pi2 の場合はさらに /usr/local/etc/X11/xorg.conf.d/video-pi2.conf も設定する

Section "Device"
        Identifier      "Generic FB"
        Driver          "scfb"
        Option          "NoAccel" "True"
EndSection

Section "Screen"
       Identifier      "Screen"
       Device          "Generic FB"
       Monitor         "Monitor"
EndSection

/etc/rc.confに設定追加

dbus_enable="YES"
hald_enable="YES"

日本語106キーボード

/usr/local/etc/X11/xorg.conf.d/keyboard-layout.conf

Section "InputClass"
        Identifier              "Keyboard Defaults"
        Driver                  "keyboard"
        MatchIsKeyboard         "on"
        Option                  "XkbRules" "xorg"
        Option                  "XkbModel" "jp106"
        Option                  "XkbLayout" "jp"
        Option                  "XkbOptions" "ctrl:nocaps"
        Option                  "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

FreeBSD on VMwareの場合はさらに /usr/local/etc/X11/xorg.conf.d/input-vmmouse.conf も設定する

Section "InputClass"
        Identifier              "Mouse Defaults"
        Driver                  "vmmouse"
        MatchIsPointer          "on"
EndSection

/usr/local/etc/hal/fdi/policy/10-x11-input-kbd.fdi

現在のXorgはhald経由では機能しないようですが、 古いバージョンを使っている人のために一応残しておきます。

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keyboard">
      <merge key="input.x11_options.XkbRules" type="string">xorg</merge>
      <merge key="input.x11_options.XkbModel" type="string">jp106</merge>
      <merge key="input.x11_options.XkbLayout" type="string">jp</merge>
      <merge key="input.x11_options.XkbOptions" type="string">ctrl:nocaps</merge>
      <merge key="input.x11_options.XkbOptions" type="string">terminate:ctrl_alt_bksp</merge>
    </match>
  </device>
</deviceinfo>
# /usr/local/etc/rc.d/hald restart

追加フォント

Bitstream Veraクローンフォント: /usr/local/etc/X11/xorg.conf.d/font-dejavu.conf

# pkg install dejavu
Section "Files"
        FontPath "/usr/local/share/fonts/dejavu/"
EndSection

日本語フォント: /usr/local/etc/X11/xorg.conf.d/font-japanese.conf

# pkg install ja-font-std
# cd /usr/local/share/fonts/std.ja_JP
# mkfontdir
# mkfontscale
Section "Files"
        FontPath "/usr/local/share/fonts/std.ja_JP/"
EndSection

LibreOfficeフォント: /usr/local/etc/X11/xorg.conf.d/font-libreoffice.conf

# pkg install liberation-fonts-ttf
# pkg install linuxlibertine
# pkg install linuxlibertine-g
# pkg install crosextrafonts-caladea
Section "Files"
        FontPath "/usr/local/share/fonts/Liberation/"
        FontPath "/usr/local/share/fonts/linuxlibertine/"
        FontPath "/usr/local/share/fonts/LinLibertineG/"
        FontPath "/usr/local/share/fonts/GentiumBasic/"
        FontPath "/usr/local/share/fonts/Caladea/"
        FontPath "/usr/local/share/fonts/Carlito/"
EndSection

全部入り: /usr/local/etc/X11/xorg.conf.d/font.conf

Section "Files"
        FontPath "/usr/local/share/fonts/dejavu/"
        FontPath "/usr/local/share/fonts/std.ja_JP/"
        FontPath "/usr/local/share/fonts/Liberation/"
        FontPath "/usr/local/share/fonts/linuxlibertine/"
        FontPath "/usr/local/share/fonts/LinLibertineG/"
        FontPath "/usr/local/share/fonts/GentiumBasic/"
        FontPath "/usr/local/share/fonts/Caladea/"
        FontPath "/usr/local/share/fonts/Carlito/"
EndSection

起動

% startx
Xorg

The K Desktop Environment

KDEをインストールする

# pkg install kde
# pkg install ja-kde-l10n

/etc/sysctl.confに設定追加

kern.ipc.shmall=32768

$HOME/.xinitrc

if [ -x /usr/local/bin/startkde ]; then
    exec /usr/local/bin/startkde
else
    exec /usr/local/bin/twm
fi

起動

% startx
KDE

Firefox

Firefoxをインストールする

pkgでインストールします。

# pkg install firefox
# pkg install firefox-i18n

Firefoxを起動したら、 Add-on の Languages pack で Japanese Language Pack を有効にします。

続いて、Contents の Languages で Japanese Language を追加します。

最後にabout:config の general.useragent.locale に ja-JP を加えて再起動します。

Firefox config

日本語ロケール

Firefox

日本語入力

mozcをインストールする

# pkg install ja-ibus-mozc

$HOME/.xinitrc

rootでは動作しないことに注意。

export GTK_IM_MODULE=ibus
export QT_IM_MODULE=xim
export XMODIFIERS=@im=ibus
/usr/local/bin/mozc start
ibus-daemon -r --daemonize --xim

mozcを追加する

% ibus-setup
ibus

mozcで日本語入力

Windowsキー + SpaceキーでMozcに切り替えた後、漢字キーでひらがな入力にし ます。

Firefox mozc

参考