[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

¡Esta es una revisión vieja del documento!


i3 Administrador de ventanas en mosaico

i3 es un administrador muy ligero, flexible y personalizable window manager con excelente soporte para múltiples monitores. Los administradores de ventanas en mosaico apuntan a maximizar el espacio de la pantalla en mosaico de todas las ventanas abiertas en un modo no superpuesto. Los bordes y botones son prácticamente inexistentes en los administradores de ventanas de mosaico, tienen un aspecto muy minimalista y se centran principalmente en el teclado. Si el concepto de administradores de ventanas en mosaico aún es desconcertante, consulte el i3 oficial screencast.

i3 en Slackware

Slackware no viene con el administrador de ventanas i3. Sin embargo, el proceso de instalación es rápido y fácil. i3 está disponible en SlackBuilds. Tenga en cuenta que debido a una serie de factores, las últimas versiones de i3 no se construirán en versiones ligeramente más antiguas de Slackware:

  • Para los sistemas Slackware anteriores a 14.1, debe instalar i3 versión 4.2.
  • Para Slackware 14.1, la versión más alta de i3 que se compilará sin reemplazar los paquetes de stock de Slackware será i3 4.8.
  • Slackware-current (y posteriormente 14.2) podrá alojar la última versión de i3 (i3wm 4.11)

Puede compilar e instalar las dependencias mediante el tutorial este o mediante sbopkg, un navegador SlackBuild.

i3 Dependencias

Todas las dependencias de i3 también están disponibles en SlackBuilds:

También es muy recomendable instalar i3status y su dependencia confuse.

A partir de la versión 4.8, i3 es capaz de guardar y restaurar sus diseños en espacios de trabajo particulares. Para obtener más información, consulte this.

Si desea utilizar las nuevas funciones, debe instalar más dependencias. Todos ellos están disponibles en Slackbuilds.org:

Iniciando i3

Una vez instalados todos los paquetes, puede salir de X y ejecutar xwmconfig para seleccionar i3 y luego ejecutar startx para iniciar la interfaz gráfica de usuario.

Problemas conocidos

Controlador binario i3 y nVidia

Hasta hace poco, los usuarios de controladores binarios nVidia tenían que agregar el indicador –force-xinerama a su archivo .xinitrc .

# Start i3

if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
    exec ck-launch-session i3 --force-xinerama
else
    exec i3
fi

A partir de la versión 302.17 del controlador binario nVidia, ya no es necesario . (Ver más info)

i3 Configuration

When you first start i3, you will be welcomed by i3-config-wizard:

You have not configured i3 yet.
Do you want me to generate ~/.i3/config?

<Enter> Yes, generate ~/.i3/config
<Esc>   No, I will use the defaults

Let the wizard generate the config file. You'll then face another dilemma:

Please choose either:

--> <Win>  Win as default modifier
    <Alt>  Alt as default modifier

Afterwards, press

<Enter> to write ~/.i3/config
<ESC>   to abort

Use the Win and Alt keys to switch between the modifiers and choose one of them. In this tutorial I use Alt as the default modifier (I use Win for all sorts of custom keybindigs to avoid any clashes with i3 or other applications).

Please note that if you have changed the keyboard layout since the wizard automatically generated the config file, you might have to revisit the config file and manually modify the keybindings

Changing i3 Modifier Key(s)

It is easy to change or add i3 modifiers. Right at the top of the ~/.i3/config file you'll see:

Alt as the default modifier:

set $mod Mod1

Or Win as the default modifier:

set $mod Mod4

You can also configure a secondary modifier assigning it to a variable (eg. $ms):

set $mod Mod1
set $ms Mod4

Keybindings for Most Common Activities and Applications

The following are some basic keybindings to help you get started. For a full map of default keybindings see here or consult a very thoroughly commented config file located in ~/.i3/.

Terminal

Pressing Alt+Return launches a terminal which in Slackware defaults to xterm. If you want to change it, modify the following line:

bindsym $mod+Return exec i3-sensible-terminal

Specify a terminal of your choice:

bindsym $mod+Return exec /usr/bin/urxvt
Close a Window

Alt+Shift+Q

Go to a Given Workspace

Alt+2

In this instance we go to Workspace 2.

Reload the Config

Alt+Shift+C

Restart i3

Alt+Shift+R

Quit i3

Alt+Shift+E

Adding Your Own Keybindings

If you want to launch Firefox using Alt+B, add the following to ~/.i3/config:

bindsym $mod+b exec /usr/bin/firefox

Opening Other Applications

The Alt+D keybinding launches dmenu where you can type a program you want to run.

Keyboard Layout

Please visit this HOWTO to configure the keyboard layout in i3.

Further Reading

i3 has a great number of features. Discussing all of them is beyond the scope of this HOWTO. For further help, please refer to i3's excellent User's Guide.

These are some notable features:

i3status

i3status is a status bar generator which will help you display all sorts of information.

Once you've started i3, you should see a status bar at the bottom of the screen. To start customising it, copy /etc/i3status.conf to ~/.i3status.conf where you can place your changes. The configuration is pretty straightforward. You can comment out any modules you don't want to be displayed:

# order  = "ipv6"
order += "disk /"
# order += "run_watch DHCP"
# order += "run_watch VPN"
order += "wireless wlan4"
#order += "ethernet eth0"
# order += "battery 0"
# order += "cpu_temperature 0"
order += "load"
order += "time"

You can configure modules in the sections below. For example:

time {
        format = "%d-%m-%Y %H:%M"
}

Custom i3status Display

By default i3status functionality is somewhat limited. The fact that the basic configuration offers only a handful of predefined functions does not, however, prevent you from customising it to include your own scripts.

The most basic method of calling i3status is by including the following code in ~/i3.config:

bar {
        status_command i3status
}

i3status will first look for ~/.i3status.conf and if it is not present, it will read /etc/i3status.conf. You can also manually specify the location of the config file:

status_command i3status --config ~/.i3/scripts/i3status.conf

Instead of calling i3status here, you can run a custom script which will start i3status.

status_command /path/to/my/i3-custom-status.sh

i3-custom-status.sh

#!/bin/sh
# shell script to prepend i3status output with some custom stuff

i3status --config ~/.i3status-secondary.conf | while :
do
        read line
        LG=$(setxkbmap -print | grep xkb_symbols | awk -F"+" '{print $2}') 
        pycom=$(/home/user/.i3/pys.py)
        todo=$(task ls | sed -n '4s/[[:blank:]]\+/ /pg' )
        echo "TODO:$todo | LG: $LG | $pycom | $line" || exit 1
done

The following should give you some idea of how you could adapt it for your own needs:

LG=$(setxkbmap -print | grep xkb_symbols | awk -F"+" '{print $2}')

The current keyboard layout is assigned to variable LG.

pycom=$(/home/user/.i3/pys.py)

The output of a Python script is assigned to variable pycon.

todo=$(task ls | sed -n '4s/[[:blank:]]\+/ /pg' )

The most important task of my todo list (TaskWarrior) is assigned to variable todo.

echo "TODO:$todo | LG: $LG | $pycom | $line" || exit 1

The contents of the variables is sent to the status bar followed by default i3status output.

i3status in a Multi-monitor Setup

You can identify your monitors using the 'xrandr' utility (please note that xrandr is not fully supported with versions older than 302.17 of nVidia binary driver):

$ xrandr
Screen 0: minimum 8 x 8, current 3840 x 1200, maximum 16384 x 16384
DVI-I-0 disconnected (normal left inverted right x axis y axis)
VGA-0 disconnected (normal left inverted right x axis y axis)
DVI-I-1 connected 1920x1200+1920+0 (normal left inverted right x axis y axis) 518mm x 324mm
   1920x1200      60.0*+
...
HDMI-0 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 519mm x 324mm
   1920x1200      60.0*+
...

The active connections are identified as DVI-I-1 and HDMI-0. Knowing this we can configure separate outputs for each display:

bar {
        output DVI-I-1
        status_command i3status
        font -*-terminus-bold-*-normal-*-20-*-*-*-*-*-iso8859-1
        colors {
                background: #002b36
                statusline: #586e75
                focused_workspace: $col3 $col2 $col9
                active_workspace: $col3 $col2 $col16
                inactive_workspace: $col3 $col2 $col3
                urgent_workspace: $col11 $col12 $col13
                }
}

bar {
        output HDMI-0
        status_command /home/user/.i3/scripts/i3status_script.sh
        font -*-terminus-bold-*-normal-*-20-*-*-*-*-*-iso8859-1
}

i3 Support

Apart from excellent documentation both for i3 users and developers, you can also get support in the following places:

  • Subscribe to the mailing list (Browse archives)
  • Join i3 IRC channel (#i3 on irc.twice-irc.de)
  • Register with the recently created stackexchange-like FAQ section (Update: As of 20/12/2015 that site is read only. The i3-related questions have moved to a new place - see the next bullet point)
  • i3wm questions on reddit

Sources

 es:howtos:window_managers:i3wm ()