Openbox/Guía

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Openbox/Guide and the translation is 28% complete.
Outdated translations are marked like this.

El fin de esta guía es mostrar a los usuarios cómo instalar y configurar el gestor de ventanas Openbox. Muchos programas potenciales para ser usados en conjunto con Openbox son nombrados en todo este artículo. Para la corta y siempre guía de instalación ver Openbox.

Introducción

¿Qué es Openbox?

Después de instalar The X Server el gestor de ventanas por defecto (Tab Window Manager, o TWM) simplemente no va a cortarlo. La mayoría de los usuarios tendrán alguna esperiencia con los grandes entornos de escritorio como KDE, GNOME, y Xfce. Uno de los componentes de esos grandes escritorios es llamado el gestor de ventanas (o WM, iniciales en inglés). Un gestor de ventanas es el responsable por la apariencia y localización de los contenedores (o "ventanas") dentro de cada programa que se esté ejecutando. Openbox es un minimalista, de bajo consumo, gestor de ventanas.

¿Por qué debería usarlo?

Openbox, a diferencia de los grandes entornos de escritorio, depende de unas pocas librerías. Por esa razón, puede proveer un entorno gráfico ligero que funciona muy rápido, incluso en equipos viejos. Sin importar si el equipo es o no antiguo, Openbox también provee una alta configuración y discreto entorno de trabajo. Eso quiere decir que si no hay necesidad de un panel, taskbar, reloj o algún otro programa, esas opciones están abierto a hacerlas.

Instalación y configuración

Instalación inicial

Luego de instalar y configurar x11-base/xorg-server, instalar Openbox puede ser hecho por un simple comando.

root #emerge --ask x11-wm/openbox

Al igual que cualquier otro gestor de ventanas y entorno de escritorio, para poder iniciar Openbox automáticamente, se necesita decirle a X Server que debe iniciarlo. Esto se hace añadiendo Openbox al archivo ~/.xinitrc que se ubica en el directorio base del usuario.

user $echo "exec openbox-session" >> ~/.xinitrc

Esto iniciará automáticamente Openbox cuando startx es ejecutado en la terminal.

Importante
Debido a que cada usuario tiene su propio arrchivo .xinitrc, esté seguro de ejecutar el comando startx como un usuario, no como root.
Nota
Si tiene problemas con el auto-montado, o si dbus y ConsoleKit están siendo usados, exec ck-launch-session dbus-launch --sh-syntax --exit-with-session openbox-session debería ser escrito en el archivo .xinitrc en vez del simple comando mencionado anteriormente exec openbox-session.
Nota
Es posible reemplazar los gestores de ventanas por defecto de los entornos de escritorio KDE, GNOME, or Xfce siguiendo esta sección Openbox inside desktop environments.

Ahora que Openbox fue instalado y los comandos apropiados fueron agregados al archivo .xinitrc de usuario, ejecute el comando startx para ver a Openbox en acción ¡Cuidado! El escritorio puede parecer un desorden. Esto obedece a la filosofía de Openbox: Se proporciona un entorno austero desde el cual el usuario puede construir un escritorio completamente a su gusto.

Al ejecutar el comando startx, tipicamente no aparecerá otra cosa más que la pantalla en negro por defecto de Openbox ¿Donde está el menú? Hacer click derecho generará un menú emergente en la posición del cursor. Este menú no es nada más que un ejemplo para ilustrar el "estilo" de un menú de Openbox. Como este solo es un ejemplo, ninguno de los elementos en el menú funcionará a menos que el programa haya sido previamente instalado. En la siguiente sección, veremos como crear un menú que contenga accesos a los programas que el usuario desee.

Importante
Si al hacer click derecho para ver el menú, se genera una ventana emergente con entradas no legibles,necesitará instalar algunas fuentes en el sistema. Dos opciones comunes son media-fonts/corefonts (bajo licencia EULA, o su contraparte libre,media-fonts/croscorefonts) y media-fonts/ttf-bitstream-vera.

Configuración del menú

Como la configuración por defecto del menú de Openbox es esencialmente poco útil por las razones mencionadas arriba, es tiempo de crear una que funcione. Todos los elementos en el menú de Openbox son escritos en el archivo, apropiadamente nombrado, menu.xml el cual deberá estar ubicado en el directorio especifico para cada usuario ~/.config/openbox/menu.xml o para el sistema entero /etc/xdg/openbox/menu.xml. El único archivo menu.xml que es creado por defecto es el del sitema entero, que aplica a todos los usuarios.

