[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!


Diseño del teclado en i3

i3 Window Manager

i3wm no viene con stock Slackware. Si desea instalar este administrador de ventanas de mosaico extremadamente configurable, visite SlackBuilds. Asegúrese de instalar también i3status, que le permitirá mostrar todo tipo de información útil en un panel.

Configuración de la distribución del teclado

i3 no viene con ningún mecanismo de configuración de teclado incorporado. El comando setxkbmap , sin embargo, funciona bien. Si ha configurado el diseño del teclado en todo el sistema y no necesita cambiar entre diseños, no necesita hacer nada. Si desea configurar el diseño solo para i3, puede editar su archivo .xinitrc . Si cambia un entorno gráfico con frecuencia y no desea que se sobrescriba el mapa de teclas, debe modificar /etc/X11/xinit/xinitrc.i3 .

# nano /etc/X11/xinit/xinitrc.i3

Justo antes de la sección Iniciar i3 puede especificar el mapa de teclas deseado (por ejemplo, gb):

setxkbmap gb

Guarde el archivo y ejecute (como usuario estándar) xwmconfig y elija i3 para copiar el archivo xinitrc en su directorio de inicio. Si está en X, es posible que deba reiniciarlo.

Cambiar la distribución del teclado

Si necesita cambiar entre diferentes diseños, puede asignar algunas combinaciones de teclas para realizar esas funciones.

1. Abra el archivo de configuración i3

nano ~/.i3/config

2. Agregue lo siguiente (es solo un ejemplo):

Asigne Mod4 a la clave de Microsoft (utilizo mucho la clave de Microsoft para evitar conflictos con las combinaciones de teclas i3 predeterminadas):

set $ms Mod4
bindsym $ms+d exec setxkbmap de
bindsym $ms+g exec setxkbmap gb

Ahora MS+D y MS+G me permiten cambiar entre los diseños de teclado del Reino Unido y el alemán.

Si normalmente cambia entre dos diseños de teclado y no necesita mostrar el diseño actual en la barra de estado, también puede colocar el siguiente código en su archivo ~ / .i3 / config :
setxkbmap -layout de,gb
setxkbmap -option 'grp:ctrl_alt_toggle'

Esto le permitirá alternar entre los dos diseños usando Ctrl + Alt.

Displaying the Active Layout in the Panel

i3status comes with a lot of built-in functions. Unfortunately, the current keyboard layout is not one of them. For that reason, you need to write a short script to display the layout in the panel. The default i3status invocation is as follows:

bar {
    status_command i3status
}

Here all the built-in functionality is configured in ~/.i3status.conf. We want to add some more on top of that and change it to:

bar {
    status_command /path/to/your/i3script.sh
}

The contents of i3script.sh

#!/bin/bash

# shell scipt to prepend i3status with more stuff

i3status --config ~/.i3status.conf | while :
do
        read line
        LG=$(setxkbmap -query | awk '/layout/{print $2}') 
        echo "LG: $LG | $line" || exit 1
done

The above will display the current keyboard layout before the standard i3status functions. Obviously you can add much more to i3status.

Using JSON output format (colors)

The method above uses the simplest output mode (text only). Although easier to use, it lacks color support. For that, you'll need JSON.

Add the following property in your .i3status.conf

general {
    output_format = i3bar
}

And replace your i3script.sh for the code below. It displays your default language in green (in the example, br) and any other language in red.

#!/bin/bash

i3status --config ~/.i3status.conf | while :
do
    read line
    LG=$(setxkbmap -query | awk '/layout/{print $2}')
    if [ $LG == "br" ]
    then
        dat="[{ \"full_text\": \"LANG: $LG\", \"color\":\"#009E00\" },"
    else
        dat="[{ \"full_text\": \"LANG: $LG\", \"color\":\"#C60101\" },"
    fi
    echo "${line/[/$dat}" || exit 1
done

Sources

  • Originally written by sycamorex
  • Contributions by Anonymous

 es:howtos:window_managers:keyboard_layout_in_i3 ()
Esta traducción es más antigua que la página original y podría estar obsoleta. Ver lo que ha cambiado.