Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add per-device keyboard layout support #2481

Open
fmleo opened this issue Oct 3, 2024 · 2 comments
Open

Add per-device keyboard layout support #2481

fmleo opened this issue Oct 3, 2024 · 2 comments

Comments

@fmleo
Copy link

fmleo commented Oct 3, 2024

Hi! My current setup has 2 keyboards, an external one which I use at home and the laptop one which is used mostly everywhere else.
My suggestion comes from my previous experience with other wlroots compositors:

sway

input type:keyboard {
    xkb_layout br
}

input "6700:39936:SEMICO___USB_Gaming_Keyboard" {
   xkb_layout us
   xkb_options 'compose:ralt'
}

hyprland

device:at-translated-set-2-keyboard {
    kb_layout = br
}

device:6700:39936:SEMICO___USB_Gaming_Keyboard {
   kb_layout = us
   kb_options = 'compose:ralt'
}

As seen in the examples above, in both compositors you can set keyboard options based on the device names returned by swaymsg -t get_inputs and the hyprland equivalent.

#2419 could be relevant to this issue.

@zougloub
Copy link

zougloub commented Nov 4, 2024

The input config is documented to be in [input] (input/...) however get_input_device_section which can get per-device config, is not invoked in the wf::keyboard_t::keyboard_t ctor. Is it possible that calling it then making the option wrappers use section->get_option(...) instead of config.get_option("input/...")would solve the problem?

@soreau
Copy link
Member

soreau commented Nov 6, 2024

Preliminary patch for per-keyboard configuration. @zougloub has confirmed that it works.

soreau added a commit that referenced this issue Nov 6, 2024
This patch checks for additional configuration sections so keyboards can
be matched by name or with udev properties. Running wayfire with '-d' will
log the sections that are being checked, for reference. This allows multiple
keyboards to be configured differently, whereas before, all keyboards used
the common configuration in the [input] section. To be clear, no additional
configuration is required. If no matching configuration section is found for
the device, [input] options will be used.

Fixes #2481.
soreau added a commit that referenced this issue Nov 6, 2024
This patch checks for additional configuration sections so keyboards can
be matched by name or with udev properties. Running wayfire with '-d' will
log the sections that are being checked, for reference. This allows multiple
keyboards to be configured differently, whereas before, all keyboards used
the common configuration in the [input] section. To be clear, no additional
configuration is required. If no matching configuration section is found for
the device, [input] options will be used.

Fixes #2481.
soreau added a commit that referenced this issue Nov 6, 2024
This patch checks for additional configuration sections so keyboards can
be matched by name or with udev properties. Running wayfire with '-d' will
log the sections that are being checked, for reference. This allows multiple
keyboards to be configured differently, whereas before, all keyboards used
the common configuration in the [input] section. To be clear, no additional
configuration is required. If no matching configuration section is found for
the device, [input] options will be used.

Fixes #2481.
soreau added a commit that referenced this issue Nov 6, 2024
This patch checks for additional configuration sections so keyboards can
be matched by name or with udev properties. Running wayfire with '-d' will
log the sections that are being checked, for reference. This allows multiple
keyboards to be configured differently, whereas before, all keyboards used
the common configuration in the [input] section. To be clear, no additional
configuration is required. If no matching configuration section is found for
the device, [input] options will be used.

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

No branches or pull requests

3 participants