Una forma fácil de obtener un archivo de menu básico que podrá ser modificado es usar MenuMaker, el cual generará un archivo menu.xml basado en los programas que están actualmente instalados en el sistema. Para hacerlo, primero instale el paquete.

root #emerge menumaker

Una vez instalado, asegúrese de cerrar sesión de superusuario y volver a la cuenta de su usuario. Luego ordene a MenuMaker crear un menú usando específicamente la sintaxis XML para Openbox.

user $mmaker -v OpenBox3

El menu generado deberá estar localizado en ~/.config/openbox/menu.xml. Los usuarios pueden entonces elegir entre establecer solo el archivo menu.xml para un usuario, o adicionalmente copiarlo en directorio de configuración para el sistema entero.

root #cp .config/openbox/menu.xml /etc/xdg/openbox/menu.xml
Importante
Es una buena idea usar MenuMaker para generar un menú por defecto porque este contendrá elementos fundamentales de Openbox. Estos incluyen el selector de escritorios virtuales y los comandos para reiniciar y cerrar la sesión de Openbox.

When opening up the menu.xml file in an editor (nano, for example), users will notice that the XML tags used are very human-readable and easily understandable. Users can modify the default file to fit their needs, or they can write it from scratch (don't worry, it's really not that difficult). The basic syntax for the menu XML is as follows:

ARCHIVO menu.xmlSintaxis XML ejemplo para un menú
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
<separator label="NAME_OF_SEPARATOR" />
<menu id="IDENTIFIER" label="NAME_OF_MENU">
  <item label="NAME_OF_PROGRAM">
    <action name="execute"><execute>/LOCATION/OF/BINARY</execute></action>
  </item>
</menu>
</openbox_menu>

The above example will work for any applications that launch with standard options in their own windows, but what if one needs to append options to the program at launch time? That is no problem either, just add the options to the command, as usual.

ARCHIVO menu.xmlAñadir opciones a un orden
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
<separator label="NAME_OF_SEPARATOR" />
<menu id="IDENTIFIER" label="NAME_OF_MENU">
  <item label="NAME_OF_PROGRAM">
    <action name="execute"><command>/LOCATION/OF/BINARY --OPTION1 --OPTION2</command></action>
  </item>
</menu>
</openbox_menu>

Simply replace anything in ALL_CAPS in the above two examples with the right information. Alternatively, use obmenu, which is a graphical interface allowing users to create personalized menus without having to manually edit the menu.xml file. It is a very small application and offers a nice amount of customization without typing any XML.

Openbox theme and behavior configuration

Aside from being minimalistic and lightweight, Openbox is also surprisingly customizable and flexible. A user can easily change various settings related to theme, appearance, window placement, docking, and more. There are two options for configuring these settings within Openbox. It is possible to either manually edit ~/.config/openbox/rc.xml, or to use a GUI to help in quickly changing the settings.

To manually edit rc.xml, open up a text editor and start making changes. Don't forget to make a backup of the original file just in case, and store it in a location like ~/.config/openbox/rc.xml.default. There are plenty of comments within the document itself that should help with editing. Alternatively, take a look at the Openbox configuration guides.

If manually editing rc.xml isn't preferred, then try to use the GTK application to manage themes and behaviors in Openbox. The application that can be used is called ObConf, and can be installed on the system just as easily as was Openbox itself.

root #emerge obconf

Next open the configurator by typing obconf in the terminal. Go and add an entry for ObConf into the menu.xml so it will show up in the Openbox menu. If the "editing the menu.xml file" code listing above seemed too vague to be helpful, we'll use ObConf as an example of a menu entry:

ARCHIVO menu.xmlUtilizar obconf
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu>
<menu id="1" label="Configuration">
  <item label="OpenBox Config">
    <action name="execute"><execute>/usr/bin/obconf</execute></action>
  </item>
</menu>
</openbox_menu>

While ObConf is a great GUI tool for editing many behavior-related settings for Openbox, it doesn't allow one to manipulate nearly as many settings as are presented in the rc.xml file itself. Please consult the Openbox Wiki for more information.

Nota
In recent versions of Openbox (namely >3.4.7.2), one may experience a delay in the submenu opening. This setting was introduced into the rc.xml file, and is listed as <submenuShowDelay>100</submenuShowDelay>. Simply choose a lower number that suits personal needs.

Autostart configuration

