herbstluftwm - FreeBSD 12.4 - 環境構築

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

1. 概要

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

 ここまでの時点で、システムインストールと「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 herbstluftwm bash
 「herbstluftwm」は、「bash」がないと動きません。  インストール時のメッセージに書いてあります。

Message from herbstluftwm-0.9.4:

--
You need to specify your own autostart file with -c or place it in this path:
/usr/local/etc/xdg/etc/xdg/herbstluftwm/autostart

Keep in mind that most of the scripts are written in bash syntax.
 2022年12月26日の時点で、下記のバージョンでした。

$ pkg info herbstluftwm
herbstluftwm-0.9.4
Name           : herbstluftwm
Version        : 0.9.4
Installed on   : Mon Dec 26 15:40:10 2022 JST
Origin         : x11-wm/herbstluftwm
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : x11-wm
Licenses       : BSD2CLAUSE
Maintainer     : uzsolt@uzsolt.hu
WWW            : https://herbstluftwm.org/
Comment        : Manual tiling window manager for X11
Options        :
        DOCS           : on
        EXAMPLES       : on
Shared Libs required:
        libfreetype.so.6
        libXrender.so.1
        libXrandr.so.2
        libXinerama.so.1
        libXft.so.2
        libXfixes.so.3
        libXext.so.6
        libX11.so.6
Annotations    :
        FreeBSD_version: 1203000
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 1.98MiB
Description    :
herbstluftwm is a manual tiling window manager for X11 using Xlib and Glib.
Its main features can be described with:

  - The layout is based on splitting frames into subframes which can be
    split again or can be filled with windows (similar to i3 or musca)

  - Tags (or workspaces, or virtual desktops) can be added/removed at
    runtime.  Each tag contains an own layout

  - Exactly one tag is viewed on each monitor.  The tags are monitor
    independent (similar to xmonad)

  - It is configured at runtime via IPC calls from herbstclient.  So the
    configuration file is just a script which is run on startup.  (Similar
    to wmii or musca)

WWW: https://herbstluftwm.org/
 2020年9月4日「FreeBSD 11.4 RELEASE」へのインストール時、2020年11月17日「FreeBSD 12.2 RELEASE」へのインストール時が「0.8.3」でした。  2021年6月29日「FreeBSD 13.0 RELEASE」へのインストール時、2021年12月24日「FreeBSD 12.3 RELEASE」へのインストール時が「0.9.2」でした。

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 ファイルの作成

 他のタイル型デスクトップと異なり、「herbstluftwm」は、インストール時点で

/usr/local/share/xsessions/herbstluftwm.desktop
 が作成されていますので、「.desktop」を作成する必要はありません。

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
exit
 キーボードレイアウト、Num Lock キー有効化、「VirtualBox Guest Additions」の起動を設定。

sh
cat << 'EOF' >> /usr/share/skel/dot.xsession
#!/bin/sh
#
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
 ログインユーザ用の起動時のスクリプトをシステムファイルからコピーします。  ログインユーザで。

mkdir -pv ~/.config/herbstluftwm/
cp /usr/local/etc/xdg/herbstluftwm/* ~/.config/herbstluftwm/.

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

 前項までインストール・設定したものを有効にします。  「root」ユーザ権限で。

sysrc dbus_enable=YES
sysrc sddm_enable=YES
 起動します。

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

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