hyprwm / Hyprland

Hyprland is a highly customizable dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
18.13k stars 754 forks source link

Two different keyboard layouts messes up binds #3695

Closed lcnbr closed 8 months ago

lcnbr commented 8 months ago

Hyprland Version

branch at commit 015664eb4cde5ab93cfacbfd8c2e831eeb876634

Bug or Regression?

Bug

Description

I have set a different keyboard layout for my laptop and my external keyboard. However, when using the keyboard shortcuts, hyprland disregards the layout of the external keyboard. For example, if I want to open drun, I have it set to meta+r. However I have to type meta+s on my physical keyboard (as if I had not set a layout on that keyboard). Other applications all recognise the right keys though.

How to reproduce

Set different layout for input and external keyboard. E.g.

input {

                 kb_layout = us
            kb_variant = colemak_dh_iso
            kb_model =
            kb_options =
            kb_rules =

            follow_mouse = 1

            touchpad {
                natural_scroll = true
            }

            sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}

device:olkb-planck {
   kb_layout = ch
   kb_variant = fr}

Crash reports, logs, images, videos

This is the output of hyprctl devices:

mice:
    Mouse at 27add70:
        logitech-usb-receiver-mouse
            default speed: 0.00000
    Mouse at 2798b70:
        logitech-usb-receiver-consumer-control-1
            default speed: 0.00000
    Mouse at 2779890:
        logitech-usb-receiver-1
            default speed: 0.00000
    Mouse at 2719e90:
        pixa3854:00-093a:0274-mouse
            default speed: 0.00000
    Mouse at 26599d0:
        pixa3854:00-093a:0274-touchpad
            default speed: 0.00000
    Mouse at 1d0b490:
        imexps/2-generic-explorer-mouse
            default speed: 0.00000
    Mouse at 460c120:
        mx-master-2s-mouse
            default speed: 0.00000
    Mouse at 30192f0:
        olkb-planck-mouse
            default speed: 0.00000

Keyboards:
    Keyboard at 2725250:
        video-bus
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 26ec720:
        power-button
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 28d3ef0:
        lenovo-thinkpad-thunderbolt-3-dock-usb-audio
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 290da00:
        logitech-usb-receiver
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 2947210:
        logitech-usb-receiver-consumer-control
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 2981430:
        logitech-usb-receiver-system-control
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 29ba370:
        laptop-camera:-laptop-camera
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 29f4d10:
        at-translated-set-2-keyboard
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 2fce8a0:
        mx-master-2s-keyboard
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 1d09130:
        olkb-planck-keyboard
            rules: r "", m "", l "us", v "colemak_dh_iso", o ""
            active keymap: English (Colemak-DH ISO)
            main: no
    Keyboard at 267e4e0:
        olkb-planck
            rules: r "", m "", l "ch", v "fr", o ""
            active keymap: French (Switzerland)
            main: yes

Tablets:

Touch:

Switches:
    Switch Device at 252e2d0:
        Lid Switch
vaxerski commented 8 months ago

you can bind by keycodes?

DiskyToy commented 8 months ago

I'm not sure if this really is a bug. The first layout defined in the input section will be the one used for binds. (see here https://wiki.hyprland.org/Configuring/Uncommon-tips--tricks/#switchable-keyboard-layouts)

Try binding with keycodes instead of the actual key. (like described here https://wiki.hyprland.org/Configuring/Binds/#uncommon-syms--binding-with-a-keycode)

lcnbr commented 8 months ago

How could I make it so it actually looks at the key finally emitted? In my case, the physical keyboard is programmed with qmk to actually output the right letter when in swiss layout in software. But I would like my laptop keyboard to be colemak..

lcnbr commented 8 months ago

In my case the keycodes for the same letter are actually different based on the keyboard

xofyarg commented 8 months ago

I think this is tracked in #1881.

lcnbr commented 8 months ago

Yes that is the same issue! I'll close it in favor of that one.