LXDE

From Gentoo Wiki
(Redirected from Project:LXDE/HOWTO)
Jump to: navigation, search

Not to be confused with LXD.

This article is a stub. You can help by expanding it.

This guide introduces the user to LXDE (the Lightweight X11 Desktop Environment), explains its components, and leads the user through the installation.

Concepts

What is LXDE?

After installing a base Gentoo system, and the X server, there are many choices to consider regarding which graphical environment will be best to use. There are many options available, ranging from minimalistic window managers like Openbox, to full-featured desktop environments like KDE, and GNOME.

Some users might like having a lightweight graphical environment, but do not wish to install and configure every component individually like with Openbox. For quite some time users in this position would install Xfce because it fit the description of a lightweight environment and came with a suite of lightweight applications. While Xfce provides a full-featured environment without the extensive resource usage of KDE or GNOME, it has the potential to lean towards the heavy side. At last an alternative to Xfce has been created: the Lightweight X11 Desktop Environment, or LXDE for short.

Users however who dislike all those dependencies (dbus, polkit, consolekit, ...) inevitably pulled in by lxsession should have a look at Lumina.

Components of LXDE

LXDE, being a desktop environment, is comprised of several components. Each program offers a certain functionality; together they form a complete desktop environment. Currently there are eleven core components and several other programs necessary to make a complete LXDE installation. These programs are the ones pulled in by the lxde-base/lxde-meta package, discussed in the following installation section.

Core components
Other applications used by LXDE
Additional applications LXDE can use

Installation

After the X server has been emerged and configured, LXDE is ready to be installed. While each component can be installed individually, the more efficient and typically preferred method is to emerge the meta package set:

root #emerge --ask lxde-base/lxde-meta

Upon review of the emerge command's output (if the current set of USE flags looks good, etc.) enter "yes" when prompted to emerge the packages. Just like with other desktop environments, the X Server must be told to load LXDE automatically. This is done by adding it to user's ~/.xinitrc file.

user $echo "exec startlxde" >> ~/.xinitrc

This will automatically start a LXDE session when the startx command is typed at the console.

Note
If a login manager such as SLiM, XDM, GDM, or KDM is used then editing the ~/.xinitrc file is not needed. LXDE will show up as a choice on the login manager's screen.
Important
As each user has their own .xinitrc file. Make sure to properly modify the file for each user for a correct setup. This process involves using the su command to change to each user's account or another safe method. Using the root account for modifying .xinitrc files is generally not a good idea.

Configuration

GTK icon warning

Now that the X server knows to start LXDE type in startx to fire up LXDE. The first thing that may appear is a warning about an improper GTK icon set. To fix this minor hangup change the icon theme. Click on the LXDE application menu (in the lower left-hand corner of the panel), and navigate to Preferences --> Appearance. In the LXappearance menu, click on the Icon tab, and choose nuoveXT.2.2. Click Apply and then click Close. The next time a user logs in to LXDE the error message will not appear. Users are not limited to using the nuoveXT.2.2 icon theme. They may install any other icon theme through LXappearance. When other icon themes are selected the GTK icon warning will no longer appear when starting PCManFM.

Right-click menu

In LXDE, not every appearance option is handled through LXappearance as one might believe. Rather, there are some common options that are handled through a right-click menu on the desktop. At the bottom of that menu is the "Desktop Settings" menu. Here users can find icon sizes, single-click and double-click behavior, maximum thumbnail size, and desktop wallpaper settings. It may behoove one to look through the these tabs for additional appearance settings. It can be quite confusing.

Note
These "Desktop Settings" can also be found by opening up the PCManFM file manager, and navigating to Edit --> Preferences

Taking screenshots with xwd

There are many ways to take screenshots in LXDE, but all methods require some work in order for them to operate as desired. The solution below uses xwd to capture screenshots, imagemagick convert to save them to png, and notify-send to send a notification to desktop.

See x11-apps/xwd, media-gfx/imagemagick, xfce-extra/xfce4-notifyd.

It will place the screenshots in $HOME/screenshots/

First create key bindings:

FILE ~/.config/openbox/lxde-rc.xml
...
</keyboard>
  ...
  <keybind key="Print">
    <action name="Execute">
      <command>/usr/local/bin/screenshot.sh</command>
    </action>
  </keybind>
  <keybind key="A-Print">
    <action name="Execute">
      <command>/usr/local/bin/screenshot.sh window</command>
    </action>
  </keybind>
  ...
</keyboard>
...

Then create and make executable the following simple script:

FILE /usr/local/bin/screenshot.sh
#!/bin/bash
  
FOLDER="$HOME/screenshots/"
  
if [ ! -d "${FOLDER}" ]; then
  mkdir ${FOLDER}
fi
  
DATE=$(date +%Y-%m-%d@%H.%M.%S)
FNAME="${FOLDER}screenshot-${DATE}.png"
C=0
while [ -f "${FNAME}" ] ; do
    FNAME="${FOLDER}screenshot-${DATE}.${C}.png"
    let C++
done
  
touch ${FNAME}
  
if [ "$1" != "window" ]; then
  if xwd -root | convert - "${FNAME}"; then
    notify-send "Desktop screenshot saved!" "Desktop screenshot was saved as:\n ${FNAME}"
  else
    notify-send "Desktop screenshot could not be saved!" "There was an error."
  fi
else
  if xwd | convert - "${FNAME}"; then
    notify-send "Window screenshot saved!" "Window screenshot was saved as:\n ${FNAME}"
  else
    notify-send "Window screenshot could not be saved!" "There was an error."
  fi
fi

Lightweight screen lock and screensaver

A lightweight screensaver and locker can be done with xautolock, xset and i3lock/slock. Add the following to .xinitrc.

FILE ~/.xinitrc
xautolock -time 5 -locker "i3lock -c 000000" &
xset +dpms dpms 20 100 &
exec startlxde

The values of xset is also influenced by BATT_DPMS_STANDBY and its AC counterpart in /etc/laptop-mode/conf.d/dpms-standby.conf. If laptop-mode-tools are installed, these values could be leading.

Troubleshooting

lxpanel crashes when trying to "run" command

If lxpanel crashes when using (Alt+F2) or selecting "Run..." from the menu; then upgrade some components.

1. Update lxde-base/lxpanel to version 0.8.2 or higher.

See also

External resources

There are many resources available regarding the various facets of the Lightweight X11 Desktop Environment. Some additional resources are listed below:

  • https://forum.lxde.org/
  • On the Official LXDE website information can be found regarding the LXDE developmental progress, a community of support, and recommend system specifications.
  • The LXDE wiki contains instructions on customizing the LXDE installation, including keyboard layouts, autostarting applications, changing the default window manager, and much more.
    This article is based on a document formerly found on our main website gentoo.org.
    The following people contributed to the original document: nathanzachary, yngwin, nightmorph
    They are listed here as the Wiki history does not allow for any external attribution. If you edit the Wiki article, please do not add yourself here; your contributions are recorded on the history page.