• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How-to: light desktop setup; 2018 update

sidetone

Aspiring Daemon

Thanks: 221
Messages: 781

#1
Xinit and XDM login managers are covered. KDM, GDM, WDM and SLiM login managers are not described here.

Install
The following are sufficient to install the programs for a running Desktop system: x11/xorg, x11/xdm and your chosen window manager. If you're not using a graphical desktop login manager, xdm can be omitted.

Desktop login
Configuration files for Xinit and XDM are under the /usr/local/etc/X11/ and ~/ directories, respective to Xinit and XDM. The minimal configuration for .xsession or .xinit in your home directory is:
Code:
#!/bin/sh
exec /usr/local/bin/<windowmanager>
Console
Set .xinitrc in each home folder, to load custom settings from that user's command line. The default /usr/local/etc/xinit/xinitrc points to several other files in your home directory.

Make sure the owner file permissions of .xinitrc are at minimum set to read.
chmod 440 .xinitrc

Finally, type startx.

XDM
To configure x11/xdm to start up on boot, edit /etc/ttys and change the option on line ttyv8 from off to on:
Code:
ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   '''on''' secure
The secure option allows logging in to the root console without a password from single user mode.

Set up .xsession with owner and group permissions to read and execute. If you soft link .xsession and .xinitrc together, both permissions must be 550.
Code:
ln -s .xsession .xinitrc
chmod 550 .xsession
Under normal circumstances, /usr/local/etc/X11/xdm/Xsession should be left alone, because this file by default points to ~/.xsession and ~/.xsession-errors.

Customization
Customization files for XDM are located in /usr/local/etc/X11/xdm/.

The background image or color can be changed with a command argument in Xsetup_0. xsetroot can set the background to a color or bitmap image. To choose a common image type, use a program such as x11/bgs or graphics/feh from within Xsetup_0.

Example of Xsetup_0:
Code:
#!/bin/sh
bgs /home/mydirectory/mypicture.png &
#xconsole &
The reference to x11/xconsole, used for displaying terminal output, such as attached devices, can optionally be commented out.

It is important to add an & after adding new configuration commands, or the login screen will freeze up with certain commands.

To change the box logo, edit Xresources, comment out or reference another .xpm file in the lines xlogin*logoFileName.

Desktop programs
Read the documentation of your chosen window manager's configuration files to load desktop programs, if it is available. If your window manager doesn't have the ability to load desktop programs, use .xsession or .xinitrc, to start them. Background programs, such as x11/xrandr, should be loaded with .xsession or .xinitrc.

Example of .xsession or .xinitrc:
Code:
#!/bin/sh
xterm &
xclock &
exec jwm
Programs are loaded with &, and the window manager is loaded last with exec.

BSD Desktops
Thread BSD Window Managers; List.63710

Notes
Most of this is common information, but the updates are put into one spot.
Also at: http://freebsdwiki.net
 

sidetone

Aspiring Daemon

Thanks: 221
Messages: 781

#2
Driver and Hardware configuration
xorg.conf
Xorg is now mostly auto-configured. xorg.conf is replaced by the directory /usr/local/etc/X11/xorg.conf.d/ for specific configurations only. The syntax of a configuration filename in this directory is <customname>.conf.
Basic hardware
To enable the mouse and keyboard, considering that recent versions of xorg are set to use autodetection by default.

Add the following to /etc/rc.conf:
Code:
dbus_enable="YES"
For customizing mount options of devfs(8), use /etc/fstab:
Code:
devfs      /dev       devfs     rw   0 0
fdescfs    /dev/fd    fdescfs   rw   0 0
fdescfs(5) can alternatively be loaded through compiling in the kernel or through /boot/loader.conf.
GPU Drivers
For a list of FreeBSD supported video cards, https://wiki.freebsd.org/Graphics#Hardware_Support. Check the latest compatibility information before purchasing a graphics card. Different brands of video cards generally don't work well together.

The VESA driver works with sc(4). Graphics cards which use KMS (ATI and Intel) need the vt(4) driver. Most video drivers can be selected for installation by running make config from x11-drivers/xorg-drivers. To automate this, edit make.conf, and recompile x11-drivers/xorg-drivers. If another driver is specified and configured, removing the VESA driver is optional.
Code:
x11-drivers_xorg-drivers_UNSET=VESA
The argument to select specific driver for installation from x11-drivers/xorg-drivers is under the respective section below.

When you set these cards, permissions must be set to allow access for them through /etc/devfs.rules:
Code:
[localrules=10]
add path 'dri/*' mode 0666 group operator
Be sure this location is referenced through rc.conf:
Code:
devfs_system_ruleset="localrules"
Add your user to the video group, in /etc/group.

