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

SteamOS connected keyboard ignores settings #798

Open
KS-HTK opened this issue Jun 17, 2022 · 33 comments
Open

SteamOS connected keyboard ignores settings #798

KS-HTK opened this issue Jun 17, 2022 · 33 comments

Comments

@KS-HTK
Copy link

KS-HTK commented Jun 17, 2022

Your system information

  • Steam client version (build number or date): 1654818235
  • Distribution (e.g. Ubuntu): SteamOS Holo
  • SteamOS version: 3.2 (Build: 20220526.100)
  • Opted into Steam client beta?: Yes
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

I connected a keyboard/mouse combo to usb c (lenovo keyboard with trackpoint). Everything worked as expected. Keyboard can type mouse is useable, scrolling works. But the issue is that the keyboard is in the english layout. My steamdecks on-screen-keyboard (osk) is set to german, desktop mode is set to german-neo2. And in desktop mode the keyboard uses the neo2 layout, as expected. But in gaming mode any layout set in the settings is ignored for the physikal keyboard. This is only mildly annoying for german as ö ä ü ß dont exist on english layouts. But it sure must be frustrting if your primary language uses, for example, the greek alphabet, as those can only be typed with the osk.

Steps for reproducing this issue:

  1. connect a physikal keyboard to the steamdeck
  2. set any layout in the settings
  3. observe the osk changing and the physikal keyboard still using english layout

related issue:


A Workaround has been found:

To set the keyboard layout for gaming mode edit /etc/environment file.
Example:

XKB_DEFAULT_MODEL=pc104
XKB_DEFAULT_LAYOUT=de
XKB_DEFAULT_VARIANT=neo
XKB_DEFAULT_OPTIONS=caps:none

It is sufficient to only set layout

For a list of available values use

  • localectl list-x11-keymap-models
  • localectl list-x11-keymap-layouts
  • localectl list-x11-keymap-variants [layout]
  • localectl list-x11-keymap-options
@kisak-valve kisak-valve transferred this issue from ValveSoftware/steam-for-linux Jun 17, 2022
@class101
Copy link

Same problem Steam Deck with Logitech Mx Keys Mini Bluetooth. In KDE, works, in SteamOS it does not respect keyboard layout.

Issue has been reported in SteamOS in 2017 and your release today a device carrying the same problem.

Valve Time

@KS-HTK
Copy link
Author

KS-HTK commented Oct 25, 2022

Same problem Steam Deck with Logitech Mx Keys Mini Bluetooth. In KDE, works, in SteamOS it does not respect keyboard layout.

Issue has been reported in SteamOS in 2017 and your release today a device carrying the same problem.

Valve Time

I could not find the issue from 2017, what issue number is it?
It is most likely not the same Issue as the underlying Distribution has changed. In 2017 SteamOS was built on Debian (Buster if I am not mistaken) now it is built on ArchLinux.

@class101
Copy link

class101 commented Oct 25, 2022

If you search SteamOS keyboard layout you will find a number of reports

https://steamcommunity.com/groups/steamuniverse/discussions/1/1496741765143025641/
ValveSoftware/steam-for-linux#5188

The issues are clearly connected imo because the users are reporting the exact same behavior we notice, works in Desktop mode, fail in SteamOS to en_US

and i think it has nothing to do with the distribution but SteamOS (Steam with steamos launcher arguments)

I'm even more disappointed when I see the upcoming SteamOS 3.3 changelog not even mentioning a thing about it

@kisak-valve whats happening with this issue ?

Edit: Yet I found a workaround which is to run the gaming mode from command line, but it is not perfect because it does not closes the KDE session, ideally gaming mode is exclusive full screen, without an opened KDE session and with the correct desktop layout

@class101
Copy link

class101 commented Oct 25, 2022

@KS-HTK

If you need to tinker and possibly find a better workaround you could open Steam Gaming mode Windowed by running

´´´
bash /home/deck/.local/share/Steam/steam.sh -steamdeck -steamos3 -steampal -steamdeck -gamepadui
´´´

I will let you know if I find anything better

@KS-HTK
Copy link
Author

KS-HTK commented Oct 25, 2022

Thank for the workaround and linking the original issue. Seems they are somewhat related. More testing is required to figure out why the keyboard is not set correctly, but I have the suspicion that it is only set in the KDE session and not as a system setting. This would result in it only being used when Steam is launched from the session.

@class101
Copy link

class101 commented Oct 27, 2022

Hey

@KS-HTK

Made some advance on the subject.

