Xfce

Xfce is a lightweight desktop environment for UNIX-like operating systems. It aims to be fast and low on system resources, while still being visually appealing and user friendly.
Prerequisites
- Internet connectivity, unless the packages have been pre-fetched into a local cache.
- A non-root user account.
- The community repository must be enabled.
- Set up eudev.
- Install and configure D-Bus. without D-Bus icons and keyboard shortcuts may be missing.
- Install appropriate Graphics driver drivers for your hardware. Without graphics drivers, errors are likely to occur.
- Install Xorg
Installation using setup-desktop
The Alpine Linux script for quickly setting up a desktop is:
# setup-desktop
On running the above command, you will be prompted to select a desktop environment.
Which desktop environment? ('gnome', 'plasma', 'xfce', 'mate', 'sway', 'lxqt' or 'none') [none]
Once you have chosen a desktop environment, this script installs the chosen desktop along with necessary packages, firefox browser and adds necessary services to run on startup. You can reboot when complete, and the system will boot into a graphical login screen with the chosen desktop environment. To view the packages installed by the script: $ cat /usr/sbin/setup-desktop
When xfce is chosen, the script additionally installs lightdm as display manager and most of the steps listed below in the Manual installation are completed.
Manual installation
Typical minimal package selection to install:
# apk add xfce4 xfce4-terminal xfce4-screensaver lightdm-gtk-greeter font-dejavu
lightdm-gtk-greeter package may be omitted if Xfce should only be started from command line. The above packages provide a minimal working Xfce. Refer Configuration section for more.
Starting Xfce
With a display manager (graphical login)
If the package lightdm-gtk-greeter
has been installed per the instructions above, the lightdm display manager may be started to log in graphically with your new user.
# rc-service lightdm start
After correct operation is verified, lightdm can be enabled to start up during boot:
# rc-update add lightdm
From the command line
Xfce may be started with:
$ startx
If you want to start it via another script or mechanism like xinit
, use startxfce4
. e.g. call it via exec startxfce4
at the end of the ~/.xinitrc configuration file.
Configuration
Themes and icons

It is necessary to add some theme files, to get a proper (themed) appearance. By default, there is no theme and Adwaita
icon in Settings -> Appearance, but Adwaita
is missing some icons for XFCE.
Install adw-gtk3 package for basic themes and adwaita-xfce-icon-theme package for basic icons.
# apk add adwaita-xfce-icon-theme adw-gtk3

Allowing shut down and reboot
To enable users to shut down the machine or reboot, the packages elogind and polkit-elogind need to be installed.
# apk add elogind polkit-elogind
A reboot is required to let it take effect.
# lbu commit # if running in diskless mode, to save state $ reboot
Enabling privilege escalation GUI
To enable the privilege escalation GUI for a doas/sudo user, you need to install elogind,polkit-elogind, xfce-polkit, and lightdm packages as follows:
# apk add elogind polkit-elogind xfce-polkit lightdm
Note that elogind and lightdm must be running before logging into the XFCE desktop, otherwise you will see an empty error dialogue box at login.

To make elogind/lightdm running, either make them start automatically at system start:
# rc-update add elogind
or start them manually for this time only:
# rc-service elogind start
Change elogind for lightdm and run the above two commands for lightdm.
Now, make sure in Settings -> Session and Startup -> Application Autostart, "XFCE PolKit" exists and checked. If it is not found, navigate to /etc/xdg/autostart and check if xfce-polkit.desktop exists and its size is not 0. If everything above has been done, when you type admin://
in the address bar, you will see the password dialogue.

