From Gentoo Wiki
Xfce(Redirected from Xfce/HOWTO)
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
Deutsch • ‎English • ‎日本語 • ‎한국어 • ‎русский • ‎中文(中国大陆)‎

This guide provides an extensive introduction to Xfce, a fast, lightweight, full-featured desktop environment.


The Xfce desktop environment

Xfce is a fast, lightweight desktop environment for Unix-like operating systems. It is designed for productivity, and is quite configurable while still adhering to the Freedesktop specifications.

Unlike heavier desktop environments, such as Gnome and KDE, Xfce uses far fewer system resources. Additionally, it offers greater modularity and fewer dependencies; it takes up less space on your hard disk and takes less time to install.

This guide will not only show you how to install and configure a minimal Xfce environment, but will also explore options to create a full-featured desktop in keeping with the Xfce philosophy: light, fast, and modular.

The last part of this guide lists a few commands to run after upgrading to a new Xfce release, so be sure to follow them if you are upgrading from an older version.


The basics

First make sure Xorg has been configured as instructed in the Xorg Guide. If these steps have not been completed the rest of this guide will not apply as expected.

Next, double-check the USE flags in /etc/portage/make.conf; most users will want to set the following:

FILE /etc/portage/make.confCommon USE flags settings for Xfce
USE="-gnome -kde -minimal -qt4 dbus jpeg lock session startup-notification thunar udev X"


Now that the USE variables have been set in /etc/portage/make.conf, it is time to install Xfce.

root #emerge --ask xfce-base/xfce4-meta

If desired add regular user(s) to the cdrom, cdrw, and usb groups, so that they can mount and use devices such as cameras, optical drives, and USB sticks.

root #for x in cdrom cdrw usb ; do gpasswd -a username $x ; done

Update the system's environment variables:

root #env-update && source /etc/profile

A graphical terminal will be needed to continue working in the new desktop environment. The x11-terms/xfce4-terminal package is a good choice; it is made specifically for Xfce. Install Terminal as shown:

root #emerge --ask x11-terms/xfce4-terminal


Starting Xfce

Now that Xfce is now installed, we'll configure it to be the default desktop environment when we issue the startx command. Exit your root shell and log on as a regular user.

user $echo "exec startxfce4" > ~/.xinitrc
If you have ConsoleKit installed, your ~/.xinitrc should instead contain exec startxfce4 --with-ck-launch. Otherwise, some of your applications may stop working. You'll also need to add consolekit to the default runlevel by running the following command as root: rc-update add consolekit default.

Now start your graphical environment by typing startx:

user $startx

Congratulations, and welcome to your new Xfce desktop environment. Go ahead, explore it a bit. Then continue reading to learn how you can configure Xfce to suit your needs.

Sessions and startup

If you've installed (or plan to install) popular Gnome or KDE applications such as k3b, nautilus, kmail, evolution, etc. then you should make sure that Xfce launches the appropriate services for these at startup. Navigate to Menu --> Settings --> Sessions & Startup. On the Advanced tab, select the appropriate checkbox. This might slightly increase Xfce startup times, but it decreases load times for KDE and Gnome applications.

Xfce has the ability to save your session settings and running programs from the General tab in the Sessions & Startup menu. They can be automatically saved when you logout, or Xfce can ask you each time. This feature is particularly useful for undoing configuration mistakes. Accidentally killed a panel? Just select "No" when prompted to save your current session, and the next time you start Xfce, your old desktop is restored. Want to automatically launch your open web browser, terminal, and email client the next time you login? Just save your session before logging out.

You've now got a basic working environment installed and configured. But if you're interested in doing more, then continue reading!

Additional applications

Every user should consider installing some or all of the following useful applications and utilities:

