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

Import keyboard layout from parent session in nested mode #203

Open
magicalraccoon opened this issue Jun 10, 2021 · 27 comments
Open

Import keyboard layout from parent session in nested mode #203

magicalraccoon opened this issue Jun 10, 2021 · 27 comments
Labels
enhancement New feature or request nested Nested mode via X11/Wayland

Comments

@magicalraccoon
Copy link

magicalraccoon commented Jun 10, 2021

I'm normally a dvorak user, but when I use Gamescope the layout remains qwerty.

The keyboard mapping and layout should be imported from the current de/wm to create a seamless experience. Is this something the project could handle or will I need to get used to gaming with qwerty?

I'm currently using Fedora 33 with Gnome, if that helps.

@emersion
Copy link
Collaborator

This is definitely something gamescope should do. We need to set the correct layout on the wlr_keyboard.

@emersion emersion changed the title Import keyboard layout from desktop environment Import keyboard layout from parent session in nested mode Jul 20, 2021
@emersion emersion added enhancement New feature or request nested Nested mode via X11/Wayland labels Jul 25, 2021
@emersion
Copy link
Collaborator

emersion commented Aug 2, 2021

Workaround: export XKB_DEFAULT_LAYOUT=<layout> before starting gamescope (see man xkeyboard-config for a list of layout names).

@IDeathByte
Copy link

not sure about create new issue, then i post here

as i understand, by default gamescope doesn't import layout from main session
this take us problem with layout switch (en\ru) it didn't changes by switch-key (capslock on my Manjaro KDE config, wayland session if it important)

@itspngu
Copy link

itspngu commented Dec 12, 2021

Workaround: export XKB_DEFAULT_LAYOUT=<layout> before starting gamescope (see man xkeyboard-config for a list of layout names).

I can confirm that this works for gamescope itself, but when using it to run Steam's "Big Picture" mode the latter crashes, which might be a common source of confusion given gamescope's heritage. I can not type "@" in the Big Picture login mask (on German keyboards "@" is produced by holding AltGr and pressing Q) regardless of wether gamescope is running or not.

ValveSoftware/steam-for-linux#5188

@Figuera
Copy link

Figuera commented Mar 2, 2022

I had some success by using XKB_DEFAULT_LAYOUT but that is not enough I also need to set the Layout Variant and setting XKB_DEFAULT_VARIANT do not seems to help.

It might be my bias, but it seems to me that the compositor would benefit greatly from a configuration file. These are stuff that should be easily managed there. I would also like to be able to customize the key bindings. Alt+F4 is fine but I use something else in my Desktop Environment and would be nice to be able to change it somewhere.

@class101
Copy link

