Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ extern bool g_bAllowDeferredBackend;

namespace gamescope
{
ConVar<std::string> cv_backend( "backend", "auto", "Override the backend selection (auto-detected or specified on the command line)." );

ConVar<VirtualConnectorStrategy> cv_backend_virtual_connector_strategy( "backend_virtual_connector_strategy", VirtualConnectorStrategies::SingleApplication );

/////////////
Expand Down
3 changes: 2 additions & 1 deletion src/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ namespace gamescope
class BackendBlob;
class INestedHints;

extern ConVar<std::string> cv_backend;

namespace VirtualConnectorStrategies
{
enum VirtualConnectorStrategy : uint32_t
Expand Down Expand Up @@ -504,4 +506,3 @@ inline gamescope::IBackend *GetBackend()
{
return gamescope::IBackend::Get();
}

8 changes: 8 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,14 @@ int main(int argc, char **argv)
g_pOriginalDisplay = getenv("DISPLAY");
g_pOriginalWaylandDisplay = getenv("WAYLAND_DISPLAY");

// Allow overriding the selected backend (even the backend
// requested on the command line) in a startup script.
auto backendOverride = parse_backend_name( gamescope::cv_backend.Get().c_str() );
if ( backendOverride != gamescope::GamescopeBackend::Auto )
{
eCurrentBackend = backendOverride;
}

if ( eCurrentBackend == gamescope::GamescopeBackend::Auto )
{
if ( g_pOriginalWaylandDisplay != NULL )
Expand Down