File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ extern bool g_bAllowDeferredBackend;
1515
1616namespace gamescope
1717{
18+ ConVar<std::string> cv_backend ( " backend" , " auto" , " Override the backend selection (auto-detected or specified on the command line)." );
19+
1820 ConVar<VirtualConnectorStrategy> cv_backend_virtual_connector_strategy ( " backend_virtual_connector_strategy" , VirtualConnectorStrategies::SingleApplication );
1921
2022 // ///////////
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ namespace gamescope
3131 class BackendBlob ;
3232 class INestedHints ;
3333
34+ extern ConVar<std::string> cv_backend;
35+
3436 namespace VirtualConnectorStrategies
3537 {
3638 enum VirtualConnectorStrategy : uint32_t
@@ -504,4 +506,3 @@ inline gamescope::IBackend *GetBackend()
504506{
505507 return gamescope::IBackend::Get ();
506508}
507-
Original file line number Diff line number Diff line change @@ -880,6 +880,14 @@ int main(int argc, char **argv)
880880 g_pOriginalDisplay = getenv (" DISPLAY" );
881881 g_pOriginalWaylandDisplay = getenv (" WAYLAND_DISPLAY" );
882882
883+ // Allow overriding the selected backend (even the backend
884+ // requested on the command line) in a startup script.
885+ auto backendOverride = parse_backend_name ( gamescope::cv_backend.Get ().c_str () );
886+ if ( backendOverride != gamescope::GamescopeBackend::Auto )
887+ {
888+ eCurrentBackend = backendOverride;
889+ }
890+
883891 if ( eCurrentBackend == gamescope::GamescopeBackend::Auto )
884892 {
885893 if ( g_pOriginalWaylandDisplay != NULL )
You can’t perform that action at this time.
0 commit comments