OpenBSD: Xfce4

Article published the ; modified the
5 minute(s) to read

This article has 918 words.
RAW source of the article: MD

Description

Xfce4 is a Desktop Environnement, available on OpenBSD.

⇒ Environnement:

  • OpenBSD: 6.6 → 6.9
  • Xfce4: 4.14 → 4.16

In this tutorial, I assume that OpenBSD has just been freshly installed, and that everything has to be done.

Installation

Usual: # pkg_add xfce xfce-extras

Some dependancies are installed, like dbus.

Additionnal packages

By default, some packages are not installed.

  • xfce4-icon-theme: additional icons pack
  • xfce4-power-manager: power management for laptop
  • xfce4-pulseaudio: plugin for the pulseaudio sound system - but, it’s not necessary… OSS works great!
  • xfce4-xkb : switch between layers keyboard languages - but, is-it really useful, when using the command setxkbmap, or even just kbd, followed with the language code… is enough‽

Configuration

Since Xfce4 4.14, available on OpenBSD 6.6, it’s a bit easier to configure simplu your personal environment system.

In a first step, I talk about a basic functional configuration; and, I’ll add information to improve your comfort.

.xsession

The first file to create is: ~/.xsession.

Add:

exec xfce4-session

user profile

You’ve to add your user to both system groups:

  • operator which allows to use the shutdown and restart features.
  • wheel which authorizes to use the sleep and hibernate features, if they’re available on your system.

With rights admins:

# usermod -G operator,wheel user

(change ‘user’ by your id user, of course…)

apmd

To use the sleep and hibernate functions, apmd need to be set. We set on automatic performance adjustement mode.

# rcctl enable apmd
# rcctl set apmd flags -A
# rcctl start apmd

Voila!

It’s enough to run correctly Xfce4. Think to restart your session or the machine.


Now, let’s go a little further in the configuration, like setting the French language, or yours, and others useful tips.

.profile

Start setting your personal file: ~/.profile

to add the following mentions:

EDITOR=vi	# or nano, emacs, vim
ENV=$HOME/.kshrc
LC_MESSAGES=fr	# or fr_FR.UTF8; it's egual!

export EDITOR ENV LC_MESSAGES

⇒ Explains:

  • I love nano as editor; into the base, vi is installed. The others need to be installed.

  • We declare a personal ENVironment; here, the pdksh.

  • Finally, define the language, as french.

And we export the three variables.

Of course, it’s possible to configure any environment variable, like PS1:

export PS1="[\t] \e[0;35m:\u@\h: \e[0;32m\w \e[0;36m\$ \e[m"


Here an complete instance:

# $OpenBSD: dot.profile,v 1.7 2020/01/24 02:09:51 okan Exp $
#
# sh/ksh initialization

PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
export PATH HOME TERM

EDITOR=nano
ENV=$HOME/.kshrc
LC_MESSAGES=fr

export EDITOR ENV LC_MESSAGES

Concerning the ENV variable, we’ve declared a personal file ~/.kshrc. By default, it doesnot exist; you have to create it with your favorite editor.


You need to change your personal file ~/.xsession to add your environment profile:

. $HOME/.profile

exec xfce4-session

Thus your graphic session will take account differents settings of your profile, such as language.

.kshrc

The content of this personal file is not complicated. Here is what to add to be functional:

. /etc/ksh.kshrc
. $HOME/.profile

HISTCONTROL=ignoredumps
HISTFILE=$HOME/.mksh_hist
HISTSIZE=10000
PAGER=less

export PAGER

⇒ Useful explains:

  • We source the global initialization for ksh to obtain a correct environment shell.

  • We source your personal profil file.

  • HIST variables are usefull to historize the orders commands:

    • HISTFILE: to define the backup file history
    • HISTSIZE: the number of commands to remember; do not confuse with the number of lines into file, defined with HISTFILESIZE - not here.
    • it’s not necessary to export them.

dbus

dbus is installed as dependancy.

The changes below are not essential, although useful. They’re reported on the relative pkg-readme file.

Add into your personal file ./.xsession:

if [ -x /usr/local/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
	eval `dbus-launch --sh-syntax --exit-with-x11`
fi

The file will look like this:

. $HOME/.profile

if [ -x /usr/local/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
	eval `dbus-launch --sh-syntax --exit-with-x11`
fi

exec xfce4-session

Egual, pkg-readme upower informs us that it’s useful to run the apmd and messagebus services, so the power management system works; let’s go to enable the latter:

# rcctl enable messagebus
# rcctl start messagebus

⇒ if your machine is a laptop, think to install xfce4-powermanager package, which is not provided by default.

Printing

To print, install Cups:

# pkg_add  cups cups-filters cups-libs foomatic-db gutenprint 

Start both services cupsd, and cups_browsedthis second is useful to detect printers on network using Bonjour broadcast messages.

# rcctl enable cupsd cups_browsed
# rcctl start cups cups_browsed

You can administrate by the webui of Cups, available on http://localhost:631, or by tools as cupsctl, lpadmin.


Since OpenBSD 6.2, binaries lpq, lpr, and lprm need to be symbolics links to run smoothly.

Edit again your personal file ~/.kshrc to add:

for i in lpq lpr lprm; do alias $i=/usr/local/bin/$i; done 

Avahi

Avahi is, on OpenBSD, the DNS multicast discovery service.

Just install the avahi package, and after active and start the services:

# rcctl enable multicast avahi_daemon
# rcctl order messagebus avahi_daemon
# rcctl start avahi_daemon

Normally, messagebus is already started!

Tips

PF

I’ve not discuted about firewall rules, but here is an example:

⇒ Cups :

pass in on egress proto tcp from egress:network to egress port 631 flags S/SA modulate state

⇒ Avahi :

pass proto udp from any to 224.0.0.251 port mdns allow-opts
pass inet6 proto udp from any to ff02::fb port mdns allow-opts 

pass proto udp from any to 239.255.255.250 port ssdp allow-opts
pass inet6 proto udp from any to { ff02::c, ff05::c, ff08::c } port ssdp allow-opts 

Of course, it’s up to you!

Voila

Think to restart your session, after modifying yours personals files.

After, you can install others packages…


Voila!

Documentations

  • the differents pkg-readme files:
    • /usr/local/share/doc/pkg-readmes/xfce
    • /usr/local/share/doc/pkg-readmes/dbus
    • /usr/local/share/doc/pkg-readmes/upower