Fluxbox

From Gentoo Wiki
Jump to: navigation, search
This page is a translated version of the page Fluxbox and the translation is 22% complete.

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


Fluxbox es un gestor de ventanas de código abierto para X11 que fue originalmente bifurcado de Blackbox. Esta guía provee instrucciones para configurar el gestor de ventanas para X11 , Fluxbox.

Introducción

Para quienes no sean familiares con el modelo de escritorio de Linux, los gestores de ventanas son programas ejecutados por X11 para administrar otros programas gráficos. Los gestores de ventanas controlan donde es ubicada cada ventana, su tamaño y qué escritorio(s) tiene acceso a estas. Esto puede realizarse automáticamente, a través de un cojunto de reglas definidas por el usuario, o puede ser hecho durante la ejecución, con el mouse y, posibiblemente, atajos de teclado, dependiendo específicamente del gestor de ventanas.

Algunos gestores de ventana, sin embargo, adoptan más funciones que solo la de gestión de ventanas. Fluxbox provee además una plataforma para lanzar programas, configurar atajos de teclado y fondos de pantalla, como también mostrar información en el slit. El gestor de ventanas por defecto de GNOME, Metacity, no incluye estas cosas, pero se encuentran disponibles a través de otros programas de GNOME. Por eso, uno verdaderamente no podría decir que Fluxbox es un gestor de ventanas ligero. Sin embargo, como Fluxbox incluye todo lo necesario para un escritorio básico, mucha gente lo usa en lugar de entornos de escritorio más grandes como GNOME o KDE.

Para hacer las cosas más confusas, Fluxbox puede reemplazar el gestor de ventanas por defecto de GNOME o KDE. Por ejemplo, algunas personas encuentran que Metacity, el gestor de ventanas de GNOME, simplemente no tiene la flexibilidad que necesitan, pero que Fluxbox no posee todas las apliaciones incluidas e integración que desean de un entorno de escritorio completo. Por eso, una persona podría usar Fluxbox para la gestión de ventanas y GNOME para el resto. Se debe notar, sin embargo, que en este arreglo hay algunos problemas causados por intersección de características.

Fluxbox puede ser además extendido por software de terceros. Esto es, con frecuencia, ideal en situaciones donde los recursos de hardware son limitados, o como cuestión de gusto personal.

Este artículo está dirigido a quienes son nuevos en Fluxbox, curiosos, o quien quiera obtener más de la experiencia de Gentoo/Fluxbox. El artículo ilustrará además, en como obtener más (aunque opcional) funcionalidad, usando programas de terceros que funcionan bien con Fluxbox.

Instalación

Primero, asegúrese de que un entorno X funcional ha sido instalado, como se muestra en la guía de configuración de X.

Ajustes USE

USE flags for x11-wm/fluxbox X11 window manager featuring tabs and an iconbar

bidi Enable bidirectional language support
imlib Add support for imlib, an image loading and rendering library
nls Add Native Language Support (using gettextGNU locale utilities)
slit Enables the Fluxbox slit (or dock)
systray Enables the system tray in the Fluxbox toolbar
toolbar Enables the Fluxbox toolbar
truetype Add support for FreeType and/or FreeType2 fonts
vim-syntax Pulls in related vim syntax scripts
xinerama Add support for querying multi-monitor screen geometry through the Xinerama API

Antes de instalar Fluxbox, revise alguna de los ajustes USE disponibles (listados arriba)

Existe un ajuste USE vim-syntax para hacer la configuración posterior más cómoda. Este ajuste instalará fluxbox-syntax, un esquema de color especial de Fluxbox para el editor de texto vim. Esto permite a los usuarios visualizar con mayot facilidad los cotenidos de sus archivos init y keys de Fluxbox. Es una pequeña extensión de vim y es altamente recomendada si Fluxbox será alguna vez configurado.

Existen ajustes USE que configuran la funcionalidad de Fluxbox: slit, systray y toolbar. Estos ajustes son provistos para que los usuarios que no necesiten el slit o la barra de herramientas puedan compilar Fluxbox sin ellas. Esto es útil cuando se necesite ejecutar un entorno extremadamente mínimo, o cuando se planee usar diferentes programas para proveer estas características, tales como paneles o barras autónomas.

