Hey all, hoping someone can help with this random question. I’m running Unreal 5.7 and every time I package a Linux build and output to Steam Deck (devkit games/development builds through the Steam Devkit client), it works great but when the game first launches it always brings up the on-screen keyboard.
I can hit “B” on Steam Deck or tap the keyboard down button to dismiss it and as soon as it goes away my game works great with the controller (and touch screen), but it’s quite annoying that it pops up when it first launches and looks like an error or buggy game.
I have this issue even if I use no menu and no HUD (no widgets, nothing in the viewport so no text input fields).
Now, I can kill the on-screen keyboard completely if I put “export SDL_ENABLE_SCREEN_KEYBOARD=0” in the .sh file directly it works, but I have to do that every time I package. That’s annoying.
If you do not use the virtual keyboard any where in your game. And you do not want to alter the .sh file every time, you could do it trough C++.
By adding this code in MyGame.cpp will make sure to set SDL_ENABLE_SCREEN_KEYBOARD to 0.
#if PLATFORM_LINUX && IS_MONOLITHIC
#include <cstdlib>
struct FSuppressSteamDeckOSK
{
FSuppressSteamDeckOSK()
{
// Check if we are explicitly running on a Steam Deck environment
if (FPlatformMisc::GetEnvironmentVariable(TEXT("SteamDeck")).Equals(FString(TEXT("1"))))
{
// Inject the SDL variable at the absolute earliest point of execution
setenv("SDL_ENABLE_SCREEN_KEYBOARD", "0", 1);
}
}
};
// This forces construction before main() starts
static FSuppressSteamDeckOSK GSuppressSteamDeckOSK;
#endif