MATE - FreeBSD 13.0 RELEASE - 環境構築

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

1. 概要

 下記のデスクトップ環境を構築する手順を記述します。  ここまでの時点で、システムインストールと「VirtualBox Guest Additions」の設定は終わっているものとします。  ぞれぞれのインストール・設定に関しては 「デスクトップ環境構築 - 共通事項 - システムインストール」 「デスクトップ環境構築 - 共通事項 - VirtualBox Guest Additions」  をご参照ください。
 項目   内容   備考 
ホスト Windows10 Version 20H2
VitualBox Version 6.1.18
ゲスト FreeBSD 13.0 RELEASE
ログインマネージャ SDDM

2. インストール

 「root」ユーザで

pkg install -y xorg ja-font-migmix
pkg install -y sddm sddm-freebsd-black-theme cursor-neutral-white-theme
pkg install -y mate brisk-menu dconf-editor
 前バージョンに比べると、短期間の間に、モジュールの構成や名称に変化があったようです。  2021年4月16日時点の「MATE」のバージョンは、下記の通りでした。  前回の「FreeBSD」の前回のバージョンでインストールしたときが、「mate-1.22.2」だったので、少し上がっています。

$ pkg info mate
mate-1.24.1
Name           : mate
Version        : 1.24.1
Installed on   : Fri Apr 16 12:27:17 2021 JST
Origin         : x11/mate
Architecture   : FreeBSD:13:*
Prefix         : /usr/local
Categories     : x11 mate
Licenses       :
Maintainer     : gnome@FreeBSD.org
WWW            : http://www.FreeBSD.org/gnome/
Comment        : "meta-port" for the MATE integrated X11 desktop
Annotations    :
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 0.00B
Description    :
MATE is a fork of GNOME 2.

It provides an intuitive and attractive desktop to users using
traditional metaphors.

--

Where does the name come from?

The name "MATE" comes from yerba mate, a species of holly native
to subtropical South America. Its leaves contain caffeine and are
used to make infusions and a beverage called mate.

--

This metaport installs MATE base (lite, a lean desktop) plus
extras applications such as text editor, archiver manager and
etc. If you do not want to have the bloats, please install
x11/mate-base.

WWW: http://www.FreeBSD.org/gnome/

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
 「xrandr」の設定値は、ハードウェア構成によって異なりますので、ご注意ください。  適切に設定しないと、デスクトップ上の文字が、異常に大きくなったりします。  ログイン画面のテーマとカーソルを変更します。  「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. シャットダウンユーザの設定

 一般ユーザからもシャットダウンできるようにします。  逆に、一般ユーザからシャットダウンさせないようにするにはこの手順を行わないでください。  「MATE - 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」ユーザで

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
chmod +x /usr/share/skel/dot.xsession
 既存のログインユーザで

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

6. /etc/rc.conf 編集

 前項までインストール・設定したものを有効にします。

sysrc polkitd_enable=YES
sysrc dbus_enable=YES
sysrc sddm_enable=YES

7. ログインマネージャ起動

 「root」ユーザで

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

ハイスピードプラン健康サポート特集それがだいじWi-Fi