I think the connected issue is ValveSoftware/gamescope#203

But I advise you, your Steam Deck may fail to boot

IIf you want to give a try, I posted here instructions on how to recover from this boot failure

I think because gamescope initiate the session with teh keyboard to US, ours is too in gaming mode because the gaming mode layout is respected when lanched windowed in a kde session, must be at the level of gamescope running outside a desktop session at the boot, it is the very first process to initiate the gaming mode session

:)

@KS-HTK
Copy link
Author

KS-HTK commented Oct 28, 2022

So this is basically what I figured but did not want to test on the Deck itself.
Tried to install HoloIso on my tower but have not succeeded yet. Wanted to test there.
Did not want to test on the Deck because I did not want to go trough the hassel of reinstalling the OS. So thank you for the tip with the system backups.

I had a similar issue on Arch a while back where the login manager did not use my set keyboard layout. I figured it is only loaded after session starts. (In this case the kde session)
So I wanted to try set XKBLAYOUT in /etc/default/keyboard. Or using dpkg-reconfigure if available.
Also worth a try would be setxkbmap in .bashrc but i am unsure if this gets loaded in the gaming mode.

@KS-HTK
Copy link
Author

KS-HTK commented Oct 28, 2022

OK, so after knowing how to recover without to much hassle I did some testing. Here are some results:
localectl shows n/a as keymap, I don't know why. But using localectl set-keymap has no effect on the gaming mode anyway and setting it in desktop is not the issue

/etc/default/keyboard is ignored by gaming mode. Did not test if desktop uses it.

But what does work is /etc/environment
@class101 you were setting incorrect key names which resulted in not being able to boot.
To set neo2 you can add these two lines to /etc/environment

XKB_DEFAULT_LAYOUT=de
XKB_DEFAULT_VARIANT=neo

This will set the keyboard layout for gaming and desktop mode. Although desktop mode should get set by KDE's settings with a higher priority.

Available values can be found with:

  • localectl list-x11-keymap-models
  • localectl list-x11-keymap-layouts
  • localectl list-x11-keymap-variants [layout]
  • localectl list-x11-keymap-options

For more info see the ArchWiki


I have not tested the following, but it should work.
Also available are XKB_DEFAULT_MODEL and XKB_DEFAULT_OPTIONS

To configure multiple layouts:

XKB_DEFAULT_LAYOUT=de,de,en
XKB_DEFAULT_VARIANT=neo,,us

TL;DR

It is possible to set the Keyboard layout for connected keyboards in /etc/environment

This issue is thereby now semi resolved.
It would be great if there is an option in gaming mode setting to set the keyboard layout of a connected keyboard without having to manually set them in /etc/environment as a typo there will likely result in a boot error.

@class101
Copy link

class101 commented Oct 30, 2022

Yes my initial error was

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)

To test the layout/variants without risking to crash gamescope I'm running the following command in a KDE session

XKBLAYOUT=fr XKBVARIANT=azerty XKB_DEFAULT_LAYOUT=fr XKB_DEFAULT_VARIANT=azerty gamescope --generate-drm-mode fixed --xwayland-count 2 -w 1280 -h 800 --default-touch-mode 4 --hide-cursor-delay 3000 --max-scale 2 --fade-out-duration 200 -e -R /run/user/1000/gamescope.G596Hrd/startup.socket -T /run/user/1000/gamescope.G596Hrd/stats.pipe -O *,eDP-1 --cursor-hotspot 5,3 --cursor /usr/share/steamos/steamos-cursor.png

But yeah I think the only place we could inject env variable to gamescope is /etc/environment, it doesn't load a bash in login mode and so on, not reading anything from /etc/bash.bashrc

This is great, it looks like to work now as intended :)

PS :

I set XKBLAYOUT and XKBVARIANT too but in bashrc, it works when you open a new shell Ctrl+Alt+F4|F5|F6

@class101
Copy link

class101 commented Nov 2, 2022

Hey @KS-HTK

Have you searched about enabling wake up on Bluetooth ?

I searched around but unfortunately, enabling wake on Bluetooth on the system has not the expected behavior; the Steam Deck automatically wakes up after a suspend haha :D

I'm digging into this actually and I believe it requires a few udev rules to ignore some events and has you are experienced we can maybe find something together

I know this is requested by a few users but currently no solution is found;, well I will dig into I think because I also need this so I leave here my steam if you want to communicate here and not be off topic in the ticket : class101 :)

@octoxan
Copy link

octoxan commented Feb 16, 2023

