Sway config for multiple keyboard layouts

I’m unable to find much documentation on using multiple keyboard layouts in Sway. The sway-input manpage says

Multiple layouts can be specified by separating them with commas.

But I’ve tried that, and it doesn’t seem to work. Here’s my current working config for a Dvorak layout:

input * {
        xkb_layout "us"
        xkb_variant "dvorak"

If I try to add another layout, like so

input * {
        xkb_layout "us,gr"
        xkb_variant "dvorak,polytonic"
        xkb_options "grp:lctrl_lshift_toggle"

then I just get the standard US keyboard layout when I restart Sway. I would also like to have the standard US layout as an option, but didn’t want to add the extra complication of two variants of the same layout before getting multiple layouts working. I’ve tried xkb_layout "us,us" and xkb_variant "dvorak," and get the same result. I also get the same result if I separate the xkb configuration options out of that block and preface each one with input * .

Is this not the correct way to configure the keyboard layout?

input type:keyboard xkb_layout us,us
input type:keyboard xkb_variant dvorak,

I used to have this in my config to change between qwerty and dvorak US layouts.

I think I had some issues with swappable layouts and interactions with some gtk programs where the keyboard shortcuts looked at the wrong layout and broke things like copy paste, so I don’t have anything like that anymore.

My current setup has me set one layout for the built-in laptop keyboard and one for my external keyboard which is probably all I needed in the past anyway. (also switched to Workman now)

Here’s that if that interests you:

# Pinky4
input "21582:28724:tamanishi_Pinky4_Keyboard" {
	xkb_layout us
	xkb_options compose:caps

# ThinkPad keyboard
input "1:1:AT_Translated_Set_2_keyboard" {
	xkb_layout us
	xkb_variant workman
	xkb_options compose:caps

I don’t actually own a Reform, just browsing the forums in case I get one someday. I use Sway on a ThinkPad T440p.

As for getting the input identifiers, you can find them here:
swaymsg -t get_inputs (I usually pipe it to less to make it easier to search)

edit: I would recommend also asking for help in the #sway IRC channel on libera if you haven’t already.


Just tried this and it defaults to the standard US layout, unfortunately. I’ll try asking on IRC when I get a chance.

This may help. I’m using this config right now (found on this forum and a bit modified)


input * {
	xkb_file ~/keyboard.xkb


xkb_keymap {
    xkb_keycodes { include "evdev+aliases(qwerty)" };

    xkb_types {
        include "complete"
        virtual_modifiers Hyper;
        type "HYPER" {
            modifiers = Hyper;
            map[Hyper] = Level2;
            level_name[Level1] = "Base";
            level_name[Level2] = "Hyper";

    xkb_compat { include "complete" };

    xkb_symbols {
	include "pc+us+ru:2+inet(evdev)"
        include "compose(menu)"
        include "group(ctrl_alt_toggle)"
        key <RWIN> { [ Hyper_L ] };
        modifier_map Mod5 { <HYPR> };
        key <LEFT> {
            type = "HYPER",
            symbols[Group1] = [ Left, Home ]
        key <RGHT> {
            type = "HYPER",
            symbols[Group1] = [ Right, End ]
        key <RTRN> {
            type = "HYPER",
            symbols[Group1] = [ Return, Insert ]

    // xkb_geometry  { include "pc(pc105)" };

This adds russian layout in my case, and maps Insert key on Hyper+Enter, plus maps Home/End/PgUp/PgDown to arrow keys

How to type home, end, insert, delete on the Reform keyboard? - #6 by artfwo - here is original topic by @artfwo