I just broke the boot of my Steam Deck :(

Tested the following lines in /etc/environment

XKBLAYOUT=fr
XKBVARIANT=fr
XKB_DEFAULT_LAYOUT=fr
XKB_DEFAULT_VARIANT=fr

Luckily I have been able to boot from an old save, edit revert, and it boots again

I was initially trying to find a solution on why the "fr" layout I set in Desktop mode is not preserved in gaming mode

But is respected in gaming mode IN a open KDE session

I can get my MX Key Mini bluetooth keyboard fr in desktop , fr in gaming mode, it is alwyas us in gaming mode :(

I'd expected to fix it with the variables, but its crashes at boot

@class101
Copy link

class101 commented Nov 2, 2022

Ok my mistake was to setup

XKB_DEFAULT_LAYOUT=fr
XKB_DEFAULT_VARIANT=fr

instead of

XKB_DEFAULT_LAYOUT=fr
XKB_DEFAULT_VARIANT=azerty

This resulted in the following gamescope crash

wlserver: Running compositor on wayland display gamescope-0
wlserver: [backend/headless/backend.c:18] Starting headless backend
xkbcommon: ERROR: Couldnt process include statement for fr(fr)
xkbcommon: ERROR: Abandoning symbols file (unnamed)
xkbcommon: ERROR: Failed to compile xkb_symbols
xkbcommon: ERROR: Failed to compile keymap
Segmentation fault (core dumped)

I have the feeling nobody in here is concerned about the fact, that, defining an environment variable could result in a gamescope crash and so on, a Steam Deck failure to boot, it sounds critical to fix.

@emersion
Copy link
Collaborator

emersion commented Nov 2, 2022

Exiting with an error would be the expected behavior.

@class101
Copy link

class101 commented Nov 2, 2022

There is no possibility to default to US and log a warning ?

@Glog78
Copy link

Glog78 commented Nov 3, 2022

I tried on ADOM:
XKB_DEFAULT_LAYOUT=de XKBLAYOUT=de gamescope -Y -e -W 1824 -H 1026 -r 60 -w 1920 -h 1080 -- %command%

still the keyboard is qwerty instead of qwertz ...

@class101
Copy link

class101 commented Nov 3, 2022

I tried on ADOM:

XKB_DEFAULT_LAYOUT=de XKBLAYOUT=de gamescope -Y -e -W 1824 -H 1026 -r 60 -w 1920 -h 1080 -- %command%

still the keyboard is qwerty instead of qwertz ...

I think you forgot to set XKB_DEFAULT_VARIANT=dsb_qwertz see here for more details ValveSoftware/SteamOS#798

@Glog78
Copy link

Glog78 commented Nov 3, 2022

I tried on ADOM:
XKB_DEFAULT_LAYOUT=de XKBLAYOUT=de gamescope -Y -e -W 1824 -H 1026 -r 60 -w 1920 -h 1080 -- %command%
still the keyboard is qwerty instead of qwertz ...

I think you forgot to set XKB_DEFAULT_VARIANT=dsb_qwertz see here for more details ValveSoftware/SteamOS#798

Even my solution worked once i switched the steam language to german too ...

@VladislavNekto
Copy link

But, hey, what if i type in something like Cyrillic, that means, i need possibility to change layout, not just set russian when start

@IDdozer
Copy link

IDdozer commented Jan 16, 2023

But, hey, what if i type in something like Cyrillic, that means, i need possibility to change layout, not just set russian when start

My launch parameters: XKB_DEFAULT_LAYOUT=ru,us XKB_DEFAULT_OPTIONS=grp:lctrl_lshift_toggle gamemoderun gamescope -e -f -H 1080 -O card0-DVI-D-1 -- %command%

left ctrl + left shift switches language

@VoodaGod
Copy link

I tried on ADOM:
XKB_DEFAULT_LAYOUT=de XKBLAYOUT=de gamescope -Y -e -W 1824 -H 1026 -r 60 -w 1920 -h 1080 -- %command%
still the keyboard is qwerty instead of qwertz ...

I think you forgot to set XKB_DEFAULT_VARIANT=dsb_qwertz see here for more details ValveSoftware/SteamOS#798

Even my solution worked once i switched the steam language to german too ...

have you had any luck without changing the steam language? i've set up

XKB_DEFAULT_LAYOUT=de
# initially without a variant, also tested with
XKB_DEFAULT_VARIANT=deadgraveacute

in /etc/environment but gamescope still is using qwerty for me :(

@Glog78
Copy link

Glog78 commented Feb 19, 2023

I tried on ADOM:
XKB_DEFAULT_LAYOUT=de XKBLAYOUT=de gamescope -Y -e -W 1824 -H 1026 -r 60 -w 1920 -h 1080 -- %command%
still the keyboard is qwerty instead of qwertz ...

I think you forgot to set XKB_DEFAULT_VARIANT=dsb_qwertz see here for more details ValveSoftware/SteamOS#798

Even my solution worked once i switched the steam language to german too ...

have you had any luck without changing the steam language? i've set up

XKB_DEFAULT_LAYOUT=de
# initially without a variant, also tested with
XKB_DEFAULT_VARIANT=deadgraveacute

in /etc/environment but gamescope still is using qwerty for me :(

i didn't needed to switch back. i don't mind my client to be in german too but yeah it's only half of a solution

@pvdrz
Copy link

pvdrz commented Mar 6, 2023

👋 I have a related issue with the latam keyboard layout. What happens is that gamescope doesn't recognize the < key at all. This key is called <LSGT> and it is assigned the 94 code. All the other keys and mappings of the layout work correctly when setting XKB_DEFAULT_LAYOUT=latam but for some odd reason this single key doesn't work. I tried setting XKB_DEFAULT_MODEL to both pc104 and pc105 without success either.

Has anyone experienced something similar or has any idea on how to debug this?

@okfruit
Copy link

okfruit commented Jun 16, 2023

What happens is that gamescope doesn't recognize the < key at all

Same here

@Chris2000SP
Copy link

I had that issue with a Steam Linux native game "X4 Foundations" using gamescope under wayland. That workaround with "XKB_DEFAULT_LAYOUT=de" in the Steam Launch option for X4 did work. Thanks for that. I dunno if that matters on Proton games too?

@murlakatamenka
Copy link

@Chris2000SP so you say if you launch Steam with XKB_DEFAULT_LAYOUT set, gamescope does properly inherit it and works as it should keyboard shortcuts wise, am I correct?

@Chris2000SP
Copy link

Chris2000SP commented Jul 9, 2023

If i do not set this, use wayland and gamescope, i get "EN" querty layout in game. Here is what i set in X4 Foundations Launch Options:
AMD_VULKAN_ICD=RADV XKB_DEFAULT_LAYOUT=de /usr/bin/gamescope -f -W 3840 -H 2160 -- /usr/bin/mangohud %command%
With "XKB_DEFAULT_LAYOUT=de" fixes the wrong keyboard layout.
I have Arch Linux and KDE by the way.

EDIT:
If i login to Xorg i do not have that problem but i can do without gamescope in Xorg.

@brndd
Copy link

brndd commented Nov 7, 2023

👋 I have a related issue with the latam keyboard layout. What happens is that gamescope doesn't recognize the < key at all. This key is called <LSGT> and it is assigned the 94 code. All the other keys and mappings of the layout work correctly when setting XKB_DEFAULT_LAYOUT=latam but for some odd reason this single key doesn't work. I tried setting XKB_DEFAULT_MODEL to both pc104 and pc105 without success either.

Has anyone experienced something similar or has any idea on how to debug this?

This problem should be fixed after this commit makes its way downstream to you: #1009

@Gpinchon
Copy link

On OpenSUSE adding a export_kb_layout.sh to /etc/profile.d/ with this content fixes the issue

export XKB_DEFAULT_LAYOUT=fr
export XKB_DEFAULT_VARIANT=azerty

@bljordan
Copy link

bljordan commented Nov 21, 2023

I don't have a solution, but just adding another report of the issue.

I am in hyprland and trying the solutions above to no avail.

I am trying to set the equivalent of kb_options = caps:numlock by setting these env vars: XKB_DEFAULT_OPTIONS=caps:numlock or XKBOPTIONS=caps:numlock.

@class101
Copy link

class101 commented Nov 23, 2023

I don't have a solution, but just adding another report of the issue.

I am in hyprland and trying the solutions above to no avail.

I am trying to set the equivalent of kb_options = caps:numlock by setting these env vars: XKB_DEFAULT_OPTIONS=caps:numlock or XKBOPTIONS=caps:numlock.

Few things to try, use double quotes to prevent : from being interpreted

Else

Try to add in /etc/X11/xorg.conf.d/00-keyboard.conf

setxkbmap -option "caps:numlock"

To note that based on ArchWiki, setxkbmap is not persistent for external keyboards except if you specify the keyboard device Id, so it is possible that you can do it with setkbdmap manually without a xinit like execution

See Using setxkbmap

@Gpinchon
Copy link

Gpinchon commented Nov 29, 2023

I am in hyprland and trying the solutions above to no avail.

Yeah, it seems that it doesn't work anymore with the version 3.13.3-1.1, plus it's very buggy, The Sims 3 appears squished now... Looking as to how to restore 3.12.

[EDIT] I was adding XKB_DEFAULT_LAYOUT=fr XKB_DEFAULT_VARIANT=azerty to the launch command of The Sims 3 and it was messing with layout very oddly, typing text used AZERTY, but the keys were mapped as if it was using QWERTY (like, WASD to move the camera instead of ZQSD), removing the launch options to keep only the modified env works...

@Martan404
Copy link

This is a big problem on the Steam Deck. When connecting a keyboard to the in Gamemode it will use US qwerty layout with no way of changing it in Gamemode. Works fine in Desktop mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request nested Nested mode via X11/Wayland
Projects
None yet
Development

No branches or pull requests