Switch the keyboard layout for the current X session with setxkbmap, using US English and Turkish Q as the example pair. The switch is manual and explicit by choice: no i3 shortcut, no helper script, no automatic switching. A shortcut is easy to trigger by accident while coding with symbols and punctuation, so a plain command is preferred. The change is immediate and affects all running apps (terminal, Firefox, VS Code, and so on), but resets after logout or reboot.
Quick reference
setxkbmap -query # show the current layout
setxkbmap us # switch to US English
setxkbmap tr # switch to Turkish QCheck the current layout
Query the active layout for the session.
setxkbmap -queryrules: evdev
model: pc105
layout: usThe layout line is the active layout (us or tr here).
Switch layout
Set the layout, then re-query to confirm the change took effect.
# Turkish Q
setxkbmap tr
setxkbmap -query
# back to US English
setxkbmap us
setxkbmap -queryThe switch is immediate, applies to every app in the session, and needs no reboot. It resets on logout, reboot, or a fresh startx, so re-run the command if the layout reverts.
Install setxkbmap if missing
A minimal Arch install may not ship setxkbmap. Check whether it exists, then install it if needed.
which setxkbmap
# Arch
sudo pacman -S --needed xorg-setxkbmap