ここまでの時点で、システムインストールと「VirtualBox Guest Additions」の設定は終わっているものとします。
ぞれぞれのインストール・設定に関しては、
「FreeBSD - デスクトップ環境構築 - 共通事項 - システムインストール」
「FreeBSD - デスクトップ環境構築 - 共通事項 - VirtualBox Guest Additions」
をご参照ください。
2. インストール
「root」ユーザ権限で。
pkg install -y xorg ja-font-migmix numlockx
pkg install -y sddm sddm-freebsd-black-theme cursor-neutral-white-theme
pkg install -y x11/lxde-meta
2021年6月9日時点の「LXDE」のバージョンは、下記の通りでした。
$ pkg info lxde-meta
lxde-meta-1.0_8
Name : lxde-meta
Version : 1.0_8
Installed on : Wed Jun 9 08:50:28 2021 JST
Origin : x11/lxde-meta
Architecture : FreeBSD:13:*
Prefix : /usr/local
Categories : x11
Licenses :
Maintainer : ports@FreeBSD.org
WWW : https://lxde.org/
Comment : "meta-port" of the LXDE desktop slimmed down for FreeBSD releases
Annotations :
repo_type : binary
repository : FreeBSD
Flat size : 0.00B
Description :
LXDE is a small and lightweight X11 Desktop
WWW: https://lxde.org/
2020年11月6日、「FreeBSD 12.2 RLEASE」へインストールしたときと変わっていません。
「LXDE」の主力は、おそらく後継の「LXQt」へ移行しているので、バージョンアップは、ないものと思われます。
3. SDDM カスタマイズ
ログイン画面の解像度を「1366x768」とし、キーボードレイアウトを「jp.106」にします。
「root」ユーザ権限で。
cat << EOF >> /usr/local/share/sddm/scripts/Xsetup
xrandr --output VGA-0 --mode 1366x768 --rate 60
setxkbmap -layout jp
EOF
ログイン画面のテーマとカーソルを変更します。
「root」ユーザのまま。
sddm --example-config > /usr/local/etc/sddm.conf
vi /usr/local/etc/sddm.conf
[Theme]
# Current theme name
Current=breeze
# Cursor theme used in the greeter
CursorTheme=breeze_cursors
を下記へ変更します。
[Theme]
# Current theme name
Current=sddm-freebsd-black-theme
# Cursor theme used in the greeter
CursorTheme=Neutral++_White
4. シャットダウンユーザの設定
一般ユーザからもシャットダウンできるようにします。
逆に、一般ユーザからシャットダウンさせないようにするにはこの手順を行わないでください。
「LXDE - Why does Mate system menu not have the Shutdown and Restart items? | The FreeBSD Forums」を参考にさせていただきました。
/usr/local/etc/polkit-1/rules.d/50-default.rules
を編集します。
「root」ユーザ権限で。
sh
cat << 'EOF' >> /usr/local/etc/polkit-1/rules.d/50-default.rules
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;
}
});
EOF
exit
「wheel」の箇所に、再起動・シャットダウンを許可したいユーザの所属する、グループ名を記述します。
わたしは、サスペンドを使いませんので、省略しています。
サスペンドを許可するには、「subject.isInGroup("wheel"))」の前に続けて、「|| action.id == "org.freedesktop.consolekit.system.suspend"」を追加します。
5. ユーザ用初期化ファイルの作成
「root」ユーザ権限で。
sh
cat << 'EOF' >> /usr/share/skel/dot.xsession
#!/bin/sh
# set locale
export LC_ALL=ja_JP.UTF-8
export LANGUAGE=ja_JP.UTF-8
export LANG=ja_JP.UTF-8
#
setxkbmap -layout jp
EOF
exit
chmod +x /usr/share/skel/dot.xsession
既存のログインユーザで
cp /usr/share/skel/dot.xsession ~/.xsession
6. /etc/rc.conf 編集
前項までインストール・設定したものを有効にします。
「root」ユーザ権限で。
sysrc polkitd_enable=YES
sysrc dbus_enable=YES
sysrc sddm_enable=YES
7. ログインマネージャ起動
「root」ユーザ権限で。
service dbus start
service sddm start
うまく設定できていれば、ログイン画面が表示されます。
ユーザ名・パスワードを入力してログインします。