XFCE - FreeBSD 14.0 RELEASE - 環境構築

 クラウディア
1. 概要
2. インストール
3. SDDM カスタマイズ
4. シャットダウンユーザ設定
5. ユーザ用初期化ファイルの作成
6. ログインマネージャ起動

1. 概要

 下記のデスクトップ環境を構築する手順を記述します。
 種別   リソース・設定   備考 
ホスト Windows11 23H2
仮想環境 VirtualBox 7.0.14
ゲスト FreeBSD 14.0 RELEASE
ログインマネージャ SDDM
仮想システムタイプ BSD
仮想システムバージョン FreeBSD (64bit)
ハードディスク 180 GB
メモリ 4 GB
CPU 2コア
グラフィックスコントローラ VBoxSVGA 128MB 3D Disable

 ここまでの時点で、システムインストールと「VirtualBox Guest Additions」の設定は終わっているものとします。
 ぞれぞれのインストール・設定に関しては

	「FreeBSD - デスクトップ環境構築 - 共通事項 - システムインストール」
	「FreeBSD - デスクトップ環境構築 - 共通事項 - VirtualBox Guest Additions」

 をご参照ください。

2. インストール

 「root」ユーザで

pkg install -y xorg numlockx ja-font-migmix
pkg install -y sddm sddm-freebsd-black-theme cursor-neutral-white-theme

pkg install -y x11-wm/xfce4 xfce4-screenshooter-plugin xfce4-whiskermenu-plugin
 2020年10月30日時点の「XFCE」のバージョンは、「xfce4-wm-4.14.5」でした。  2021年4月20日、2021年12月16日、2022年12月7日時点の「XFCE」のバージョンは、「xfce4-wm-4.16.1_1」でした。  2023年4月14日時点のバージョンは、「xfce4-wm-4.18.0_1」でした。  2023年12月14日時点のバージョンは、下記のとおりです。  末尾のリビジョンが、ひとつだけ上がりました。

$ pkg info xfce4-wm
xfce4-wm-4.18.0_3
Name           : xfce4-wm
Version        : 4.18.0_2
Installed on   : Thu Dec 14 17:51:29 2023 JST
Origin         : x11-wm/xfce4-wm
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : xfce x11-wm
Licenses       : GPLv2
Maintainer     : xfce@FreeBSD.org
WWW            : https://xfce.org/
Comment        : Xfce's window manager
Options        :
        NLS            : on
        STARTUP        : on
Shared Libs required:
        libxfconf-0.so.3
        libxfce4util.so.7
        libxfce4ui-2.so.0
        libxfce4kbd-private-3.so.0
        libwnck-3.so.0
        libstartup-notification-1.so.0
        libpangocairo-1.0.so.0
        libpango-1.0.so.0
        libintl.so.8
        libharfbuzz.so.0
        libgtk-3.so.0
        libgobject-2.0.so.0
        libglib-2.0.so.0
        libgio-2.0.so.0
        libgdk_pixbuf-2.0.so.0
        libgdk-3.so.0
        libepoxy.so.0
        libcairo.so.2
        libcairo-gobject.so.2
        libatk-1.0.so.0
        libXrender.so.1
        libXrandr.so.2
        libXpresent.so.1
        libXinerama.so.1
        libXfixes.so.3
        libXext.so.6
        libXdamage.so.1
        libXcomposite.so.1
        libXRes.so.1
        libX11.so.6
        libSM.so.6
        libICE.so.6
Annotations    :
        FreeBSD_version: 1400097
        build_timestamp: 2023-12-03T10:22:52+0000
        built_by       : poudriere-git-3.3.0-1258-gbc38e2e6
        port_checkout_unclean: no
        port_git_hash  : 2b5c95373
        ports_top_checkout_unclean: no
        ports_top_git_hash: 84b4661ec
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 2.20MiB
Description    :
The Xfce 4 window manager manages the placement of application
windows on the screen, provides window decorations, and manages
workspaces or virtual desktops.

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 size used in the greeter
CursorSize=

# Cursor theme used in the greeter
CursorTheme=breeze_cursors
 を下記へ変更します。

[Theme]
# Current theme name
Current=sddm-freebsd-black-theme

# Cursor size used in the greeter
CursorSize=

# Cursor theme used in the greeter
CursorTheme=Neutral++_White

4. シャットダウンユーザの設定

 一般ユーザからもシャットダウンできるようにします。  逆に、一般ユーザからシャットダウンさせないようにするにはこの手順を行わないでください。  本項は、「XFCE - 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」の箇所に、再起動・シャットダウンを許可したいユーザの所属する、グループ名を記述します。  わたしは、サスペンドを使いませんので、省略しています。  サスペンドを許可するには、

    if ((action.id == "org.freedesktop.consolekit.system.restart" ||
         action.id == "org.freedesktop.consolekit.system.stop")   &&
 の個所を下記へ変更します。

    if ((action.id == "org.freedesktop.consolekit.system.restart"  ||
         action.id == "org.freedesktop.consolekit.system.stop")    ||
		 action.id == "org.freedesktop.consolekit.system.suspend") &&

5. ユーザ用初期化ファイルの作成

 「root」ユーザ権限で。

sh
cat << 'EOF' >> /etc/profile
export LC_ALL="ja_JP.UTF-8"
export LANGUAGE="ja_JP.UTF-8"
export LANG="ja_JP.UTF-8"
EOF

cat << 'EOF' >> /etc/csh.cshrc
setenv LC_ALL   "ja_JP.UTF-8"
setenv LANGUAGE "ja_JP.UTF-8"
setenv LANG     "ja_JP.UTF-8"
EOF

cat << 'EOF' >> /usr/share/skel/dot.xsession
#!/bin/sh
#
setxkbmap -layout jp
EOF
exit
chmod +x /usr/share/skel/dot.xsession
 既存のログインユーザで。

cp /usr/share/skel/dot.xsession ~/.xsession

6.グインマネージャ起動

 インストールしたものを有効化します。  「root」ユーザ権限で。

sysrc polkitd_enable=YES
sysrc dbus_enable=YES
sysrc sddm_enable=YES
 起動します。  「root」ユーザ権限で。

service dbus start
service sddm start
 うまく設定できていれば、ログイン画面が表示されます。  ユーザ名・パスワードを入力してログインします。
「XFCE FreeBSD 14.0」-「ログイン画面」

ハイスピードプランU-NEXT5G CONNECT