¡Esta es una revisión vieja del documento!
Tabla de Contenidos
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.
Changing the Keyboard Layout
If you need to switch between different layouts, you can map some keybindings to perform those functions.
1. Open the i3 config file
nano ~/.i3/config
2. Add the following (it's just an example):
Assign Mod4
to the Microsoft key (I use the Microsoft key a lot to avoid clashes with default i3 keybindings):
set $ms Mod4
bindsym $ms+d exec setxkbmap de bindsym $ms+g exec setxkbmap gb
Now MS+D and MS+G let me switch between the UK and German keyboard layouts.
~/.i3/config
file:setxkbmap -layout de,gb setxkbmap -option 'grp:ctrl_alt_toggle'
This will let you toggle between the two layouts using 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