ここまでの時点で、システムインストールと「VirtualBox Guest Additions」の設定は終わっているものとします。
ぞれぞれのインストール・設定に関しては
「FreeBSD - デスクトップ環境構築 - 共通事項 - システムインストール」
「FreeBSD - デスクトップ環境構築 - 共通事項 - VirtualBox Guest Additions」
をご参照ください。
2. インストール
pkg install -y xorg numlockx ja-font-migmix
pkg install -y sddm sddm-freebsd-black-theme cursor-neutral-white-theme
pkg install -y spectrwm
2022年1月6日の時点で、下記のバージョンでした。
$ pkg info spectrwm
spectrwm-3.4.1
Name : spectrwm
Version : 3.4.1
Installed on : Thu Jan 6 08:02:25 2022 JST
Origin : x11-wm/spectrwm
Architecture : FreeBSD:12:amd64
Prefix : /usr/local
Categories : x11-wm
Licenses : ISCL
Maintainer : zeising@FreeBSD.org
WWW : https://github.com/conformal/spectrwm
Comment : Small, dynamic tiling window manager for X11
Options :
EXAMPLES : on
Shared Libs required:
libxcb-util.so.1
libX11-xcb.so.1
libX11.so.6
libXft.so.2
libXcursor.so.1
libxcb-icccm.so.4
libxcb-randr.so.0
libxcb.so.1
libxcb-xtest.so.0
libxcb-keysyms.so.1
libxcb-xinput.so.0
Annotations :
FreeBSD_version: 1202000
repo_type : binary
repository : FreeBSD
Flat size : 224KiB
Description :
Spectrwm (previously known as scrotwm) is a small dynamic tiling window
manager for X11. It tries to stay out of the way so that valuable screen
real estate can be used for much more important stuff. It has sane
defaults and does not require one to learn a language to do any
configuration. It was written by hackers for hackers and it strives to be
small, compact and fast.
It was largely inspired by xmonad and dwm. Both are fine products but suffer
from things like: crazy-unportable-language-syndrome, silly defaults,
asymmetrical window layout, "how hard can it be?" and good old NIH.
Nevertheless dwm was a phenomenal resource and many good ideas and code was
borrowed from it. On the other hand xmonad has great defaults, key bindings
and xinerama support but is crippled by not being written in C.
WWW: https://github.com/conformal/spectrwm
下記のインストール時とバージョンの違いはありません。
2020年 9月 4日「FreeBSD 11.4 RELEASE」へインストールしたとき
2020年11月18日「FreeBSD 12.2 RELEASE」へインストールしたとき
2021年 7月 5日「FreeBSD 13.0 RELEASE」へインストールしたとき
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. .desktop ファイルの作成
ログイン時に有効となるよう、「.desktop」ファイルを作成します。
「root」ユーザ権限で。
mkdir -pv /usr/local/share/xsessions
sh
cat << 'EOF' >> /usr/local/share/xsessions/spectrwm.desktop
[Desktop Entry]
Name=spectrwm
Comment=A lightweight window manager for the X Windowing System
Exec=spectrwm
Terminal=false
TryExec=spectrwm
Type=Application
EOF
exit
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
numlockx &
/usr/local/bin/VBoxClient-all
EOF
exit
chmod +x /usr/share/skel/dot.xsession
「EOF」の前の行は、「VirtualBox」の「Client」でのみの設定です。
既存のログインユーザで、まず、セッション開始の手順をスケルトンよりコピー。
cp /usr/share/skel/dot.xsession ~/.xsession
6. ログインマネージャ起動
前項までインストール・設定したものを有効にします。
「root」ユーザ権限で。
sysrc polkitd_enable=YES
sysrc dbus_enable=YES
sysrc sddm_enable=YES
起動します。
service dbus start
service sddm start
うまく設定できていれば、ログイン画面が表示されます。
ユーザ名・パスワードを入力してログインします。