Just wanted to say this fixed it for me as well, this really needs to be documented, or automated.

@Fuziius
Copy link

Fuziius commented Aug 28, 2023

Hey, I have the same problem. However, I do not know at all, with such commands, Linux or anything else. But I would also like to use the German keyboard layout ingame.
Can someone possibly explain to me step by step how and where I have to use these commands?
Preferably so that it really understands every idiot? haha

@eponra
Copy link

eponra commented Aug 30, 2023

PXL_20230830_090549311~3
@Fuziius

Im sorry to say that i think its still bugged.

What every other post here is missing btw, is that you first have to go to desktop mode, and to

  • System Settings -> Input Devices -> Layouts

and add the layout that you want (in yours and mine its de german).

Else the settings in the environment seem to have no effect.

If you then add these lines in etc/environment, you can reboot your device and as long as you're in desktopmode, you will have the de layout (so QWERTZ instead of QWERTY).

BUT in gaming mode that layout changed for me to "XLCWK"-layout. So, whatever that is, its not useable.
I dont need the external keyboard at all, im just testing this for my gf. But as long as that is not fixed, im not touching hers. ;-)

@class101
Copy link

class101 commented Aug 30, 2023

@eponra

By deduction, we knows gamescope reads from /etc/environment so if you don't notice changes, it is wrongly edited ( what is wrong then is the problem )

Ideally , get ride of the environment file in the formula and set the variables before calling gamescope on command line, I showed a few examples in the previous posts if I remember

A mistake in the environment file can make your system unbootable

@eponra
Copy link

eponra commented Aug 30, 2023

@class101 i notice changes. :-)
The changes i notice is that its not loading a proper layout.
Correction: in gamemode(!). Its loading the proper layout when i switch to desktop, and the wrong one again if i go back to gamemode.

Ninjaedit: i saw in your posts that you added
XKBLAYOUT=fr XKBVARIANT=azerty

and then

XKB_DEFAULT_LAYOUT=fr XKB_DEFAULT_VARIANT=azerty

but to what seems to be a bash-command?

Maybe i should try these too...

@Fuziius
Copy link

Fuziius commented Aug 31, 2023

@eponra
I only changed my layout in the system settings and that was enough to keep my keyboard layout in-game at the german (QWERTZ) one, as long as I stayed in the Desktop-Mode. Only the in-game layout at the Game-Mode keeps switching back to the english (QWERTY) one.

I can´t finde the etc/environment. I searched for it in Dolphin. But I just can´t find it at all.

Where can I find it?

Did u fix ur keyboard layout in Game-Mode?

@KS-HTK
Copy link
Author

KS-HTK commented Sep 1, 2023

@Fuziius
In the first Post to this issue I documented the workaround that worked for me (using neo2 instead of QWERTZ).
If the file does not exist you can simply create it using touch /etc/environment. Please make sure it does not exist. You wrote etc/environment but the Path should be /etc/environment. To make sure the file does not exist you can use ls /etc/ | grep environment if no output is returned go ahead and create the file with the contents you need.
See my first post to find valid values for the settings.

@cryptogeek13
Copy link

Valve please, you are selling me a dock but don't support changing the layout of a connected keyboard? This issue is open for so long now and a really basic feature missing for your dock to be usable. I'm getting kinda frustrated by this.

@Stoffss
Copy link

Stoffss commented Sep 19, 2023

Pls, this is quite huge for us non-native english speaking countries.... would be so easy to fix Valve!

Thank you for the work around until... makes life easier for my kids!

@Stoffss
Copy link

Stoffss commented Sep 19, 2023

TL;DR

It is possible to set the Keyboard layout for connected keyboards in /etc/environment

This issue is thereby now semi resolved. It would be great if there is an option in gaming mode setting to set the keyboard layout of a connected keyboard without having to manually set them in /etc/environment as a typo there will likely result in a boot error.

Could someone with knowledge create a Decky Loader plugin for this?

@tonivj5
Copy link

tonivj5 commented Sep 30, 2023

TL;DR

It is possible to set the Keyboard layout for connected keyboards in /etc/environment

This issue is thereby now semi resolved. It would be great if there is an option in gaming mode setting to set the keyboard layout of a connected keyboard without having to manually set them in /etc/environment as a typo there will likely result in a boot error.

Could someone with knowledge create a Decky Loader plugin for this?

@Stoffss like this one? https://github.com/Loidbae/SDH-KLang 😉

@eponra
Copy link

eponra commented Oct 7, 2023