Cuando los ajustes USE haya sido decididos, agréguelos al archivo /etc/portage/package.use. Por ejemplo, el siguiente comando dispondrá Fluxbox para usar truetype y vim-syntax:

root #echo "x11-wm/fluxbox truetype vim-syntax" >> /etc/portage/package.use

Emerge

Instalar Fluxbox es cuestión de ejecutar emerge.

root #emerge --ask x11-wm/openbox

Eso es todo; ¡ahora Fluxbox esá instalado! Sin embargo, es probable que no sea usado eficientemente solo con esas herramientas. Las siguientes secciones ayudarán a instalar otros paquetes potencialmente necesarios, y configurar Fluxbox y programas de terceros para trabajar mejor para el usuario. Tenga en mente que todos estos pasos son opcionales, entonces siéntase libre de escoger y aplicar de lo presentado, lo que crea más conveniente.

Configuración

Preparando X11

Fluxbox is simply another program that runs on X11. If desired, one can startx and then type fluxbox at in an xterm window. However, to say the least, this is annoying. If one does not desire to boot to the GUI, but instead wants to start X11 manually, it is possible to have X automatically load Fluxbox by executing, as a normal (non-root) user:

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

The above method is also not ideal for most users, as they want to have the desktop environment all the time; it is a pain to type startx when desiring to use a GUI every time the system boots. It also presents a security risk to the unaware. If the X11 display is locked using xlock, but run X11 from a console, then someone with physical access to the system can switch to that console, kill X11, and use whatever account is logged in. The only way to prevent this is to either background X11 or run it in screen, detach the screen session, then logout of the console. This tedious task should not have to be performed. When graphical login manager this problem does not exist. However, graphical login managers require running X11 as root, which may be a bad thing. There are, as of this writing, no exploits that the author is aware of for the current version, but if one is concerned, then do not use X11 at all or use the above method with screen. Note that this is not a Fluxbox issue; it is an issue with X11 itself.

There are a number of graphical login managers to choose from; another manager can be chosen at discretion of the user, however SLiM will be used for the purpose of this article. SLiM works well for Fluxbox, as well as any other environments that may be installed (such as GNOME, KDE, or Xfce).

root #emerge --ask x11-misc/slim
root #rc-update add xdm default
Importante
Be sure to emerge slim and add xdm to the bootscript, and not the other way around! Switching these will cause failure. One system-wide configuration file will need to be modified:
ARCHIVO /etc/conf.d/xdmSetting the display manager to SLiM
DISPLAYMANAGER="slim"

Display locking

When dealing with WMs a must have is a program lock to the X display for preventing unauthorized system access. When installing Fluxbox it would be wise to emerge x11-misc/xlockmore so the system can be locked. It is also advisable to enable autolocking of the screen when the system is idle. The package x11-misc/xautolock can be used to execute xlock after a specified timeout. The vast majority of users will also want the ability to set their own background images on the desktop; emerging x11-terms/eterm will make setting desktop background images a possibility. eterm also doubles as a nice X11 terminal. media-gfx/feh is a more lightweight solution that doubles as a slimmed down image browser.

root #emerge --ask x11-misc/xlockmore x11-misc/xautolock x11-terms/eterm media-gfx/feh

To enable autolocking add the following to the ~/.fluxbox/startup file above the exec fluxbox line:

ARCHIVO ~/.fluxbox/startup
xautolock -time 15 -locker "xlock -mode blank" -secure &

Themes and artwork

This section can be skipped for a minimal footprint, however it is nice to allow users to customize their WM's appearance. Themes specific to Fluxbox, Gentoo artwork for any WM, and themes that can be used on any *box WM will be installed.

root #emerge --ask x11-themes/commonbox-styles x11-themes/commonbox-styles-extra x11-themes/fluxbox-styles-fluxmod x11-themes/gentoo-artwork

Running Fluxbox for the first time