root #emerge --ask xfce-extra/xfce4-mixer xfce-extra/xfce4-taskmanager x11-themes/xfwm4-themes app-office/orage app-editors/mousepad xfce-extra/xfce4-power-manager x11-terms/xfce4-terminal xfce-base/thunar
Package Description
xfce-extra/xfce4-mixer A volume control for your sound card. It can also be run as a panel applet, giving you fast access to playback volume. xfce-extra/xfce4-taskmanager displays a list of all running programs, and the CPU and memory consumption each one takes up. By right-clicking an item, you can kill a misbehaving application, pause and restart it, or even alter its run time priority, which lets you fine-tune how much of a demand it puts on your system's resources.
x11-themes/xfwm4-themes Adds several window manager themes. You may want to add a more full-coverage icon theme such as x11-themes/tango-icon-theme just to round out your desktop.
app-office/orage A simple, handy calendar. app-editors/mousepad is a bare bones text editor that starts up extremely quickly.
xfce-extra/xfce4-power-manager An application to monitor and manage power usage. This is especially important for laptops! The power manager allows user to adjust screen brightness, choose maximum performance or battery-saving modes, and setup hibernate, suspend, and shutdown actions when the lid is shut or buttons are pressed. xfce4-power-manager can be set to provide warning when the battery reaches certain levels, or even turn off the machine. The application comes with a couple of helpful panel plugins to display battery/charging status, and a brightness control.
x11-terms/xfce4-terminal An X11 terminal emulator, far more configurable and useful than the barebonesxterm. xfce4-terminal supports Unicode text, color schemes, pseudo-transparency and hardware-accelerated transparency via Xfce's built-in compositor, all out-of-the-box. Just make sure that the default action on the terminal launcher of your panel runs /usr/bin/Terminal instead of xterm. Right-click the launcher and choose Properties to change the command.
xfce-base/thunar Xfce's default graphical file manager. It is fast yet quite powerful, can support several plugins for even more functionality; just install them with emerge. These plugins include: xfce-extra/thunar-archive-plugin which lets users create and extract archive files using the right-click menu. It provides a handy front-end for graphical archiving applications such as xarchiver and file-roller.
xfce-extra/tumbler Lets users preview certain types of files from within Thunar, such as images and fonts.
xfce-extra/thunar-volman Automatically manages removable media and drives.

Desktop applications

Next, let's see about adding some useful but lightweight desktop applications, staying with Xfce's philosophy.

Though app-editors/mousepad is nice enough as a basic text editor, if you need a full-featured word processor but don't want the bloat of LibreOffice, try emerging app-office/abiword. AbiWord is lighter, faster, and is completely inter-operable with industry-standard document types.

Need a nice email client/newsreader that is not as demanding as mail-client/thunderbird or mail-client/evolution? Try emerging mail-client/claws-mail.

For your internet chat needs, net-irc/irssi is an excellent, tiny, incredibly configurable IRC client that runs in your terminal. If you prefer a compact all-in-one client that handles nearly all chat protocols, you may want to emerge net-im/pidgin.

If you need movie and music players, look no further than media-video/mplayer and media-sound/exaile. They can play most every media format available quite nicely.

Finally, you'll need a web browser. Nearly all graphical web browsers require more resources than most of your other desktop applications. Still, Firefox and Medori are always good choices. Alternatively, you may find Opera to be quite fast. However, Opera is not available on as many processor architectures as Firefox, and it has more dependencies unless you override them with a few USE flags.

root #emerge --ask www-client/firefox
root #emerge --ask www-client/midori
root #echo "www-client/opera gtk -kde" >> /etc/portage/package.use
root #emerge --ask www-client/opera

Now that we've explored some good suggestions for rounding out your desktop applications, let's see what else we can do to enhance your Xfce experience.

Panel plugins

In this chapter, we'll discuss some useful plugins and applications for everyday use within Xfce.

There are many plugins for the panel available in Portage; see for yourself with emerge --search xfce. Though for the most part their names are self-explanatory, a few deserve extra attention, as they are quite helpful. To use them, simply emerge them. They'll be added to the list of available items in the Add New Items menu shown when you right-click on the panel.

Package Description
xfce-extra/xfce4-battery-plugin Perfect for laptop users. It displays battery percentage, time remaining, power source (AC or battery), fan status, warnings, and can even be configured to execute commands at certain power levels. This feature can be used to put the laptop into hibernate mode when the battery is almost exhausted.
xfce-extra/xfce4-verve-plugin A small command line embedded into the panel. It is quicker than opening up a terminal to run a command.
xfce-extra/xfce4-mount-plugin Provides a handy method of mounting devices listed in /etc/fstab just by clicking the mouse.
xfce-extra/xfce4-sensors-plugin Lets users monitor hardware sensors, such as CPU temperature, fan RPM, hard drive temp, motherboard voltage, and more.