Do not load ATI, Intel or Nvidia cards by compiling their drivers into the kernel. ATI and Intel drivers are capable of auto-loading, but setting them in /etc/rc.conf will prevent them from falling back to the VESA driver for the console. Don't load ATI and Intel drivers through /boot/loader.conf.
ATI
Many ATI Radeon cards are compatible with FreeBSD. However, not all outputs or functions may work on partially supported video cards.

Radeon cards require the ATI setting in x11-drivers/xorg-drivers, and here is how to set it for installation through make.conf:
Code:
x11-drivers_xorg-drivers_SET=ATI
To configure the Radeon driver to load on boot-up, add the following to rc.conf:
Code:
kld_list="radeonkms"
The setting AMDGPU in x11-drivers/xorg-drivers for newer video drivers is not ready for FreeBSD 11.1 and previous versions. MACH64 and R128 are only required if you have those specific older models.

Experimental Radeon card support by graphics/drm-next-kmod in FreeBSD 12 (current), can be enabled by rc.conf:
Code:
kld_list="amdgpu"
# or
kld_list="/boot/modules/radeonkms.ko"
Intel
To set Intel cards for installation, use this argument in make.conf:
Code:
x11-drivers_xorg-drivers_SET=INTEL
To load an Intel graphics card on start up, insert into rc.conf:
Code:
kld_list="i915kms"
Broadwell, Skylake and Kabylake Intel cards are expected to be functional in FreeBSD 12 (current): as of now, they are represented in graphics/drm-next-kmod. If you're testing this driver on current, set an absolute path, instead of the default, in rc.conf to:
Code:
kld_list="/boot/modules/i915kms.ko"
Nvidia
The driver for older Nvidia cards can be set to install by using this argument in make.conf:
Code:
x11-drivers_xorg-drivers_SET=NV
Other Nvidia drivers are x11/nvidia-driver, x11/nvidia-driver-340 or x11/nvidia-driver-304. There are examples of these cards loaded through either /boot/loader.conf or /etc/rc.conf.

Some users set /etc/rc.conf to either of:
Code:
kld_list+="nvidia-modeset"
# or
kld_list+="nvidia"
Other users set /boot/loader.conf to:
Code:
linux_load="YES"
nvidia_load="YES"
nvidia-modeset_load="YES"
For more on configuring Nvidia cards, see Thread HOWTO: Setup Xorg with NVIDIA's driver.52311 by tobik@.
Notes
Relating to drivers for FreeBSD 12 (current), use the FreeBSD mailing list, https://lists.freebsd.org/mailman/listinfo/freebsd-current, or keep it on this thread. Thread Topics-about-unsupported-FreeBSD-versions.40469
 

sidetone

Aspiring Daemon

Thanks: 221
Messages: 781

#3
Multiple Monitors
Use the program x11/xrandr to be able to use and configure multiple monitors. With this program, a video card can use its supported HDMI, DVI and other outputs for multiple monitor displays.

Example that can be used from .xinitrc or .xsession:
Code:
xrandr --output DVI-0 --right-of HDMI-0
Edit: x11/arandr is another tool which has graphical interface for this. It can be used to get desired and complex settings for xrandr, as well.
 

dch

Member

Thanks: 33
Messages: 84

#4
Multiple Monitors
Use the program x11/xrandr to be able to use and configure multiple monitors. With this program, a video card can use its supported HDMI, DVI and other outputs for multiple monitor displays.

Example that can be used from .xinitrc:
Code:
xrandr --output DVI-0 --right-of HDMI-0
I would have loved to see this in the handbook 2 years ago, it drove me mad trying to find out how to do that. Also, x11/lumina-coreutils contains lumina-xconfig which allows doing this visually. Super handy for that last-minute panic when getting a presentation ready to share on dual screen / projector.
 

sidetone

Aspiring Daemon

Thanks: 221
Messages: 781

#6
I would have loved to see this in the handbook 2 years ago, it drove me mad trying to find out how to do that. Also, x11/lumina-coreutils contains lumina-xconfig which allows doing this visually. Super handy for that last-minute panic when getting a presentation ready to share on dual screen / projector.
I used Arch Linux documentation and manpages to find out how to set xrandr(1). Then I've written this elsewhere, http://freebsdwiki.net/index.php/Hardware_Configuration,_Audio/Video#Multiple_Monitors
So, any output supported by the driver, can run multiple video outputs from one card. I've run 3 different outputs off of 1 card before: HDMI, DVI and VGA. I only tested VGA to see if it worked, the resolution is poor compared to the others.

Xrandr will also let you display different monitors as lanscape or portrait.