XFCE - FreeBSD 12.4 RELEASE - 環境構築

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

1. 概要

 下記のデスクトップ環境を構築する手順を記述します。
 項目   内容   備考 
ホスト Windows10 Version 21H2
VitualBox Version 7.0.2
ゲスト FreeBSD 12.4 RELEASE
ログインマネージャ SDDM

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

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

 をご参照ください。

2. インストール

 「root」ユーザで

pkg install -y xorg 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」でした。  2022年12月7日時点の「XFCE」のバージョンは、下記の通りでした。  2021年4月20日、2021年12月16日時点と変化ありません。

$ pkg info xfce4-wm
xfce4-wm-4.16.1_1
Name           : xfce4-wm
Version        : 4.16.1_1
Installed on   : Wed Dec  7 14:39:17 2022 JST
Origin         : x11-wm/xfce4-wm
Architecture   : FreeBSD:12: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: 1203000
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 2.16MiB
Description    :
The Xfce 4 window manager manages the placement of application windows
on the screen, provides window decorations, and manages work-
spaces or virtual desktops.

WWW: https://xfce.org/

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. シャットダウンユーザの設定

 一般ユーザからもシャットダウンできるようにします。  逆に、一般ユーザからシャットダウンさせないようにするにはこの手順を行わないでください。  本項は、「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' >> /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.グインマネージャ起動

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

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

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

ハイスピードプランPoint anytimeネットオークションの相場、統計、価格比較といえばオークファン