As mentioned above, not a whole lot is seen when running the startx command for the first time after installing Openbox. In addition to customizing menus and changing the behavior of the window manager, most users will probably want to have some programs automatically start with their Openbox session. There is an easily-editable autostart script that allows to do just that. Just like with the menu.xml file, there are two different locations of the autostart script--the system-wide (/etc/xdg/openbox/autostart), and the user-defined (~/.config/openbox/autostart).

In the default autostart, notice a bunch of lines calling for programs like the gnome-settings-daemon, XDG, and others. These lines will generate errors upon logout if the programs are not installed and configured. The easiest thing to do when getting started with Openbox is to just comment out these lines by using the # symbol.

ARCHIVO autostart.shComentar los trozos de código en autostart
# Lanzar las cosas de XDG autostart. Por defecto no lanzar nada específico del escritorio
# DESKTOP_ENV=""
# if which /usr/lib/openbox/xdg-autostart >/dev/null; then
#  /usr/lib/openbox/xdg-autostart $DESKTOP_ENV
# fi

In the above example, the comment symbol (#) was added before each line. The commenting method is preferred to just deleting the lines because users may want to add support for some of those startup items at a later time. Thus, leaving the default lines in place could ease that process.

Adding programs to the autostart script is as easy as writing in the program name for many applications. For instance, if app-admin/conky is installed (a lightweight system monitor), and it needs to be started automatically with the Openbox session, simply add the following line to the autostart file:

ARCHIVO autostart.shAdding Conky to autostart.sh
conky &

The ampersand (&) after the command allows that application to load up in the background. Most users will likely want to load all the applications in their autostart script in the background because doing so will let Openbox and other programs load without the previous one finishing.

Configuring PolKit

Many applications depend on the PolKit authentication framework. They may need a PolKit agent, such as polkit-gnome, running in the Openbox session.

First, install the agent:

root #emerge polkit-gnome

Now configure PolKit to start automatically when logging in to Openbox. Add the following line to ~/.config/openbox/autostart (for a single user) or /etc/xdg/openbox/autostart (for all users):

ARCHIVO autostart.shArrancar PolKitde forma automática
sleep 1 && /usr/libexec/polkit-gnome-authentication-agent-1 &

Setting the background

Some things that users might take for granted in bigger desktop environments are not included by default in Openbox. One such thing is setting the desktop background. In order to place an image as the wallpaper, emerge a program like media-gfx/feh or x11-misc/nitrogen. feh is a simple image viewer that can also set the background, and it can easily be put into the autostart script. Once {{|feh}} is emerged, issue the following command to set the background:

Nota
feh has many other options instead of --bg-scale, which will scale the image to the screen dimensions. Consult the feh documentation.
user $feh --bg-scale /ruta/a/la/imagen.jpg

Once the background has been set manually, a file called .fehbg will be created in the user home directory. This file simply contains the above command that was just entered in the terminal, and is automatically updated when issuing a different background command. Now, to set the background automatically upon login, add the following line to the autostart script:

user $source $HOME/.fehbg &

Alternatively use nitrogen. It will allow the user to set a folder for the background images, view thumbnails of those images, and fit, stretch, or tile them to the desktop.

Installing nitrogen and getting it into the Openbox menu requires a few more steps than are readily apparent. First, emerge nitrogen. Second, run nitrogen with the backgrounds folder as argument:

user $nitrogen /ruta/a/la/carpeta/de/fondos

Third, set the background image, but keep in mind that it will not be there anymore after logout. Just as with feh, restore the background by editing the autostart script to have the following line:

user $nitrogen --restore &

This will cause nitrogen to load automatically when starting the Openbox session, and that can lead to a slightly slower load time than using feh.

Programs to use with Openbox

The following is a list of some programs which might be of use within an Openbox environment. While the list contains numerous terminal emulators, file managers, panels, and more, it should by no means be considered exhaustive. Please check the appropriate categories in Portage for more options.

Terminal emulators

  • lxde-base/lxterminal is the default terminal emulator for LXDE. It is very lightweight, and based on VTE. While EvilVTE offers many more customization options (including transparency), LXterminal has a graphical interface for some of the more common options (font, colors, et cetera).
  • x11-terms/evilvte is an extremely lightweight terminal emulator based on VTE. It supports tabs, multiple encodings, as well as an easy and extensible configuration file.
  • x11-terms/mrxvt is a multi-tabbed rxvt clone with XFT, transparent background and CJK support. It also features session support for each tab.
  • x11-terms/aterm supports transparency and backwards compatibility with rxvt. It was originally designed for the AfterStep window manager, but easily integrates with other environments.
  • x11-terms/eterm is a terminal based on vt102 and designed to be a more feature-rich replacement for xterm.
  • x11-terms/rxvt-unicode is a clone of rxvt that supports Unicode, daemons, embedded perl, and multiple fonts simultaneously.
  • x11-terms/xfce4-terminal is the VTE-based default for the Xfce desktop environment, so it does require some Xfce libraries to run. However, it is still fairly speedy, and supports transparency and is easily customized.

Gestores de archivos

  • x11-misc/pcmanfm is the lightweight file manager from LXDE. It supports tabbed browsing, drag and drop, thumbnails for images, bookmarks, volume management, searching, and more. It also provides supports for managing the desktop background and drawing desktop icons (both optionally).
  • xfce-base/thunar is the standard file manager from Xfce. It features a bulk renamer, user-customizable actions, and an extension framework, along with many optional plug-ins, such as media tag editing. It depends on several Xfce libraries, but it's still slimmed down compared to other file managers like Nautilus (from GNOME), and Konqueror (from KDE).
  • gnome-base/nautilus is the powerful file manager from the GNOME desktop environment. It features volume management, thumbnails for images, searching, and some system configuration. As it depends on many of the GNOME libraries for proper function, it can seem a bit heavy compared to some of the other file managers.
  • app-misc/gentoo (no relation to this glorious Linux distribution) is a two-pane style file manager. It is incredibly lightweight, but lacks a some features now prominent in modern file managers. It should definitely be considered for older hardware, or if a barebones setup is needed.
  • app-misc/emelfm2 is another file manager in the vein of Midnight Commander. It features a two-pane window. As with the Gentoo file manager (listed above), it is bare bones and does not include many features prevalent in newer file managers. However, it also offers a few features not found in other file managers, such as a built-in command line in a separate pane.

Desktop management

  • Though x11-misc/pcmanfm is mainly a file manager, it also gives the option to manage the desktop background (instead of using feh or nitrogen) and draw desktop icons.
  • x11-misc/idesk is a simple program used to draw desktop icons. It supports shadowed and anti-aliased fonts, PNG images, "snap-to-grid" placement, and changing the desktop background.

Panels

  • Tint2 is a simple, lightweight panel and taskbar. It supports color, transparency, a clock, drag and drop between virtual desktops, a system tray, and comes with a battery monitor. One can even add a button to display the applications menu from the window manager.
  • x11-misc/pypanel is an easily customized panel written in Python and C. It features transparency, shading, tinting, location and layout configuration, font type, auto-hiding, application launcher, clock, and more.
  • lxde-base/lxpanel is the default panel and taskbar from LXDE. It features a launcher, menu, clock, and a GUI-based configurator. It is feature-rich while depending on very few packages, making it a good choice for a lean system.
  • xfce-base/xfce4-panel is the default panel from the Xfce desktop environment. It supports application launchers, detachable menus, a pager, tasklist, clock, applets, and more. It does, however, require a few of the Xfce libraries which are not dependencies of some other panels.
  • x11-misc/fbpanel is a simple, extremely lightweight panel that supports window lists, launchers, a clock, and a few other goodies. It's not the most featureful panel, and it can be cumbersome to configure, but it needs only GTK to run.

Pagers and systrays

  • x11-misc/netwmpager is an EWMH-compliant pager that integrates nicely into any of the *box environments. It is not as obtrusive, and is much more readily customizable than many of the other available pagers.
  • x11-misc/bbpager is a desktop pager that was originally written for BlackBox, but works nicely with Openbox as well. It does have some BlackBox dependencies though.
  • x11-plugins/docker is the system tray that is made especially for Openbox. It has no extra dependencies, and gives the ability to view and use tray icons for supported GTK and QT-based applications.
  • x11-misc/trayer is a system tray that was modified from the FBpanel code, and is often used with FVWM. One of its perks is that it supports transparency.

Session management

  • lxde-base/lxsession is the stripped down session manager from LXDE. It is designed to remember applications that the user was running at the last logout, and to automatically restart those programs. It also supports the HAL daemon.
  • xfce-base/xfce4-session is the session manager from Xfce. It is capable of saving several sessions, and provides methods for logging out, rebooting, and suspending the computer. It does, however, have many Xfce dependencies.

Configuration tools

  • x11-misc/obconf is a GUI application allowing to customize the Openbox window manager without manually editing ~/.config/openbox/rc.conf.
  • lxde-base/lxappearance is a GTK theme and icon configurator used with LXDE. It provides a nice graphical interface for setting the theme and icons, while depending on very few extra libraries.
  • x11-themes/gtk-chtheme is a simple application allowing for easier switching of GTK themes and the font. Currently, it does not allow for the switching of icon themes.

Miscellaneous

  • app-admin/conky is a lightweight system monitor that can display over 250 objects, including date and time, CPU usage, memory usage, IMAP/POP3 email, top processes, hardware sensor data, and even info from the music player. It is highly customizable both in appearance and data display. We also have a Conky configuration guide available.
  • app-editors/leafpad is a simple text editor. It is very lightweight, but includes features like codeset options, and the ability to undo/redo without limits.
  • media-gfx/feh is a simple image viewer that runs from the terminal, but it also has many other features. It can display a slideshow of images, create an index print, dynamically zoom, and set the desktop background (detailed instructions above).
  • media-gfx/gpicview is a GUI-based image viewer. Though it has more dependencies than feh, it is incredibly quick to load and run.
  • x11-misc/slim is the Simple Login Manager, which allows to login to the Openbox session via a graphical interface instead of the terminal. It has very few dependencies, and supports many themes, but should not be used on machines that require remote logins.

Openbox inside desktop environments

LXDE

If installing each component of a working environment sounds like a little too much customization, but the flexibility of Openbox is still wanted, then take a look into a desktop environment that uses Openbox as its default window manager. That environment is LXDE, the Lightweight X Desktop Environment. Designed to require even fewer system resources than Xfce, it is built around Openbox.

Openbox inside GNOME

If a GNOME environment is already installed, then just replace the Metacity window manager with Openbox. Fortunately, this is quite a simple task! Fire up an editor, open the ~/.xinitrc file, and put the following command inside it:

ARCHIVO ~/.xinitrcAñadir una sesión Openbox-GNOME a .xinitrc
exec openbox-gnome-session

When using GDM or another graphical login manager, notice a new "GNOME/Openbox" option in the session menu. Simply select that option instead of manually editing the ~/.xinitrc.

Openbox inside KDE

It is possible to use Openbox as the window manager inside of KDE by simply editing the ~/.xinitrc file, and replacing the current exec command with the following:

ARCHIVO ~/.xinitrcAñadir una sesión Openbox-KDE a .xinitrc
exec openbox-kde-session

Now when issuing startx users will see KDE, but instead of KWin, they will have the customizability of the Openbox window manager.

When using KDM or another graphic login manager, a new "KDE/Openbox" option will appear in the session menu. Simply select that option instead of manually editing the ~/.xinitrc.

Nota
This method of using Openbox with KDE has been tested with the KDE 3.x releases. While it seems highly likely that it will work with the KDE 4.x series, it has not been thoroughly tested as of yet.

Openbox inside Xfce

To use Xfce4 with Openbox, first start a normal Xfce session, and open up a terminal. From the terminal, issue the following command:

user $killall xfwm4 ; openbox & exit

Second, exit out of the Xfce session, and make sure to tick the checkbox that says "Save session for future login." This will keep Openbox as the default window manager. Third, notice that the default logout menu action no longer works. To fix this problem, open up the menu.xml file, and locate this line:

ARCHIVO menu.xmlAcción de salida
<item label="Exit">
     <action name="Exit"/>
</item>

Change it to this:

ARCHIVO menu.xmlNueva acción de salida
<item label="Exit">
  <action name="Execute">
    <command>xfce4-session-logout</command>
  </action>
</item>
Nota
With Xfce4, the root-menu provided by Xfdesktop will be used instead of the Openbox root-menu.

Véase también

Recursos externos

While this document will easily take users through the initial installation and customization of Openbox, it is by no means the only reference on the topic. There are several other resources that will aid in creating a perfect Openbox setup. Some of them are listed below:

  • On The Official Openbox website users will find more detailed information regarding theming, creating menus (including pipe menus), autostart scripting, and much more. This site also has information regarding new releases, upgrades, and instructions on how to contribute to development.
  • The Urukrama's Guide to Openbox blog contains a plethora of information about switching GTK themes, setting up keybindings, desktop effects, and other programs to use in conjunction with Openbox. Though the tutorial was originally written for use with Ubuntu, everything is applicable to Gentoo (and other Linux distributions for that matter).
  • Box-Look provides numerous themes, icons, wallpapers, fonts, and tools to be used with Openbox (as well as the other *box window managers like Fluxbox, Blackbox, PekWM, etc.)

This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: nathanzachary and nightmorph
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.