Skip to content

Conversation

not-my-profile
Copy link

Users that generally use a custom keyboard layout via xkb_file likely want to reset it to us for other devices that pretend to be keyboards like security keys, barcode scanners or shortcut remotes. For example:

input 10429:2395:UGTABLET_Artist_Pro_16_(Gen2) {
  xkb_layout us
}
input type:keyboard {
  xkb_file ~/.config/sway/my_weird_layout.xkb
}

Such configuration however didn't work because the config merge logic merged both commands together and then the xkb_file took precedence.

Fixes #8329.

Users that generally use a custom keyboard layout via xkb_file
likely want to reset it to `us` for other devices that pretend to be
keyboards like security keys, barcode scanners or shortcut remotes.
For example:

    input 10429:2395:UGTABLET_Artist_Pro_16_(Gen2) {
      xkb_layout us
    }
    input type:keyboard {
      xkb_file ~/.config/sway/my_weird_layout.xkb
    }

Such configuration however didn't work because the config merge logic
merged both commands together and then the xkb_file took precedence.

Fixes swaywm#8329.
Copy link
Member

@kennylevinsen kennylevinsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you should already be able to do:

input 10429:2395:UGTABLET_Artist_Pro_16_(Gen2) {
  xkb_file -
  xkb_layout us
}
input type:keyboard {
  xkb_file ~/.config/sway/my_weird_layout.xkb
}

This does seem to lack documentation though.

EDIT: Submitted early.

free(dst->xkb_file);
dst->xkb_file = src->xkb_file ? strdup(src->xkb_file) : NULL;
dst->xkb_file_is_set = dst->xkb_file != NULL;
dst->xkb_layout = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xkb_file overrides not just xkb_layout, but also xkb_model, xkb_options, xkb_rules, and xkb_variant.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but I would have assumed that these other options don't take effect if xkb_file is set and xkb_layout isn't. Looking at sway_keyboard_compile_keymap that does seem to be the case?

In any case I think it would be nice to log or display an error in case conflicting xkb_ options are specified in the same config block. But I'd defer that to another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

xkb_file should accept an empty value
2 participants