- 1. 概要
- 2. インストール
- 3. シャットダウンユーザの設定
- 4. /etc/rc.conf 編集
- 5. ユーザ用初期化ファイルの作成
- 6. ログインマネージャ起動
1. 概要
下記のデスクトップ環境を構築する手順を記述します。
システム | | ホスト(Windows 10 1903 amd64)・VirtualBox 6.0.14 上のゲストとして FreeBSD 12.1 RELEASE |
ログインマネージャ | | Slim |
日本語入力 | | fcitx-mozc |
インストーラ入手やオペレーティングシステムのインストールあたりまでは「FreeBSD のOSインストール」を参照してください。
2. パッケージインストール
pkg install -y xorg ja-font-migmix ja-fcitx-mozc zh-fcitx-configtool
pkg install -y slim slim-themes
pkg install -y openbox openbox-themes
3. シャットダウンユーザの設定
一般ユーザからもシャットダウンできるようにします。
逆に、一般ユーザからシャットダウンさせないようにするにはこの手順を行わないでください。
下記のファイルを編集して、
vi /usr/local/etc/polkit-1/rules.d/50-default.rules
例えば、「wheel」グループへ、再起動・シャットダウンを許可するものとして、末尾に以下を追加します。
polkit.addRule(function (action, subject)
{
if ((action.id == "org.freedesktop.consolekit.system.restart" ||
action.id == "org.freedesktop.consolekit.system.stop") &&
subject.isInGroup("wheel"))
{
return polkit.Result.YES;
}
});
「wheel」の箇所に、再起動・シャットダウンを許可したいユーザの所属する、グループ名を記述します。
わたしは、サスペンドを使いませんので、省略していますが、サスペンドを許可するには、17行の「)」の前に続けて、「|| action.id == "org.freedesktop.consolekit.system.suspend"」を追加します。
4. /etc/rc.conf 編集
前項までインストール・設定したものを有効にします。
cat - << EOF >> /etc/rc.conf
polkitd_enable="YES"
dbus_enable="YES"
slim_enable="YES"
EOF
5. ユーザ用初期化ファイルの作成
ログインユーザで
~/.xinitrc
というファイルを作成して、編集します。
cat - << EOF >> ~/.xinitrc
#!/bin/sh
# set locale
export LC_ALL=ja_JP.UTF-8
export LANGUAGE=ja_JP.UTF-8
export LANG=ja_JP.UTF-8
#
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=xim
export XMODIFIERS=@im=fcitx
/usr/local/bin/mozc start
fcitx -r -d
/usr/local/bin/VBoxClient-all
#
setxkbmap -layout jp
#
exec $1
EOF
「/usr/local/bin/VBoxClient-all」は、後付けです。「VirtualBox Guest Additions」が自動起動してくれなかったもので・・・。
新規ユーザのために作成したものを /usr/share/skel にコピーしておきます。
cp /home/ユーザ名/.xinitrc /usr/share/skel/dot.xinitrc
6. ログインマネージャ起動
上記までの設定が終わったら、デーモン群を起動します。
service dbus start
service slim start
うまく設定できていれば、ログイン画面(画像はテーマを fbsd にしています)が表示されます。
同時に、GNOME/OpenBox、KDE/OpenBox がインストールされています(本体はインストールしていなくても、セッション情報として)ので、F1 キーで切り替える必要があります。
切り替えるのが面倒な場合は、他のログインを無効にします。
無効にする手順については「FreeBSD - デスクトップ環境構築 - 共通事項 - ログインマネージャ - Slim」をご参照ください。
ユーザ名・パスワードを入力してログインします。

デフォルトのデスクトップはこんな感じになっています。

Linux のディストリビューションと違って、前もって用意しているパネルもメニューもないので、殺風景です。
淋しいので、右クリックメニューのみ表示してみました。それでもないと、デスクトップに見えないので。
2019年11月11日の時点で、Openbox のバージョンは下記の通りでした。
> pkg info openbox
openbox-3.6_5
Name : openbox
Version : 3.6_5
Installed on : Mon Nov 11 10:11:17 2019 JST
Origin : x11-wm/openbox
Architecture : FreeBSD:12:amd64
Prefix : /usr/local
Categories : x11-wm
Licenses : GPLv2
Maintainer : novel@FreeBSD.org
WWW : http://openbox.org/
Comment : Small, fast, standards compliant, extensible window manager
Options :
IMLIB : on
NLS : on
NOTIFY : on
PANGO : on
PATCHES : off
SVG : on
Shared Libs required:
libpangoxft-1.0.so.0
libpangoft2-1.0.so.0
libglib-2.0.so.0
libgobject-2.0.so.0
libXrender.so.1
libpango-1.0.so.0
libfreetype.so.6
libstartup-notification-1.so.0
libXext.so.6
libcairo.so.2
libXau.so.6
libXft.so.2
libxml2.so.2
libICE.so.6
librsvg-2.so.2
libintl.so.8
libXrandr.so.2
libSM.so.6
libfontconfig.so.1
libImlib2.so.1
libXcursor.so.1
libgdk_pixbuf-2.0.so.0
libgio-2.0.so.0
libXinerama.so.1
libX11.so.6
Shared Libs provided:
libobrender.so.29
libobt.so.2
Annotations :
FreeBSD_version: 1200086
repo_type : binary
repository : FreeBSD
Flat size : 1.53MiB
Description :
Openbox is a highly configurable, next generation window manager with
extensive standards support.
Openbox lets you bring the latest applications outside of a full desktop
environment. Most modern applications have been written with GNOME and KDE
in mind. With support for the latest freedesktop.org standards, as well as
careful adherence to previous standards, Openbox provides an environment
where applications work the way they were designed to.
Openbox is a highly configurable window manager. It allows you to change
almost every aspect of how you interact with your desktop and invent
completely new ways to use and control it. It can be like a video game for
controlling windows. But Openbox can also be kept extremely simple, as it is
in the default setup, meaning that it can suit just about anybody. Openbox
gives you control without making you do everything.
Openbox makes desktop environments better. By running Openbox inside the
GNOME or K desktop environments, you can combine their ease and
functionality with the power of Openbox. Your desktop becomes cleaner and
faster, and is in your control, when you use Openbox.
This port also includes optional 3rd party patches for rounder corners
support and miscellaneous fixes from
https://github.com/dylanaraps/openbox-patched.
WWW: http://openbox.org/
|