Could someone with knowledge create a Decky Loader plugin for this?

@Stoffss like this one? https://github.com/Loidbae/SDH-KLang 😉

@tonivj5 This has sadly been discontinued a while ago.

@RodoMa92
Copy link

Upping this issue, another one affected by this. Luckily it is easily workaroundable, but still.

@alpasy
Copy link

alpasy commented Nov 17, 2023

For Russian i used:

XKB_DEFAULT_LAYOUT=us,ru
XKB_DEFAULT_OPTIONS=grp:ctrl_shift_toggle
XkbLayout=us,ru
XkbOptions=grp:ctrl_shift_toggle

Not sure which ones worked, default or not, but switching layouts with Ctrl+Shift works in gaming mode now too.
Valve plz

@Martan404
Copy link

We need a fix for this. Valve needs to implement something to check the default Desktop Mode keyboard layout and use it in Game Mode as well or just allow us to change layout directly from Game Mode.

It's a huge problem that we can not use our keyboards in Game Mode properly

@Rudokhvist
Copy link

I am affected by this issue too. We need ability to set keyboard shortcut for changing layout from physical keyboard in gaming mode without need to tinker with config files.

@AlexFolland
Copy link

Is there a workaround for Dvorak? I have multiple games with all my binds set to Dvorak binds and can't reasonably switch between qwerty and Dvorak binds, as the games in question store bind settings in Steam Cloud.

I'm expecting it would be this in /etc/environment, but that file is owned by root, which means it'll be overwritten with each update:

XKB_DEFAULT_LAYOUT=us
XKB_DEFAULT_VARIANT=dvorak

I tried these environment variables in the Steam game command line, but that didn't have any effect. I also heard that if /etc/environment has any "wrong" values for these variables, the system won't boot, and I don't want to risk that.

Can we please get a dropdown in the keyboard settings for physical keyboard layout so I can choose Dvorak?

@Martan404
Copy link

Martan404 commented May 8, 2024

It's guessing it's related to this issue ValveSoftware/gamescope#203 and the fact that we can not change the keyboard layout inside Gamemode at all.

@KS-HTK
Copy link
Author

KS-HTK commented May 8, 2024

It's guessing it's related to this issue ValveSoftware/gamescope#203 and the fact that we can not change the keyboard layout inside Gamemode at all.

This was already mentioned as a simple search would have shown.
See this Comment above.

@AlexFolland
Copy link

AlexFolland commented May 9, 2024

Yes, so back to my questions:

  • Is there a workaround for Dvorak?
    • Any viable workaround that satisfactorily answers this question must not involve editing a file owned by root (which will be overwritten with each update) or risking boot prevention.
  • Can we please get a dropdown in the keyboard settings for physical keyboard layout so I can choose Dvorak?

See my comment above for additional rationale for asking these questions.

@KS-HTK
Copy link
Author

KS-HTK commented May 10, 2024

@AlexFolland to answer some of you're Questions:

Yes, so back to my questions:

* Is there a workaround for Dvorak?

Yes, the same workaround I use for Neo2 should also work for Dvorak.

  * Any viable workaround that satisfactorily answers this question must not involve editing a file owned by root (which will be overwritten with each update) or risking boot prevention.

Well then you might not find the workaround viable as it may prevent booting, which can be solved via the recovery if it does.

* Can we please get a dropdown in the keyboard settings for physical keyboard layout so I can choose Dvorak?

Thats what this issue is for, but i do not expect anybody from Valve to answer to that Question anytime soon, as this Issue is already 2 Years old.

I do also not agree that a viable workaround should not include any risk of boot prevention, as this is a recoverable problem and we are talking about workarounds, not solutions. For a permanent solution to this issue I do agree that it should not include that risk for the end user, but if you really want to use a different keyboard layout while no permanent solution is in place the minor risk of a temporary boot issue should not be regarded as a no go. Like stated before it can be recoverd without reinstalling the whole system.

@AlexFolland
Copy link

Thanks for your response. However, one oversight seems to be that /etc/environment is still owned by root and will therefore be subject to overwriting every time the system updates. Do you have a workaround that you've employed for that?

@alpasy
Copy link

alpasy commented May 11, 2024

Thanks for your response. However, one oversight seems to be that /etc/environment is still owned by root and will therefore be subject to overwriting every time the system updates. Do you have a workaround that you've employed for that?

It doesn't though. I fixed this issue on my deck via /etc/environment in November 2023, and after numerous system updates it stays fixed.

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

No branches or pull requests