Graphical login

Remember when the startxfce4 line was added to the ~/.xinitrc file? All you have to do to get into your desktop is type startx after logging in. This is fine if you prefer a completely text-based boot and login, but let's use a display manager that will automatically start Xfce after booting (so that you can login graphically).

First, let's make sure Xfce loads at boot:

root #rc-update add xdm default

We aren't quite finished yet. We have to pick a display manager and set the appropriate variable. Though there are a few choices available in Portage, for this guide, we'll stick with SLiM, the Simple Login Manager.

x11-misc/slim is speedy and lightweight, with minimal dependencies. Perfect for Xfce!

root #emerge --ask x11-misc/slim
The branding USE flag will pull in the x11-themes/slim-themes package, which will give you an assortment of login themes, including a Gentoo Linux theme.

Then edit the DISPLAYMANAGER variable in /etc/conf.d/xdm:

FILE /etc/conf.d/xdm

SLiM can automatically start your Xfce session if you add XSESSION="Xfce4" to /etc/env.d/90xsession:

root #echo XSESSION=\"Xfce4\" > /etc/env.d/90xsession
root #env-update && source /etc/profile

Beautifying the desktop

A little customization of the desktop's appearance can go a long way. Xfce has all the options one would expect from a modern desktop environment, font anti-aliasing settings, color schemes, dozens of window decorations, themes, and more. If these are not enough, it is easy to install third-party themes, icon sets, mouse cursor themes, and wallpapers.

A selection of nice Gentoo wallpapers in a variety of resolutions are hosted on the Gentoo website. When looking for icon sets and complete Xfce themes, Xfce-Look has a huge collection. The important thing to remember about any third-party eye candy is that it will usually need to be unpacked and then installed to the proper directory. Icon sets go in /usr/share/icons/, and themes go to /usr/share/themes/; use these directories for all users to be able to access themes and icon sets. Individual users can install themes and icon sets to their home directories in ~/.themes/ and ~/.icons/.

If SLiM has been installed as the display manager, there are lots of themes in the x11-themes/slim-themes package available in the main Gentoo repository. Also, be sure to check the SLiM themes page for more themes. Creating your own SLiM theme is fairly easy; just read the Themes HowTo.

Finally, Xfce has its own built-in compositor to manage window transparency. This option can be found in Menu --> Settings --> Window Manager. For best performance, you will need to be running a graphics card with drivers that support hardware-accelerated rendering. Make sure the xfce-base/xfwm4 package has been emerged with the xcomposite USE flag, then enable compositing in /etc/X11/xorg.conf by adding the following section:

FILE xorg.confEnabling composite
Section "Extensions"
    Option  "Composite"  "Enable"

This is the bare minimum configuration required for Xfce and Xorg-X11. However, setting up hardware-accelerated rendering depends on the system's graphics card, and is beyond the scope of this guide. Please see the other guides in the Desktop resources to learn about configuring hardware-accelerated rendering for various graphic cards.

Once finished setting up a beautiful Xfce desktop, the next thing to do is take a screenshot of it to share with other folks! Install xfce-extra/xfce4-screenshooter and post the pictures somewhere for all to admire.


Congratulations on making it this far! You've installed and configured a speedy desktop environment with a solid suite of applications for your computing needs.


When upgrading Xfce from earlier major versions (4.x), the old cached sessions and profiles will need to be removed; they are incompatible with new releases. For each user, run the following commands to remove the old incompatible cached sessions and profile:

root #rm -r ~/.cache/sessions
root #rm -r ~/.config/xfce*
root #rm -r ~/.config/Thunar

Users will be greeted with a new and shiny interface, but will lose many of their individual settings. Sadly, no migration of configuration(s) exist...

External resources

Need additional help on configuring and using Xfce? Need more lightweight application suggestions? Try checking out:

  • The Gentoo forums
  • The installed help files and other documentation provided by Xfce: /usr/share/xfce4/doc/C/index.html. Just point your browser at it and start reading. There are even a lot of "hidden" configuration options detailed in the help files.

This article is based on a document formerly found on our main website gentoo.org.
The following people have contributed to the original document: nightmorph
They are listed here as the Wiki history does not provide for any attribution. If you edit the Wiki article, please do not add yourself here; your contributions are recorded on the history page.