52

I am using 'i3` window manager on Fedora 25. I've already uninstalled GNOME Desktop. I want to change keyboard layout and set it to languages other than English, and desirably also to set it as Alt+Shift shortcut for easy access.

5 Answers 5

74

You can use setxkbmap:

setxkbmap -layout us,de
setxkbmap -option 'grp:alt_shift_toggle'

Just change the keyboard layouts us,de to what ever you prefer. If you want i3 to run these commands on startup, just add them to your config file "~/.i3/config" and prepend "exec".

exec "setxkbmap -layout us,de"
exec "setxkbmap -option 'grp:alt_shift_toggle'"

Checkout http://docs.slackware.com/howtos:window_managers:keyboard_layout_in_i3

11
  • 3
    Thanks, is it possible to add an indication of it on i3bar as well?
    – user373230
    Dec 1, 2016 at 14:07
  • 3
    Yes, it is. See docs.slackware.com/…
    – tomsal
    Jan 13, 2017 at 10:28
  • this just doesn't work, nothing changes when using alt-shift =(
    – Yurii
    Aug 19, 2017 at 16:59
  • 2
    Have you tried using the setxkbmap commands from the command line (without the i3 config)? What does it say when you run setxkbmap -query?
    – tomsal
    Aug 20, 2017 at 19:50
  • 1
    Beware that due to a bug, if you use Alt+Shift to swtich, all other shortcuts containing this sequence would be disabled (like tty mode shortcut). gitlab.freedesktop.org/xorg/xserver/issues/258 Mar 23, 2020 at 11:54
7

For me only the following worked in Manjaro + i3:

exec_always "setxkbmap -model pc104 -layout us,ru,ua -variant ,, -option grp:alt_shift_toggle"

I specified this in ~/.config/i3/config file

1
  • 1
    Be sure to find out which -model you got by running setxbmap -query in your terminal prior. Mine turned out to be pc105. Worked for me.
    – rtviii
    Nov 9, 2020 at 8:55
7

It indeed seems that everything must be written inside a single command in the i3 config file in order for setxkbmap to work as desired, at least on Arch linux.

Example: English + Czech qwerty keyboard, ALT+SHIFT toggle:

exec "setxkbmap -option 'grp:alt_shift_toggle' -layout us,cz -variant ,qwerty"
0

"exec setxkbmap" didn't work for me. Through frustrated keyboard smashing, I accidentally pulled up the display settings (Super+D since I installed from Regolith-desktop), and from there I could open up "Region & Language" to set the keyboard layout. I guess i3 "Ubuntu" keyboard layout settings are store separate from "Kubuntu" keyboard layout settings.

0
0

insert into your .config/i3/config

# switch keymap

bindsym $mod+Ctrl+Shift+F11 exec setxkbmap -layout ch -variant fr
bindsym $mod+Ctrl+Shift+F12 exec setxkbmap -layout ru -variant phonetic

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy