1 minute, 13 seconds
How to Automatically Start XFCE4 Session After Login to Local Console in FreeBSD

Desktop environments on FreeBSD are usually started by some kind of display manager, such as GDM or KDM. This is specially true for "heavy" desktops such as GNOME or KDE, which are almost impossible to run without one. On the other side, "lighter" desktops such as Xfce run just fine without a display manager. Steps to start Xfce without login manager are described in FreeBSD Handbook, but they require user to log in and start X server manually. The following article describes how to start Xfce automatically immediately after user logs onto local console.

Assuming x11/xorg and x11-wm/xfce4 are already installed, and user's login shell is set to tcsh, one needs to copy .cshrc to .tcshrc, and append a few lines to it so it looks as follows:

# start xfce when login on ttyv1
if ($tty == ttyv1) then
     /usr/local/bin/startxfce4 --with-ck-launch
     logout
endif

Above can be done by typing comands below as user:

echo '' >> ~/.tcshrc
echo '# start xfce when login on ttyv1' >> ~/.tcshrc
echo 'if ($tty == ttyv1) then' >> ~/.tcshrc
echo ' /usr/local/bin/startxfce4 --with-ck-launch' >> ~/.tcshrc
echo ' logout' >> ~/.tcshrc
echo 'endif' >> ~/.tcshrc

In order to start Xfce automatically we need to login on ttyv1, to which we switch by pressing Ctrl + Alt + F2.

For some setups it is useful to combine above setup with automatic login into local console, which will eliminate the need to enter any credentials in order to get Xfce desktop environment.