Auto-mounting USB drives
To enable automatic mounting of USB drives, install these packages:
# apk add gvfs udisks2
Depending on what devices you intend to mount, some additional packages may be needed:
# apk add \ ntfs-3g \ # Stable, full-featured, read-write NTFS (driver) gvfs-cdda \ # CDDA support for gvfs gvfs-afp \ # AFP support for gvfs gvfs-goa \ # GNOME Online Accounts support for gvfs gvfs-mtp \ # MTP support for gvfs gvfs-smb \ # Windows fileshare support for gvfs gvfs-lang \ # Languages for package gvfs gvfs-afc \ # Apple mobile devices support for gvfs gvfs-nfs \ # NFS support for gvfs gvfs-dev \ # Backends for the gio framework in GLib (development files) gvfs-archive \ # Archiving support for gvfs gvfs-dav \ # WebDAV support for gvfs gvfs-fuse \ # FUSE support for gvfs gvfs-gphoto2 \ # gphoto2 support for gvfs gvfs-avahi \ # DNS-SD support for gvfs
To list descriptions of all gvfs- packages:
$ apk info -d gvfs-*
Make sure that mounting is enabled in Thunar>Edit>Preferences>Advanced>Volume Management>Configure>Storage>Removable Storage
Network browsing
For browsing of network shares within XFCE that works seamlessly with file associations, you can install the gvfs packages for the network protocols you use.
For example, to browse in a SMB/cifs windows network:
# apk add gvfs-smb
The OpenRC script for fuse is in a separate package.
# apk add fuse-openrc
Then the fuse service can be started manually.
# rc-service fuse start
The XFCE sessions already in progress need to be restarted for this to take effect, i.e. log out and log in again.
If it works, the fuse service can be added to start up automatically at boot time:
# rc-update add fuse
Localized keyboard layout
Settings->Keyboard->Layout->"Keyboard layout" seems to get activated only after once temporarily switching on the "Use system defaults" button, logging out and in again, and then turning it off.
Troubleshooting
Startup
If the Xorg server segfaults in kvm/qemu then add nomodeset as a boot option.
If the mouse / keyboard is not responding, you can try disabling hotplug.
Section "ServerFlags" Option "AutoAddDevices" "False" EndSection
Login
If you are unable to login, check /var/log/lightdm/lightdm.log, there may be output there from X to indicate failed modules, etc.
If you are unable to login, or you see an error "Failed to execute login command", you should check ~/.xinitrc (if you're using .xinitrc) with your preferred text editor (vi, nano, etc) and ensure that it is set to load xfce. To do this, the 'exec' line (usually the last line in the file) should read exec startxfce4
. If ~/.xinitrc does not exist, create it and add the exec line. this command will do it:
$ echo "exec startxfce4" >> ~/.xinitrc
Permission denied when using Thunar

GUI application that needs root access fails with a message "permission denied". Refer Enabling privilege escalation GUI section.
Session
If the panel and windows disappear or start flickering after logging in to xfce the first time, log out, and then log in again. That happens because xfce is writing a default config file with the compositor enabled, but does not enable it during your first login. Clear out the ~/.config/xfce directory, and login as "first time" again, as the default vblank setting for the compositor is likely incorrect. Open the windows manager tweaks and dconf editor (or use dconf-query) before you log out. Tick the compositor to off in the window manager tweaks ui. If you have a recent enough xfce (4.14) there is a ui in window manager tweaks to set syncing mode, and you can try different values, such as vblank, xpresent, and glx, while turning the compositor on and off, until you find one that works. Or, from dconf editor, you can set xfwm4 /general/vblank_mode, which you will find is set to "auto" by default, and then turn the compositor on again. This can also be accomplished from the command line using using:
$ xfconf-query -c xfwm4 -p /general/vblank_mode -s mode
where mode is vblank, glx or xpresent.
You have to use xfconf-query from within the xfce terminal session, or at least with the xfce settings daemon started.
Rootless Xorg
Refer #16220. As per Arch wiki, lightdm do not support rootless Xorg. So you may need to have the following file created.
Contents of /etc/X11/Xwrapper.config
Missing Fonts
If you face black screen when invoking startx, Refer #16220. Try to install a font by issuing the command:
# apk add font-dejavu