Now Fluxbox ready to run for the first time. It will create a directory called ~/.fluxbox/ in each user's home directory, which is where Fluxbox will store its settings and populate them with some default values.

user $startx

If SLiM or another display manager has been installed, be sure to start it by becoming root and running:

root #/etc/init.d/xdm start

Choose Fluxbox as the session and login with a regular user.

Once Fluxbox is running, it will look quite plain. A blank desktop with a toolbar at the bottom should be visible. Right-clicking anywhere on the desktop should bring up the menu. From there X applications can be started, or a terminal can be opened run console programs.

Fluxbox hotkeys

Fluxbox comes with a very weak set of default keysets. It enables a user to switch windows and desktops, and no more. Before changing it, there are a few things necessary to know. In the Fluxbox keys file, there are some strange modifiers. Mod1 is commonly known as the Alt key, and Mod4 is the Super (AKA Windows) key. Control and Shift are Ctrl and Shift. However, it is usually best to use Mod1 or Mod4 because other X11 programs tend to use Control and Shift for their own shortcuts.

All of these are independent, so feel free to leave out anything not desired, or to modify the given example to meet special needs. This guide uses what the author assumes to be the most common programs, so also substitute the name of the binary used if it differs from what appears. For more information, read the man page for Fluxbox (man fluxbox).

With that out of the way, fire up a text editor (non-root user), point it to ~/.fluxbox/keys, and begin enhancing some shortcuts!

ARCHIVO ~/.fluxbox/keysModifying keyboard shortcuts
# Locks the X11 display for the current user:
Mod4 l   :ExecCommand xlock
  
# Opens a number of programs with quickkeys. These are just examples, I am sure
# you get the point...
Mod1 f   :ExecCommand firefox
Mod1 t   :ExecCommand thunderbird
Mod1 o   :ExecCommand oowriter
Mod1 v   :ExecCommand gvim
  
# Fluxbox has no sound control; do a hack to get some
# (assumes alsa is being used; good luck if using oss :P )
Mod1 e   :ExecCommand Eterm -name alsa -e alsamixer
  
# This launches fbrun, which in turn launches other programs:
Mod1 r   :ExecCommand fbrun
  
# Program Control. It just makes life simpler...
Mod1 4   :Close
Mod1 m   :Minimize
  
# If using aterm (emerge x11-terms/aterm), the following opens a really nice
# transparent aterm with no borders, fitting nicely with 1024x768
# resolution, while still leaving room for conky. Once again, feel free to
# modify.
Mod1 a   :ExecCommand aterm -name aterm -sl 3000 -tr +sb -sr -sk -bg black -fg \
white -fade 90 -bl -tn xterm -fn \
-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-15 -g 116x57
  
# Similar to the above, but opens a transparent rooted terminal.
# The root password must be known to use this:
Mod1 s   :ExecCommand aterm -name aterm -sl 3000 -tr +sb -sr -sk -bg black -fg \
white -fade 90 -bl -tn xterm -fn \
-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-15 -g 116x57 -e su -
  
# Takes a screenshot using the print button, needs media-gfx/imagemagick
None 107 :Exec tm=$(date +%F,%T) && import -window root /tmp/screenshot$tm.png \
&& display /tmp/screenshot$tm.png
Mod1 107 :Exec tm=$(date +%F,%T) && import -frame -window $(xprop _NET_ACTIVE_WINDOW \
-root | awk '{print $5}') /tmp/screenshot$tm.png && display /tmp/screenshot$tm.png

System monitor

