Steam desktop UI on the desktop; Big Picture's Switch to Desktop works

- The front end's "Steam Desktop UI" started a Steam session without -gamepadui, and the client
  put itself into Big Picture under gamescope anyway. It now opens the desktop with Steam's
  desktop client started in it (BL_DESKTOP_STEAM, the desktop's autostart, the same
  bannerlator-steam-launch the menu's Steam entry uses).
- Big Picture's power menu "Switch to Desktop" runs steamos-session-select, which did not exist,
  so it sat on "Switching to Desktop..." for ever. The new stub leaves the app a request
  (session=desktop in the steam-launch file); the app ends the Steam session and starts the
  desktop with Steam's desktop client open.
This commit is contained in:
The412Banner committed 2026-09-25 08:59:06 -04:00
1 parent 09e5172052
commit 7c6df51bfa
5 files changed
+39 -3

No files matched your search

@@ -272,8 +272,11 @@ class MainActivity : ComponentActivity() {
),
FrontEndActions(
onPlay = { startSession(Intent(this, SessionActivity::class.java)) },
// Steam's desktop client as a window on the desktop: under gamescope the
// client puts itself into Big Picture whatever it is started with.
onPlayDesktopUi = {
startSession(Intent(this, SessionActivity::class.java)
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_DESKTOP)
.putExtra(SessionService.EXTRA_STEAM_UI, "desktop"))
},
onSteamGame = { g ->
@@ -43,6 +43,8 @@ object SessionFiles {
// the three under /usr/bin, all no-ops that answer "nothing to do" (see each file).
"usr/bin/steamos-update" to "usr/bin/steamos-update",
"usr/bin/steamos-select-branch" to "usr/bin/steamos-select-branch",
// Big Picture's "Switch to Desktop": asks the app for the desktop with Steam in it.
"usr/bin/steamos-session-select" to "usr/bin/steamos-session-select",
"usr/bin/jupiter-biosupdate" to "usr/bin/jupiter-biosupdate",
"usr/bin/steamos-polkit-helpers/steamos-priv-write" to "usr/bin/steamos-polkit-helpers/steamos-priv-write",
"usr/bin/steamos-polkit-helpers/steamos-set-timezone" to "usr/bin/steamos-polkit-helpers/steamos-set-timezone",
@@ -469,6 +469,9 @@ class SessionService : Service() {
// The second library's name, for bannerlator-steam-library; the bind itself is made below.
GameStorage.effective(this)?.let { guest.add("BL_LIBRARY_LABEL=" + it.label.replace('"', ' ')) }
if (SessionState.mode == MODE_STEAM && SessionState.steamUi == "desktop") guest.add("BL_STEAM_UI=desktop")
// The desktop asked for with Steam in it (the front end's "Steam Desktop UI", Big Picture's
// "Switch to Desktop"): the desktop's autostart opens the client's desktop UI there.
if (SessionState.mode == MODE_DESKTOP && SessionState.steamUi == "desktop") guest.add("BL_DESKTOP_STEAM=1")
val shellGuest = ArrayList(guest).apply {
add("SHELL=/bin/bash")
add("TERM=xterm-256color")
@@ -734,6 +737,8 @@ class SessionService : Service() {
* The desktop's Steam launchers cannot start the client where they are (no dma-buf on the
* desktop), so they leave `steam-launch` in the session directory instead: which UI, and a
* steam:// URL or nothing. This ends the session and hands the activity the one to start.
* `session=desktop` (Big Picture's "Switch to Desktop", steamos-session-select) asks for the
* desktop instead, with Steam's desktop client started in it.
*/
private var launchWatcher: android.os.FileObserver? = null
@@ -748,15 +753,18 @@ class SessionService : Service() {
file.delete()
var ui = "desktop"
var url = ""
var session = MODE_STEAM
text.lineSequence().forEach { line ->
when {
line.startsWith("ui=") -> ui = line.removePrefix("ui=").trim()
line.startsWith("url=") -> url = line.removePrefix("url=").trim()
line.startsWith("session=") && line.removePrefix("session=").trim() == "desktop" -> session = MODE_DESKTOP
}
}
Log.i(TAG, "launch request from the session: Steam $ui" + (if (url.isNotEmpty()) " $url" else ""))
Log.i(TAG, "launch request from the session: " + (if (session == MODE_DESKTOP) "the desktop with " else "") +
"Steam $ui" + (if (url.isNotEmpty()) " $url" else ""))
val next = Intent(this@SessionService, com.droiddeck.launcher.SessionActivity::class.java)
.putExtra(EXTRA_MODE, MODE_STEAM)
.putExtra(EXTRA_MODE, session)
.putExtra(EXTRA_STEAM_UI, ui)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
if (url.isNotEmpty()) next.putExtra(EXTRA_STEAM_URL, url)
@@ -1048,7 +1056,8 @@ class SessionService : Service() {
const val EXTRA_PROGRAM = "program"
/** MODE_RUN: arguments after the program (a game to boot). */
const val EXTRA_PROGRAM_ARGS = "programArgs"
/** MODE_STEAM: "desktop" for the client's desktop UI (default Big Picture); a steam:// URL to hand it. */
/** MODE_STEAM: "desktop" for the client's desktop UI (default Big Picture); a steam:// URL to hand it.
* MODE_DESKTOP: "desktop" = open Steam's desktop client in the desktop once it is up. */
const val EXTRA_STEAM_UI = "steamUi"
const val EXTRA_STEAM_URL = "steamUrl"