It is a common desire to setup a system monitor for X11 on desktop systems. Gkrellm (app-admin/gkrellm is a commonly used monitor, but in the spirit of Fluxbox minimalism, a simpler monitor will be used. Welcome conky. If desired, use another monitor; there are plenty of instructions elsewhere on the wiki.

root #emerge --ask app-admin/conky

The default configuration file for Conky is rather weak, but more info can be found by reading the man page or the Conky guide.

Icons

Fluxbox does not come with a utility or program to draw icons to the desktop; everything is handled by keyboard shortcuts, or the right-click menu. iDesk is a program that can be used to fulfill this need. It is aimed at users of minimal WMs like Fluxbox who want to display icons in the root window, and it even supports funky graphic effects like transparency! Despite its name, iDesk is not affiliated with Apple or Mac. Installing iDesk is as simple as:

root #emerge --ask x11-misc/idesk

Once installed, it will be necessary to configure iDesk so that it is able to display icons. Its configuration file can be found at ~/.ideskrc. This is a rather lengthy task, and can not be well covered in this article. The following resources might be useful in order to configure iDesk: man idesk, iDesk's Usage Guide and this thread in the Gentoo Forums.

Graphical file managers

It is important to note that Gentoo does not need a file manager. It is perfectly possible, and indeed simpler (in the author's humble opinion), to do file manipulation by command-line. However, not everyone agrees...

Many users who are new to Gentoo/Fluxbox are put off by the lack of a graphical file manager such as nautilus in GNOME. Fluxbox itself does not provide such a program, but, as always, one is simple to acquire. There are many choices, but this article will only present three:

  1. Gentoo file manager for the minimalist who likes text only.
  2. rox for those who like text and graphics.
  3. thunar for those who like full graphical file managers.

For those who are not sure what they like, it is also possible to install all three file managers in order to try each one.

Gentoo File Manager

Gentoo is a minimalistic file manager which seeks to provide the benefits of a GUI interface without the bloat which is commonly associated.

root #emerge --ask app-misc/gentoo
Nota
The Gentoo file manager is a separate project from the Gentoo Linux distribution. For more information on this, see the Gentoo Name and Logo Usage Guidelines.

The Gentoo file manager aims to be fully configurable via GUI, so feel free to tweak.

Rox Filer

Rox Filer is a file manager which uses icons as well as text and is much like Windows' Explorer.

root #emerge --ask app-misc/rox-filer

Rox behaves much like "traditional" file managers, so its interface should be intuitive. If not, there always are man pages for further information.

Thunar File Manager

Thunar is a lightweight, fast file manager that, like Rox, behaves much like "traditional" file managers. It includes icons and text, and it is easy to use. Though originally designed for Xfce, it makes a nice complement to a Fluxbox-based system.

root #emerge --ask xfce-base/thunar

Image viewers

Many WMs come with utilities to view pictures (images) in a directory. These applications are small and lightweight, and do not allow for editing (which is assumed to be done by tools such as gimp). This is necessary when using command line, gentoo, or rox as file managers. Although thunar can display image thumbnails having a separate lightweight image viewer is still a good idea.

root #emerge --ask media-gfx/gqview

gqview can be launched in any directory, and can browse through any supported picture format.

Setting a theme, background, and a startup script

Fluxbox has a number of themes that can be accessed via the right click menu. Navigate to Fluxbox menuSystem Styles. These themes usually set their own background, which is either a single color or a gradient of some type. Most users prefer to set their own backgrounds, and to have those background persist no matter what theme has been chosen. To do so, another one of Fluxbox's configuration files must be modified, this one governs Fluxbox's startup behavior. Fire up that text editor again; this time point it to the ~/.fluxbox/startup file.

If this file was pre-existing then be sure to clear it. Add the following to the newly created file, uncommenting as needed, and filling in values for the CAPS:

ARCHIVO ~/.fluxbox/startupEditing startup scripts for Fluxbox
# Gentoo's Fluxbox startup script
  
# Programs which need to run constantly, as opposed to a one time execution,
# this means they need an "&" (ampersand) at the end of the command.
  
# Show the Fluxbox splash-screen
#fbsetbg -C /usr/share/fluxbox/splash.jpg
  
# This sets a desktop background image. A program must be setup
# to do this (x11-terms/eterm is recommended)
#fbsetbg -f PATH_TO_IMAGE
  
# Custom fonts directory
#xset +fp PATH_TO_FONT_DIRECTORY
  
# Starts the icons program
#idesk &
  
# This MUST be the last command!
exec /usr/bin/fluxbox -log ~/.fluxbox/log

Enabling privileged operations through polkit

Fluxbox is able to communicate with core system services over D-Bus to allow privileged operations, such as shutting down the system. To handle the authorizations towards these operations, polkit (formerly known as policykit) can be used.

In order to use polkit, an agent is required. There are several polkit agents available and if a desktop profile is used, one of them will already be installed. Their respective startup files are stored in /etc/xdg/autostart but are not considered by fluxbox. Instead, an additional entry should be made to fluxbox' startup file:

ARCHIVO ~/.fluxbox/startupStarting a polkit authentication agent at startup
/usr/libexec/polkit-gnome-authentication-agent-1 &

Menu generation

The author uses a text editor to create menus. If this sounds appealing, please skip this section and proceed to Editing Menus by Hand.

It is possible to edit ~/.fluxbox/menu by hand after using an automatic generator (see next section), to add packages or delete those which are not used. Note when something is deleted from this menu, it does not delete the package from the system; only a link is removed from the individual user's menu. The program can still be run by command-line or alternate methods (hotkeys, etc.).

If Fluxbox has been installed then a program called fluxbox-generate_menu should also be installed. This program can be used to generate menus. Run it with the following options as a non-root user to generate a menu:

user $fluxbox-generate_menu -is -ds

It is recommended fluxbox-generate_menu (listed above) is used instead of other programs that accomplish similar tasks. The reason for the recommendation is that other programs may not understand Gentoo's filesystem directory structure, where fluxbox-generate_menu does.

This can also be done from the Fluxbox menu itself. There is usually an entry in the Fluxbox menu called Regen Menu which will re-run this script, looking for any new applications that have been installed since the last time it was ran.

Nota
It is possible to use this method to auto-generate the menu and still have some manual control over it. Creating and editing a ~/.fluxbox/usermenu file by hand (see the next section for syntax) will give the user a personalized menu which will not be erased the next time the script has been run.

Editing menus by hand

Fluxbox's menu is a text file that follows a simple syntax that is described in this section. The default menu definition is present in the ~/.fluxbox/menu file.

Menu entries for executing applications are defined by an [exec] element. Entries can be defined under the [begin] definition (the menu root), or between a [submenu] and its corresponding [end] line (submenu definitions). For example:

ARCHIVO ~/.fluxbox/menuDefining new menu entries
# Custom fluxbox menu
[begin] (Fluxbox)
  (...)
  [exec] (XTerm White on Black) {xterm -ls -fg white -bg black}
  (...)
  [submenu] (More terminals)
    [exec] (Aterm default) {aterm}
    [exec] (Rxvt default) {rxvt}
  [end]
  (...)
[end]

The root menu definition begins with the [begin] tag, followed by its name, between parentheses and ends with its corresponding [end] tag. All the menu commands (called here, tags) are enclosed by square brackets, menu names will be enclosed between parentheses and the actual commands are enclosed between braces. Comments are allowed in this file, for lines beginning with #.

In the example shown above, the first [exec] line defines a new entry named "XTerm White on Black", which will execute xterm -ls -fg white -bg black as if from a command line. Next is a submenu which is defined using the [submenu] tag, and after that a section called "More terminals", with two more [exec] commands. Any submenu definition must have its corresponding [end] tag.

There are other menu commands that can be used in the ~/.fluxbox/menu file. Read the official documentation available online for more information.

Setting default applications

See the Default Applications article.

Usage

Resize a window by left clicking the tiny window-corner re-sizing tools and drag them around, or hold down the Mod1 key and right click somewhere near a border, then drag the mouse.

Summary

Congratulations! Fluxbox is now installed, configured, and ready to go. If any questions or suggestions come to mind feel free to edit this page, add a suggestion to the associated talk page, and/or file a bug report at Gentoo's Bugzilla.

External resources

  • The Fluxbox wiki.
  • Fluxbox developers and users in #fluxbox on Freenode.net.
    This page is based on a document formerly found on our main website gentoo.org.
    The following people contributed to the original document: Jonathan Smith, Alin Dobre, Joshua Saddler, lack
    They are listed here because 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 each article's associated history page.