Merge pull request #18 from The412Banner/launcher-panel-refresh

Simplify launcher panels and manage compatibility tools in place
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-09-23 16:03:26 -04:00
commit 73e0a3b35d
11 files changed
+552 -527

No files matched your search

@@ -18,7 +18,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.steamdeck.launcher.core.FileUtils
import com.steamdeck.launcher.gpu.FrameGen
import com.steamdeck.launcher.gpu.LinuxVulkanDriver
import com.steamdeck.launcher.gpu.LinuxVulkanDriverManager
@@ -28,13 +27,12 @@ import com.steamdeck.launcher.runtime.LinuxRuntime
import com.steamdeck.launcher.runtime.DesktopCatalog
import com.steamdeck.launcher.runtime.LinuxRuntimeInstaller
import com.steamdeck.launcher.session.SessionService
import com.steamdeck.launcher.ui.DesktopAppsPage
import com.steamdeck.launcher.ui.PackageRow
import com.steamdeck.launcher.session.OfflineMode
import com.steamdeck.launcher.session.ProtonExtras
import com.steamdeck.launcher.session.SessionLogShare
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.ui.ProtonDialog
import com.steamdeck.launcher.ui.ProtonPage
import com.steamdeck.launcher.ui.ProtonRow
import com.steamdeck.launcher.core.CpuCores
import com.steamdeck.launcher.ui.CoreRow
@@ -81,9 +79,9 @@ class MainActivity : ComponentActivity() {
private var showFrameGen by mutableStateOf(false)
private var showCredits by mutableStateOf(false)
private var showProtons by mutableStateOf(false)
private var showApps by mutableStateOf(false)
private var catalog by mutableStateOf<List<DesktopCatalog.Entry>?>(emptyList())
private var packageRows by mutableStateOf<List<PackageRow>?>(emptyList())
private var catalog by mutableStateOf<List<DesktopCatalog.Entry>?>(null)
private var catalogLoading by mutableStateOf(false)
private var packageRows by mutableStateOf<List<PackageRow>?>(null)
private var pkgId by mutableStateOf<String?>(null)
private var pkgStage by mutableStateOf<String?>(null)
private var pkgPercent by mutableIntStateOf(-1)
@@ -91,6 +89,9 @@ class MainActivity : ComponentActivity() {
private var offlineAccount by mutableStateOf<String?>(null)
private var offline by mutableStateOf(false)
private var protonRows by mutableStateOf<List<ProtonRow>>(emptyList())
private var protonBusyId by mutableStateOf<String?>(null)
private var protonStage by mutableStateOf<String?>(null)
private var protonPercent by mutableIntStateOf(-1)
private var showPerformance by mutableStateOf(false)
private var clientOverride by mutableStateOf(false)
private var clientCores by mutableStateOf<Set<Int>>(emptySet())
@@ -165,8 +166,6 @@ class MainActivity : ComponentActivity() {
private val pickGameStorage = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedPath(r.data)?.let { path -> setGameStorage(path, GameStorage.labelFor(this, path)) }
}
private var emulators by mutableStateOf<List<Pair<String, String>>>(emptyList())
private var showEmulatorHelp by mutableStateOf(false)
private var romsDir by mutableStateOf<String?>(null)
private var steamGames by mutableStateOf<List<Library.SteamGame>>(emptyList())
private var emulatorList by mutableStateOf<List<Library.Emulator>>(emptyList())
@@ -183,6 +182,18 @@ class MainActivity : ComponentActivity() {
/** The session surface rises over the front end instead of cutting to it. */
override fun startActivity(intent: Intent?) {
if (intent?.component?.className == SessionActivity::class.java.name) {
when {
protonBusyId != null || ProtonExtras.installInProgress -> {
android.widget.Toast.makeText(this, "Wait for the compatibility tool install to finish", android.widget.Toast.LENGTH_SHORT).show()
return
}
pkgStage != null -> {
android.widget.Toast.makeText(this, "Wait for the desktop app install to finish", android.widget.Toast.LENGTH_SHORT).show()
return
}
}
}
super.startActivity(intent)
if (intent?.component?.className == SessionActivity::class.java.name) overridePendingTransition(R.anim.session_rise, R.anim.session_hold)
}
@@ -196,7 +207,7 @@ class MainActivity : ComponentActivity() {
val page: (@Composable () -> Unit)? = when {
sm != null -> { { ModeSettingsHost(sm) } }
showPerformance -> { { PerformanceHost() } }
showApps -> { { AppsHost() } }
showProtons -> { { ProtonHost() } }
else -> null
}
FrontEndScreen(
@@ -209,11 +220,17 @@ class MainActivity : ComponentActivity() {
steamGames = steamGames, emulators = emulatorList, running = runningLabel,
frameGenEngine = FrameGen.engine(this), frameGenMultiplier = FrameGen.multiplier(this),
lsfgReady = LsfgNative.isInstalled(this),
pageKey = sm?.let { "settings:$it" } ?: if (showPerformance) "performance" else if (showApps) "apps" else null,
pageKey = sm?.let { "settings:$it" } ?: if (showPerformance) "performance" else if (showProtons) "protons" else null,
theme = theme,
isHomeApp = homeAppSelected,
defaultHomeLabel = defaultHomeLabel,
androidApps = androidApps,
packages = packageRows,
packageCatalogLoading = catalogLoading,
packageBusyId = pkgId,
packageStage = pkgStage,
packagePercent = pkgPercent,
sessionRunning = SessionState.running,
),
FrontEndActions(
onPlay = { startSession(Intent(this, SessionActivity::class.java)) },
@@ -241,14 +258,15 @@ class MainActivity : ComponentActivity() {
onResume = { startActivity(Intent(this, SessionActivity::class.java)) },
onSteamSettings = { openModeSettings(SessionService.MODE_STEAM) },
onDesktopSettings = { openModeSettings(SessionService.MODE_DESKTOP) },
onApps = { openApps() },
onInstallPackage = { id -> installPackage(id) },
onRemovePackage = { id -> removePackage(id) },
onRuntime = { onRuntimeButton() },
onFrameGenPick = { engine, multiplier ->
FrameGen.set(this, engine, multiplier)
frameGenLabel = FrameGen.label(this)
},
onProtons = { refreshProtons(); showProtons = true },
onPerformance = { refreshCores(); showApps = false; showPerformance = true },
onProtons = { openProtons() },
onPerformance = { refreshCores(); showProtons = false; showPerformance = true },
onRoms = { showRoms = true },
onFiles = { startActivity(Intent(this, com.steamdeck.launcher.files.FileManagerActivity::class.java)) },
onLogs = {
@@ -268,9 +286,8 @@ class MainActivity : ComponentActivity() {
OfflineMode.setEnabled(this, !OfflineMode.enabled(this))
offline = OfflineMode.enabled(this)
},
onEmulatorHelp = { showEmulatorHelp = true },
onCredits = { showCredits = true },
onPageBack = { settingsMode = null; showPerformance = false; showApps = false },
onPageBack = { settingsMode = null; showPerformance = false; showProtons = false },
onTheme = { id -> SessionPrefs.setTheme(this, id); theme = id },
onHomeApp = { manageHomeApp() },
onAndroidApp = { app -> launchAndroidApp(app) },
@@ -286,13 +303,6 @@ class MainActivity : ComponentActivity() {
onClear = { SessionPrefs.setRomsDir(this, ""); romsDir = null; showRoms = false },
onDismiss = { showRoms = false },
)
if (showProtons) ProtonDialog(
rows = protonRows,
onInstall = { id -> ProtonExtras.tools.first { it.id == id }.let { ProtonExtras.queue(this, it) }; refreshProtons() },
onCancel = { id -> ProtonExtras.tools.first { it.id == id }.let { ProtonExtras.unqueue(this, it) }; refreshProtons() },
onRemove = { id -> ProtonExtras.tools.first { it.id == id }.let { ProtonExtras.remove(this, it) }; refreshProtons() },
onDismiss = { showProtons = false },
)
showNonAdreno?.let { release ->
ConfirmDialog(
title = "Not an Adreno GPU",
@@ -310,7 +320,6 @@ class MainActivity : ComponentActivity() {
onDismiss = { showRemove = false },
)
if (showCredits) CreditsDialog { showCredits = false }
if (showEmulatorHelp) com.steamdeck.launcher.ui.EmulatorHelpDialog { showEmulatorHelp = false }
}
}
@@ -340,6 +349,7 @@ class MainActivity : ComponentActivity() {
// Added games' art (a store lookup for what the folders lack) starts here, not only when
// the cog opens.
refreshAddedGames()
if (catalog == null) loadDesktopCatalog()
if (!busy) Thread({ checkCatalog() }, "catalog").start()
}
@@ -366,62 +376,84 @@ class MainActivity : ComponentActivity() {
}
}
/** Desktop & apps, in the front end's pane. */
private fun loadDesktopCatalog() {
if (catalogLoading || catalog != null) return
catalogLoading = true
Thread({
val fetched = DesktopCatalog.fetch()
ui.post {
catalog = fetched
catalogLoading = false
refreshPackages()
}
}, "catalog-desktop").start()
}
private fun openProtons() {
settingsMode = null
showPerformance = false
showProtons = true
refreshProtons()
}
@Composable
private fun AppsHost() {
DesktopAppsPage(
rows = packageRows, busyId = pkgId, busyStage = pkgStage, busyPercent = pkgPercent,
onInstall = { id -> installPackage(id) },
onRemove = { id -> catalog?.firstOrNull { it.id == id }?.let { DesktopCatalog.remove(this, it) }; refreshPackages() },
onLaunch = { path -> showApps = false; launchProgram(path) },
onBack = { showApps = false },
private fun ProtonHost() {
ProtonPage(
rows = protonRows,
busyId = protonBusyId,
stage = protonStage,
percent = protonPercent,
runtimeReady = ready,
sessionRunning = SessionState.running,
onInstall = { id -> installProton(id) },
onCancel = { id -> ProtonExtras.tools.firstOrNull { it.id == id }?.let { ProtonExtras.unqueue(this, it) }; refreshProtons() },
onRemove = { id -> removeProton(id) },
onBack = { showProtons = false },
)
}
private fun openApps() {
settingsMode = null
showPerformance = false
showApps = true
if (catalog.isNullOrEmpty()) Thread({
val fetched = DesktopCatalog.fetch()
ui.post { catalog = fetched; refreshPackages() }
}, "catalog-desktop").start()
else refreshPackages()
private fun installProton(id: String) {
val tool = ProtonExtras.tools.firstOrNull { it.id == id } ?: return
if (protonBusyId != null || SessionState.running) return
ProtonExtras.unqueue(this, tool)
protonBusyId = id
protonStage = "Starting…"
protonPercent = -1
Thread({
val problem = ProtonExtras.install(this, tool) { label, value ->
ui.post { protonStage = label; protonPercent = value }
}
ui.post {
protonBusyId = null
protonStage = null
protonPercent = -1
refreshProtons()
if (problem != null) android.widget.Toast.makeText(this, problem, android.widget.Toast.LENGTH_LONG).show()
}
}, "install-proton-$id").start()
}
private fun removeProton(id: String) {
val tool = ProtonExtras.tools.firstOrNull { it.id == id } ?: return
if (protonBusyId != null || SessionState.running) return
protonBusyId = id
protonStage = "Removing ${tool.name}…"
protonPercent = -1
Thread({
ProtonExtras.remove(this, tool)
ui.post {
protonBusyId = null
protonStage = null
refreshProtons()
}
}, "remove-proton-$id").start()
}
private fun refreshPackages() {
packageRows = catalog?.sortedBy { it.tier }?.map {
PackageRow(it.id, it.name, it.tier, it.version, FileUtils.sizeToString(it.size), it.notes,
DesktopCatalog.installed(this, it.id), launchersOf(it))
}
packageRows = catalog?.map { PackageRow(it.id, it.kind, it.notes) }
desktopInstalled = DesktopCatalog.desktopInstalled(this)
emulators = installedEmulators()
}
/** What a package can start on its own under gamescope; paths inside the runtime. */
private fun launchersOf(entry: DesktopCatalog.Entry): List<Pair<String, String>> = launchersOf(entry.id)
/**
* The same, by package id alone, so the main screen's row is known from the install markers
* before (or without) the catalog. The AppImage packages launch as /opt/appimages/<id>.AppImage.
*/
private fun launchersOf(id: String): List<Pair<String, String>> = when (id) {
"emulators" -> listOf("PPSSPP" to "/usr/bin/PPSSPPSDL", "RetroArch" to "/usr/bin/retroarch")
"rpcs3" -> listOf("RPCS3" to "/opt/appimages/rpcs3.AppImage")
"pcsx2" -> listOf("PCSX2" to "/opt/appimages/pcsx2.AppImage")
"dolphin" -> listOf("Dolphin" to "/opt/appimages/dolphin.AppImage")
"duckstation" -> listOf("DuckStation" to "/opt/appimages/duckstation.AppImage")
"melonds" -> listOf("melonDS" to "/opt/appimages/melonds.AppImage")
"cemu" -> listOf("Cemu" to "/opt/appimages/cemu.AppImage")
else -> emptyList()
}
/** Every installed emulator's launcher, for the main screen. */
private fun installedEmulators(): List<Pair<String, String>> =
listOf("rpcs3", "pcsx2", "dolphin", "duckstation", "melonds", "cemu", "emulators")
.filter { DesktopCatalog.installed(this, it) != null }
.flatMap { launchersOf(it) }
private fun launchProgram(path: String) {
startActivity(Intent(this, SessionActivity::class.java)
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
@@ -430,7 +462,7 @@ class MainActivity : ComponentActivity() {
private fun installPackage(id: String) {
val entry = catalog?.firstOrNull { it.id == id } ?: return
if (pkgStage != null) return
if (pkgStage != null || SessionState.running) return
pkgId = id; pkgStage = "Starting…"; pkgPercent = -1
Thread({
val problem = DesktopCatalog.install(this, entry) { stage, percent ->
@@ -440,10 +472,25 @@ class MainActivity : ComponentActivity() {
pkgStage = null; pkgId = null
if (problem != null) android.widget.Toast.makeText(this, "${entry.name}: $problem", android.widget.Toast.LENGTH_LONG).show()
refreshPackages()
refresh()
}
}, "install-pkg").start()
}
private fun removePackage(id: String) {
val entry = catalog?.firstOrNull { it.id == id } ?: return
if (pkgStage != null || SessionState.running) return
pkgId = id; pkgStage = if (entry.kind == "appimage") "Removing ${entry.name}…" else "Forgetting ${entry.name}…"; pkgPercent = -1
Thread({
DesktopCatalog.remove(this, entry)
ui.post {
pkgStage = null; pkgId = null
refreshPackages()
refresh()
}
}, "remove-pkg").start()
}
/** Both driver lists as the dialog shows them, re-read from disk so an import or removal shows at once. */
/** Everything the mode's cog shows, read fresh, then the dialog. */
/** The Steam or Desktop settings page, in the front end's pane. */
@@ -565,7 +612,8 @@ class MainActivity : ComponentActivity() {
}
private fun openModeSettings(mode: String) {
showApps = false
showPerformance = false
showProtons = false
refreshDrivers()
resolutionCap = SessionPrefs.resolutionCap(this, mode)
customResolution = SessionPrefs.customResolution(this, mode)
@@ -702,7 +750,6 @@ class MainActivity : ComponentActivity() {
frameGenLabel = FrameGen.label(this)
romsDir = SessionPrefs.romsDir(this).takeIf { it.isNotEmpty() }
logsEnabled = SessionPrefs.logsEnabled(this)
emulators = if (ready) installedEmulators() else emptyList()
runningLabel = if (SessionState.running) when (SessionState.mode) {
SessionService.MODE_DESKTOP -> "Desktop"
SessionService.MODE_RUN -> SessionState.program?.substringAfterLast('/')?.substringBefore('.') ?: "Program"
@@ -24,6 +24,7 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import com.steamdeck.launcher.core.FileUtils
import com.steamdeck.launcher.gpu.FrameGen
@@ -42,7 +43,6 @@ import com.steamdeck.launcher.session.LoadingState
import com.steamdeck.launcher.session.PerfHints
import com.steamdeck.launcher.session.PerfHud
import com.steamdeck.launcher.session.PerfMode
import com.steamdeck.launcher.session.ProtonExtras
import com.steamdeck.launcher.session.SessionPrefs
import com.steamdeck.launcher.session.SessionPaths
import com.steamdeck.launcher.wayland.HdrSupport
@@ -52,8 +52,6 @@ import com.steamdeck.launcher.ui.CursorOverlay
import com.steamdeck.launcher.ui.DrawerActions
import com.steamdeck.launcher.ui.HudText
import com.steamdeck.launcher.ui.LoadingOverlay
import com.steamdeck.launcher.ui.ProtonDialog
import com.steamdeck.launcher.ui.ProtonRow
import com.steamdeck.launcher.ui.SessionDrawer
import com.steamdeck.launcher.ui.SessionPausedOverlay
import com.steamdeck.launcher.ui.SecondScreenPresentation
@@ -91,8 +89,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
// Compose reads these; the activity writes them.
private var drawerOpen by mutableStateOf(false)
private var showProtons by mutableStateOf(false)
private var protonRows by mutableStateOf<List<ProtonRow>>(emptyList())
private var hudOn by mutableStateOf(true)
private var frameGenLabel by mutableStateOf("Off")
private var frameGenEngine by mutableStateOf(FrameGen.ENGINE_OFF)
@@ -214,7 +210,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
drawerOpen = false
padBridge?.triggerQam()
}) else null,
onProtons = { refreshProtons(); showProtons = true },
onOsc = { v -> SessionPrefs.setOscMode(this@SessionActivity, v); readPrefs(); updateOnScreenControls() },
onTouch = { v -> SessionPrefs.setTouchMode(this@SessionActivity, v); readPrefs() },
onShape = { v -> SessionPrefs.setShapeMode(this@SessionActivity, v); readPrefs() },
@@ -234,13 +229,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
onStop = { drawerOpen = false; SessionService.stop(this@SessionActivity); finish() },
onClose = { drawerOpen = false },
))
if (showProtons) ProtonDialog(
rows = protonRows,
onInstall = { id -> ProtonExtras.tools.first { it.id == id }.let { ProtonExtras.queue(this@SessionActivity, it) }; refreshProtons() },
onCancel = { id -> ProtonExtras.tools.first { it.id == id }.let { ProtonExtras.unqueue(this@SessionActivity, it) }; refreshProtons() },
onRemove = { id -> ProtonExtras.tools.first { it.id == id }.let { ProtonExtras.remove(this@SessionActivity, it) }; refreshProtons() },
onDismiss = { showProtons = false },
)
if (SessionState.suspended) SessionPausedOverlay {
SessionService.resume(this@SessionActivity)
}
@@ -264,21 +252,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
// from a button a game might also be reading.
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
when {
showProtons -> showProtons = false
else -> drawerOpen = !drawerOpen
}
drawerOpen = !drawerOpen
}
})
watchSession()
}
private fun refreshProtons() {
protonRows = ProtonExtras.tools.map {
ProtonRow(it.id, it.name, ProtonExtras.installed(this, it), ProtonExtras.queued(this, it))
}
}
private fun refreshHomeApp() {
isHomeApp = HomeApp.isDefault(this)
defaultHomeLabel = HomeApp.defaultLabel(this)
@@ -74,6 +74,9 @@ object Library {
"melonds" to "melonds", "cemu" to "cemu", "ppsspp" to "emulators", "retroarch" to "emulators",
)
/** Desktop catalog package that supplies this emulator. */
fun packageId(emulatorId: String): String? = installedIds[emulatorId]
/** Every emulator the app knows, installed or not, with the games its system folder holds. */
fun emulators(context: Context, installedPackage: (String) -> Boolean): List<Emulator> {
val romsRoot = SessionPrefs.romsDir(context).takeIf { it.isNotEmpty() }?.let(::File)?.takeIf { it.isDirectory }
@@ -1,30 +1,36 @@
package com.steamdeck.launcher.session
import android.content.Context
import android.os.StatFs
import android.util.Log
import com.steamdeck.launcher.core.Downloader
import com.steamdeck.launcher.core.FileUtils
import com.steamdeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.security.MessageDigest
import org.json.JSONArray
/**
* Third-party Proton builds for the client - GE-Proton and proton-cachyos, both published as
* native ARM64 tarballs. The runtime's own registrar (bannerlator-proton-extra) downloads and
* installs one into the client's compatibilitytools.d and patches it past pressure-vessel; this
* side only leaves it the request, one line in ~/.bl-proton-extra, which the session script reads
* before the client starts. A line is dropped once it has succeeded; a failed download stays and
* is retried next session. Hundreds of megabytes each, so only ever on request.
*/
/** Immediate download and installation of the optional ARM64 Proton builds. */
object ProtonExtras {
class Tool(val id: String, val name: String, val prefix: String)
private const val TAG = "ProtonExtras"
private const val NEED_BYTES = 4L * 1024 * 1024 * 1024
private const val RELEASES = "https://api.github.com/repos/%s/releases?per_page=15"
@Volatile
var installInProgress = false
private set
class Tool(val id: String, val name: String, val prefix: String, val repo: String, val assetPattern: Regex)
private data class Asset(val tag: String, val name: String, val url: String, val sha512: String?, val size: Long)
val tools = listOf(
Tool("ge", "GE-Proton", "GE-Proton"),
Tool("cachyos", "proton-cachyos", "proton-cachyos"),
Tool("ge", "GE-Proton", "GE-Proton", "GloriousEggroll/proton-ge-custom", Regex("aarch64\\.tar\\.(gz|xz)$")),
Tool("cachyos", "proton-cachyos", "proton-cachyos", "CachyOS/proton-cachyos", Regex("arm64\\.tar\\.(gz|xz)$")),
)
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
private fun requests(context: Context) = File(home(context), ".bl-proton-extra")
private fun toolsDir(context: Context) =
File(home(context), ".local/share/Steam/compatibilitytools.d")
private fun toolsDir(context: Context) = File(home(context), ".local/share/Steam/compatibilitytools.d")
/** The installed build's directory name (e.g. GE-Proton11-7), or null. */
fun installed(context: Context, tool: Tool): String? =
@@ -32,23 +38,158 @@ object ProtonExtras {
?.filter { it.isDirectory && it.name.startsWith(tool.prefix) && File(it, "toolmanifest.vdf").isFile }
?.maxByOrNull { it.name }?.name
/** A request left by an earlier app version, still consumed by the session shim. */
fun queued(context: Context, tool: Tool): Boolean =
requestLines(context).any { it.trim() == tool.id || it.trim().startsWith(tool.id + " ") }
fun queue(context: Context, tool: Tool) {
if (queued(context, tool)) return
val lines = requestLines(context) + tool.id
FileUtils.writeString(requests(context), lines.joinToString("\n") + "\n")
}
fun unqueue(context: Context, tool: Tool) {
val lines = requestLines(context).filterNot { it.trim() == tool.id || it.trim().startsWith(tool.id + " ") }
FileUtils.writeString(requests(context), if (lines.isEmpty()) "" else lines.joinToString("\n") + "\n")
val file = requests(context)
if (lines.isEmpty()) file.delete()
else file.writeText(lines.joinToString("\n") + "\n")
}
/** Deletes the installed build; the client forgets it on its next start. */
/** Deletes the installed build; Steam discovers its absence on its next start. */
fun remove(context: Context, tool: Tool) {
installed(context, tool)?.let { FileUtils.delete(File(toolsDir(context), it)) }
installed(context, tool)?.let { File(toolsDir(context), it).deleteRecursively() }
}
/** Downloads, verifies and registers the latest build without waiting for another session. */
@Synchronized
fun install(context: Context, tool: Tool, onProgress: (String, Int) -> Unit): String? {
if (installInProgress) return "A compatibility tool install is already running"
installInProgress = true
return try { installNow(context, tool, onProgress) } finally { installInProgress = false }
}
private fun installNow(context: Context, tool: Tool, onProgress: (String, Int) -> Unit): String? {
if (SessionState.running) return "Stop the active session before installing compatibility tools"
if (!LinuxRuntime.isInstalled(context)) return "Install the Linux runtime first"
val asset = findLatestAsset(tool) ?: return "Could not find an ARM64 release for ${tool.name}"
val downloads = File(context.filesDir, "proton-downloads").apply { mkdirs() }
val archive = File(downloads, "${tool.id}-${asset.name}")
if (asset.size > 0 && archive.length() > asset.size) archive.delete()
val missing = (asset.size - archive.length()).coerceAtLeast(0L)
if (StatFs(LinuxRuntime.rootDir(context).path).availableBytes < NEED_BYTES + missing) {
return "At least 4 GB free plus the download size is required to install ${tool.name}"
}
onProgress("Downloading ${tool.name} ${asset.tag}", 0)
var downloaded = false
for (attempt in 0 until 5) {
downloaded = Downloader.downloadFile(asset.url, archive, true) { fraction ->
onProgress("Downloading ${tool.name} ${asset.tag}", if (fraction < 0) -1 else (fraction * 100f).toInt().coerceIn(0, 100))
}
if (downloaded) break
if (attempt < 4) {
onProgress("Retrying download · attempt ${attempt + 2} of 5", -1)
try { Thread.sleep(3_000) } catch (_: InterruptedException) {
Thread.currentThread().interrupt()
return "Download interrupted"
}
}
}
if (!downloaded) return "Download failed; the partial file is kept so a retry can resume"
if (asset.size > 0 && archive.length() != asset.size) {
if (archive.length() > asset.size) {
archive.delete()
return "Download exceeded the release size and was deleted"
}
return "Download was incomplete; the partial file is kept for a resumable retry"
}
asset.sha512?.let { checksumUrl ->
onProgress("Verifying download", -1)
val checksumText = Downloader.downloadString(checksumUrl)
val expected = checksumText?.let { Regex("(?i)\\b[0-9a-f]{128}\\b").find(it)?.value }
if (expected != null && !expected.equals(sha512(archive), ignoreCase = true)) {
archive.delete()
return "Checksum mismatch; the download was deleted"
}
}
if (SessionState.running) return "A session started during the download; stop it before installing compatibility tools"
onProgress("Installing ${tool.name}", -1)
return try {
val root = LinuxRuntime.rootDir(context)
LinuxRuntime.writeAccounts(context)
com.steamdeck.launcher.session.SessionFiles.stage(context, root)
val runtimeDir = File(context.filesDir, ".proton-install-rt").apply { mkdirs() }
val guest = listOf(
"/usr/bin/env", "-i", "HOME=/root", "USER=root", "PATH=/usr/local/bin:/usr/bin:/bin",
"LANG=C.UTF-8", "XDG_DATA_HOME=/root/.local/share",
"/usr/local/bin/bannerlator-proton-extra", "/root/.local/share/Steam", archive.absolutePath,
)
val command = LinuxRuntime.command(context, null, runtimeDir, null, guest)
val process = ProcessBuilder(command)
.directory(root)
.redirectErrorStream(true)
val hostEnv = process.environment()
hostEnv["PROOT_LOADER"] = LinuxRuntime.prootLoader(context).path
hostEnv["PROOT_TMP_DIR"] = context.cacheDir.path
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { hostEnv["LD_LIBRARY_PATH"] = it }
val child = process.start()
child.inputStream.bufferedReader().useLines { lines ->
lines.forEach { line ->
Log.i(TAG, line)
if (line.contains("unpacking", ignoreCase = true) || line.contains("adopted", ignoreCase = true)) {
onProgress("Installing ${tool.name}", -1)
}
}
}
val status = child.waitFor()
if (status != 0) "${tool.name} installation failed (exit $status)"
else {
archive.delete()
unqueue(context, tool)
null
}
} catch (e: Exception) {
Log.e(TAG, "install ${tool.id}", e)
e.message ?: "Could not install ${tool.name}"
}
}
private fun findLatestAsset(tool: Tool): Asset? {
val releases = Downloader.downloadString(RELEASES.format(tool.repo)) ?: return null
return try {
val array = JSONArray(releases)
for (i in 0 until array.length()) {
val release = array.getJSONObject(i)
if (release.optBoolean("draft", false)) continue
val assets = release.optJSONArray("assets") ?: continue
val entries = (0 until assets.length()).map { assets.getJSONObject(it) }
val archive = entries.sortedBy { it.optString("name") }.firstOrNull { tool.assetPattern.containsMatchIn(it.optString("name")) } ?: continue
val name = archive.optString("name")
val stem = name.substringBefore(".tar")
val checksum = entries.firstOrNull {
it.optString("name").startsWith(stem) && it.optString("name").contains("sha512", ignoreCase = true)
}?.optString("browser_download_url")?.takeIf { it.startsWith("http") }
return Asset(
release.optString("tag_name"), name,
archive.optString("browser_download_url").takeIf { it.startsWith("http") } ?: continue, checksum,
archive.optLong("size", 0L),
)
}
null
} catch (e: Exception) {
Log.w(TAG, "release metadata for ${tool.id}", e)
null
}
}
private fun sha512(file: File): String {
val digest = MessageDigest.getInstance("SHA-512")
file.inputStream().buffered().use { input ->
val buffer = ByteArray(4 * 1024 * 1024)
while (true) {
val read = input.read(buffer)
if (read < 0) break
digest.update(buffer, 0, read)
}
}
return digest.digest().joinToString("") { "%02x".format(it.toInt() and 0xff) }
}
private fun requestLines(context: Context): List<String> =
@@ -1,193 +0,0 @@
package com.steamdeck.launcher.ui
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsFocusedAsState
import androidx.compose.foundation.interaction.collectIsHoveredAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
class PackageRow(
val id: String, val name: String, val tier: Int, val version: String, val size: String,
val notes: String, val installed: String?,
val launchers: List<Pair<String, String>> = emptyList(),
)
private val RowShape = RoundedCornerShape(10.dp)
private fun tierName(tier: Int) = when (tier) {
1 -> "Native ARM64"
2 -> "ARM64 · experimental"
else -> "Source build · experimental"
}
/**
* Desktop & apps as a page in the front end's pane: one dropdown per tier, opened and closed like
* the rail's own groups, and each package with its own Install/Remove and, while it installs, its
* own bar. Leaving the page does not stop an install; coming back shows where it is.
*/
@Composable
fun DesktopAppsPage(
rows: List<PackageRow>?,
busyId: String?,
busyStage: String?,
busyPercent: Int,
onInstall: (String) -> Unit,
onRemove: (String) -> Unit,
onLaunch: (path: String) -> Unit,
onBack: () -> Unit,
) {
val host = rememberMenuHost()
val colors = MaterialTheme.colorScheme
// The first tier starts open; the rest wait for a tap.
var open by remember { mutableStateOf(setOf(1)) }
// An install always shows: its tier opens when it starts.
val busyTier = rows?.firstOrNull { it.id == busyId }?.tier
LaunchedEffect(busyTier) { if (busyTier != null) open = open + busyTier }
SettingsPage(
host, title = "Desktop & apps", eyebrow = "Desktop",
lede = "Packages for the Linux desktop. Each installs into the runtime and appears in the desktop's menu.",
onBack = onBack,
) {
when {
rows == null -> Text("Could not reach the package catalog.", fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 12.dp))
rows.isEmpty() -> Text("Loading the catalog…", fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 12.dp))
}
for ((tier, group) in (rows ?: emptyList()).groupBy { it.tier }.toSortedMap()) {
val expanded = tier in open
TierHeader(tierName(tier), "${group.count { it.installed != null }}/${group.size}", expanded) {
open = if (expanded) open - tier else open + tier
}
AnimatedVisibility(
visible = expanded,
enter = expandVertically(Motion.tw(280)) + fadeIn(Motion.tw(280)),
exit = shrinkVertically(Motion.tw(200)) + fadeOut(Motion.tw(160)),
) {
val line = LocalPalette.current.line
Column(
modifier = Modifier.padding(start = 16.dp).fillMaxWidth()
.drawWithContent { drawContent(); drawRect(line, size = size.copy(width = 1.dp.toPx())) }
.padding(start = 8.dp, top = 2.dp, bottom = 6.dp),
verticalArrangement = Arrangement.spacedBy(2.dp),
) {
for (row in group) PackageItem(
row, busy = busyId == row.id, anyBusy = busyId != null,
stage = busyStage, percent = busyPercent,
onInstall = onInstall, onRemove = onRemove, onLaunch = onLaunch,
)
}
}
}
}
}
/** A tier's dropdown row: the rail's caret, label and count pill. */
@Composable
private fun TierHeader(label: String, count: String, expanded: Boolean, onClick: () -> Unit) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val src = remember { MutableInteractionSource() }
val focused by src.collectIsFocusedAsState()
val hovered by src.collectIsHoveredAsState()
val ring by animateColorAsState(if (focused) pal.signal else Color.Transparent, Motion.tw(180), label = "tierRing")
val rot by animateFloatAsState(if (expanded) 90f else 0f, Motion.sp(0.6f), label = "tierCaret")
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth().padding(top = 8.dp)
.clip(RowShape)
.background(if (hovered) Color.White.copy(alpha = 0.04f) else Color.Transparent)
.border(1.5.dp, ring, RowShape)
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, onClick = onClick)
.padding(horizontal = 10.dp, vertical = 9.dp),
) {
Text("›", fontSize = 16.sp, color = colors.onSurfaceVariant, modifier = Modifier.width(14.dp).rotate(rot))
Text(label, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, modifier = Modifier.weight(1f))
Text(
count, fontSize = 11.sp, color = colors.onSurfaceVariant,
modifier = Modifier.clip(RoundedCornerShape(99.dp)).background(colors.background).padding(horizontal = 7.dp, vertical = 2.dp),
)
}
}
/** One package inside its tier: name, size or installed version, notes, the button, and its own bar. */
@Composable
private fun PackageItem(
row: PackageRow, busy: Boolean, anyBusy: Boolean, stage: String?, percent: Int,
onInstall: (String) -> Unit, onRemove: (String) -> Unit, onLaunch: (String) -> Unit,
) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val bg by animateColorAsState(if (busy) pal.signal.copy(alpha = 0.10f) else Color.Transparent, Motion.tw(200), label = "pkgBg")
Column(modifier = Modifier.fillMaxWidth().clip(RowShape).background(bg).padding(horizontal = 10.dp, vertical = 8.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(row.name, fontSize = 14.sp, fontWeight = FontWeight.Medium, color = colors.onBackground,
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f, fill = false))
Text(
if (row.installed != null) " ● ${row.installed}" else " ${row.size}",
fontSize = 11.sp, color = if (row.installed != null) pal.good else colors.onSurfaceVariant, maxLines = 1,
)
}
if (row.notes.isNotEmpty()) Text(row.notes, fontSize = 11.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 2.dp))
}
if (row.installed != null) SecondaryButton("Remove", enabled = !anyBusy) { onRemove(row.id) }
else SecondaryButton(if (busy) "Installing…" else "Install", enabled = !anyBusy) { onInstall(row.id) }
}
if (busy) {
Text(
if (stage != null && percent >= 0) "$stage · $percent%" else stage ?: "Starting…",
fontSize = 11.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 6.dp, bottom = 4.dp),
)
if (percent >= 0) LinearProgressIndicator(progress = { percent / 100f }, modifier = Modifier.fillMaxWidth().height(4.dp))
else LinearProgressIndicator(modifier = Modifier.fillMaxWidth().height(4.dp))
}
if (row.installed != null && row.launchers.isNotEmpty()) {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.padding(top = 6.dp)) {
for ((label, path) in row.launchers) {
Box(
modifier = Modifier.clip(RoundedCornerShape(99.dp)).border(1.dp, pal.line2, RoundedCornerShape(99.dp))
.clickable(enabled = !anyBusy) { onLaunch(path) }.padding(horizontal = 10.dp, vertical = 4.dp),
) { Text("▶ $label", fontSize = 12.sp, color = colors.onBackground) }
}
}
}
}
}
@@ -135,6 +135,12 @@ class FrontEndState(
val isHomeApp: Boolean = false,
val defaultHomeLabel: String? = null,
val androidApps: List<com.steamdeck.launcher.HomeApp.LaunchableApp> = emptyList(),
val packages: List<PackageRow>? = null,
val packageCatalogLoading: Boolean = false,
val packageBusyId: String? = null,
val packageStage: String? = null,
val packagePercent: Int = -1,
val sessionRunning: Boolean = false,
)
class FrontEndActions(
@@ -147,7 +153,8 @@ class FrontEndActions(
val onResume: () -> Unit,
val onSteamSettings: () -> Unit,
val onDesktopSettings: () -> Unit,
val onApps: () -> Unit,
val onInstallPackage: (String) -> Unit,
val onRemovePackage: (String) -> Unit,
val onRuntime: () -> Unit,
val onFrameGenPick: (engine: String, multiplier: Int) -> Unit,
val onProtons: () -> Unit,
@@ -157,7 +164,6 @@ class FrontEndActions(
val onLogs: () -> Unit,
val onShareLogs: () -> Unit = {},
val onOffline: () -> Unit,
val onEmulatorHelp: () -> Unit,
val onCredits: () -> Unit,
val onPageBack: () -> Unit = {},
val onTheme: (String) -> Unit = {},
@@ -224,10 +230,6 @@ private fun Modifier.shine(trigger: Boolean, strength: Float = 0.22f): Modifier
@Composable
fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)? = null) {
var selected by rememberSaveable { mutableStateOf("steam") }
var openDesktop by rememberSaveable { mutableStateOf(false) }
var openSteam by rememberSaveable { mutableStateOf(false) }
var openEmu by rememberSaveable { mutableStateOf("") }
var openSetup by rememberSaveable { mutableStateOf(false) }
val colors = MaterialTheme.colorScheme
val ctx = LocalContext.current
BackHandler(enabled = s.pageKey != null && page != null) { a.onPageBack() }
@@ -236,22 +238,26 @@ fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -
BoxWithConstraints(modifier = Modifier.fillMaxSize().background(colors.background).systemBarsPadding()) {
val wide = maxWidth >= 640.dp
val railSelection = when {
s.pageKey == "performance" || s.pageKey == "protons" -> "setup"
s.pageKey?.startsWith("settings:steam") == true -> "steam"
s.pageKey?.startsWith("settings:") == true -> "desktop"
selected.startsWith("app:") -> "steam"
selected.startsWith("emu:") || selected.startsWith("rom:") -> "desktop"
else -> s.pageKey ?: selected
}
val rail: @Composable () -> Unit = {
Rail(
s, s.pageKey ?: selected, openSteam, openDesktop, openEmu, openSetup,
onToggleSetup = { openSetup = !openSetup },
s, railSelection,
onSelect = { key ->
if (s.pageKey != null) a.onPageBack()
if (key == "steam") openSteam = if (selected == "steam") !openSteam else true
if (key == "desktop") openDesktop = if (selected == "desktop") !openDesktop else true
if (key.startsWith("emu:")) openEmu = if (selected == key && openEmu == key) "" else key
selected = key
},
a,
modifier = if (wide) Modifier.width(236.dp).fillMaxHeight() else Modifier.fillMaxWidth().height(maxHeight * 0.42f),
)
}
val content: @Composable (Modifier) -> Unit = { m -> Pane(s, selected, a, page, m) }
val content: @Composable (Modifier) -> Unit = { m -> Pane(s, selected, a, page, m) { selected = it } }
if (wide) Row(modifier = Modifier.fillMaxSize()) { rail(); content(Modifier.weight(1f).fillMaxHeight()) }
else Column(modifier = Modifier.fillMaxSize()) { rail(); content(Modifier.weight(1f).fillMaxWidth()) }
}
@@ -260,8 +266,8 @@ fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -
@Composable
private fun Rail(
s: FrontEndState, selected: String, openSteam: Boolean, openDesktop: Boolean, openEmu: String, openSetup: Boolean,
onToggleSetup: () -> Unit, onSelect: (String) -> Unit, a: FrontEndActions, modifier: Modifier,
s: FrontEndState, selected: String,
onSelect: (String) -> Unit, a: FrontEndActions, modifier: Modifier,
) {
val colors = MaterialTheme.colorScheme
Column(
@@ -324,84 +330,10 @@ private fun Rail(
NavItem("Android apps", "android-apps", selected == "android-apps", count = s.androidApps.size,
register = register, unregister = unregister) { onSelect("android-apps") }
}
NavItem("Steam", "steam", selected == "steam", caret = openSteam, count = s.steamGames.size, register = register, unregister = unregister) { onSelect("steam") }
Sub(openSteam) {
for ((i, g) in s.steamGames.withIndex()) NavItem(g.name, "app:${g.appId}", selected == "app:${g.appId}", small = true, i = i, register = register, unregister = unregister) { onSelect("app:${g.appId}") }
if (s.steamGames.isEmpty()) NavItem("No games", "x", false, small = true, muted = true, register = register, unregister = unregister) {}
NavItem("Settings", "settings:steam", selected == "settings:steam", small = true, tiny = true, muted = true, i = s.steamGames.size, register = register, unregister = unregister) { a.onSteamSettings() }
}
NavItem("Desktop", "desktop", selected == "desktop", caret = openDesktop, count = s.emulators.count { it.installed }, register = register, unregister = unregister) { onSelect("desktop") }
Sub(openDesktop) {
for ((i, e) in s.emulators.filter { it.installed }.withIndex()) {
val key = "emu:${e.id}"
NavItem(e.name, key, selected == key, small = true, caret = openEmu == key, count = e.games.size, i = i, register = register, unregister = unregister) { onSelect(key) }
Sub(openEmu == key) {
for ((j, g) in e.games.withIndex()) NavItem(g.name, "rom:${e.id}:$j", selected == "rom:${e.id}:$j", small = true, tiny = true, i = j, register = register, unregister = unregister) { onSelect("rom:${e.id}:$j") }
if (e.games.isEmpty()) NavItem(
if (e.id == "retroarch") "Browse games in RetroArch" else if (s.romsDir == null) "Choose ROMs folder" else "No ${e.system} games",
"x", false, small = true, tiny = true, muted = true, register = register, unregister = unregister,
) { if (e.id != "retroarch") a.onRoms() }
}
}
if (s.emulators.none { it.installed }) NavItem("Install emulators", "apps", selected == "apps", small = true, muted = true, register = register, unregister = unregister) { a.onApps() }
NavItem("Settings", "settings:lxqt", selected == "settings:lxqt", small = true, tiny = true, muted = true, i = s.emulators.count { it.installed }, register = register, unregister = unregister) { a.onDesktopSettings() }
}
NavItem("Steam", "steam", selected == "steam", count = s.steamGames.size, register = register, unregister = unregister) { onSelect("steam") }
NavItem("Desktop", "desktop", selected == "desktop", count = s.emulators.count { it.installed }, register = register, unregister = unregister) { onSelect("desktop") }
NavItem("Setup", "setup", selected == "setup", register = register, unregister = unregister) { onSelect("setup") }
Spacer(Modifier.height(6.dp))
val menus = remember { MenuHost() }
val item: @Composable (String, String?, Int, String?, () -> Unit) -> Unit = { label, value, i, key, act ->
NavItem(label, key ?: "x", key != null && selected == key, small = true, tiny = true, muted = true, value = value, i = i, register = register, unregister = unregister) { act() }
}
NavItem("Setup", "x", false, caret = openSetup, count = 11, onClick = onToggleSetup)
Sub(openSetup) {
item("Files", null, 0, null, a.onFiles)
item("Desktop & apps", null, 1, "apps", a.onApps)
item("Compatibility tools", null, 2, null, a.onProtons)
Box {
item("Frame generation", s.frameGenLabel, 3, null) { menus.open = "fg" }
AnchoredMenu(
menus.open == "fg", onDismiss = { if (menus.open == "fg") menus.open = null }, title = "Frame generation",
) {
val need = if (s.lsfgReady) null else "install Lossless Scaling in Steam"
MenuItem("Off", checked = s.frameGenEngine == FrameGen.ENGINE_OFF) { a.onFrameGenPick(FrameGen.ENGINE_OFF, 2); menus.open = null }
for (m in 2..4) MenuItem("Win-FG ${m}×", checked = s.frameGenEngine == FrameGen.ENGINE_WINFG && s.frameGenMultiplier == m) { a.onFrameGenPick(FrameGen.ENGINE_WINFG, m); menus.open = null }
for (m in 2..4) MenuItem("LSFG ${m}×", checked = s.frameGenEngine == FrameGen.ENGINE_LSFG && s.frameGenMultiplier == m, enabled = s.lsfgReady, detail = need) { a.onFrameGenPick(FrameGen.ENGINE_LSFG, m); menus.open = null }
}
}
item("Performance", null, 4, "performance", a.onPerformance)
item("ROMs folder", s.romsDir?.substringAfterLast('/')?.ifEmpty { s.romsDir } ?: "choose", 5, null, a.onRoms)
Box {
item("Session logs", if (s.logsEnabled) "on" else "off", 6, null) { menus.open = "logs" }
AnchoredMenu(
menus.open == "logs", onDismiss = { if (menus.open == "logs") menus.open = null }, title = "Session logs",
) {
MenuItem("On", checked = s.logsEnabled) { if (!s.logsEnabled) a.onLogs(); menus.open = null }
MenuItem("Off", checked = !s.logsEnabled) { if (s.logsEnabled) a.onLogs(); menus.open = null }
MenuItem("Share latest logs", checked = false) { a.onShareLogs(); menus.open = null }
}
}
Box {
item("Offline", when { s.offlineAccount == null -> "sign in first"; s.offline -> "on"; else -> "off" }, 7, null) { if (s.offlineAccount != null) menus.open = "offline" }
AnchoredMenu(
menus.open == "offline", onDismiss = { if (menus.open == "offline") menus.open = null }, title = "Offline",
) {
MenuItem("On", checked = s.offline) { if (!s.offline) a.onOffline(); menus.open = null }
MenuItem("Off", checked = !s.offline) { if (s.offline) a.onOffline(); menus.open = null }
}
}
item("Linux runtime", when {
s.busy -> "working…"
!s.ready -> "install"
s.available != null && s.available != s.installed -> "update"
else -> "remove"
}, 8, null, a.onRuntime)
Box {
item("Theme", Themes.byId(s.theme).label, 9, null) { menus.open = "theme" }
AnchoredMenu(menus.open == "theme", onDismiss = { if (menus.open == "theme") menus.open = null }, title = "Theme") {
for (t in Themes.all) MenuItem(t.label, checked = s.theme == t.id) { a.onTheme(t.id); menus.open = null }
}
}
item("Default Home app", s.defaultHomeLabel ?: "Choose a Home app", 10, null, a.onHomeApp)
}
}
}
@@ -443,23 +375,6 @@ private fun RunningTile(name: String, onResume: () -> Unit) {
}
}
@Composable
private fun Sub(open: Boolean, content: @Composable () -> Unit) {
val line = LocalPalette.current.line
AnimatedVisibility(
open,
enter = expandVertically(Motion.tw(420)) + fadeIn(Motion.tw(300, 50)),
exit = shrinkVertically(Motion.tw(300)) + fadeOut(Motion.tw(200)),
) {
Column(
modifier = Modifier.padding(start = 16.dp).fillMaxWidth()
.drawWithContent { drawContent(); drawRect(line, size = size.copy(width = 1.dp.toPx())) }
.padding(start = 8.dp),
verticalArrangement = Arrangement.spacedBy(1.dp),
) { content() }
}
}
@Composable
private fun NavItem(
label: String, key: String, current: Boolean, small: Boolean = false, tiny: Boolean = false, muted: Boolean = false,
@@ -507,7 +422,7 @@ private fun NavItem(
@Composable
private fun Pane(s: FrontEndState, selected: String, a: FrontEndActions, page: (@Composable () -> Unit)?, modifier: Modifier) {
private fun Pane(s: FrontEndState, selected: String, a: FrontEndActions, page: (@Composable () -> Unit)?, modifier: Modifier, onSelect: (String) -> Unit) {
Box(modifier = modifier) {
val wash: Pair<File?, Float> = when {
s.pageKey != null && page != null -> null to 250f
@@ -528,7 +443,7 @@ private fun Pane(s: FrontEndState, selected: String, a: FrontEndActions, page: (
.apply { targetContentZIndex = 1f }
},
label = "pane",
) { key -> if (page != null && key == s.pageKey) page() else Content(s, key, a, Modifier.fillMaxSize()) }
) { key -> if (page != null && key == s.pageKey) page() else Content(s, key, a, Modifier.fillMaxSize(), onSelect) }
}
}
@@ -557,7 +472,7 @@ private fun romFor(s: FrontEndState, selected: String): Pair<Library.Emulator, L
}
@Composable
private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modifier: Modifier) {
private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modifier: Modifier, onSelect: (String) -> Unit) {
val colors = MaterialTheme.colorScheme
Column(modifier = modifier.padding(horizontal = 22.dp, vertical = 18.dp)) {
when {
@@ -585,18 +500,26 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
Actions {
// Enabled without a runtime: the session's loading screen installs it first.
PrimaryButton("Play", enabled = !s.busy, onClick = a.onPlay)
SecondaryButton("Desktop UI", enabled = !s.busy, onClick = a.onPlayDesktopUi)
SecondaryButton("Steam Desktop UI", enabled = !s.busy, onClick = a.onPlayDesktopUi)
Cog(a.onSteamSettings)
}
}
Rise(4) { SectionTitle("Installed", "${s.steamGames.size} game${if (s.steamGames.size == 1) "" else "s"}") }
if (s.steamGames.isEmpty()) Rise(5) { Note("No games installed.") }
else Rise(5, Modifier.weight(1f).fillMaxWidth()) { ArtGrid(s.steamGames.map { g -> Tile(g.name, g.library, g.art, "steam:${g.appId}", null) { a.onSteamGame(g) } }) }
else Rise(5, Modifier.weight(1f).fillMaxWidth()) { ArtGrid(s.steamGames.map { g -> Tile(g.name, g.library, g.art, "steam:${g.appId}", null) { onSelect("app:${g.appId}") } }) }
}
selected.startsWith("app:") -> {
val g = s.steamGames.firstOrNull { "app:${it.appId}" == selected }
if (g == null) Note("That game is no longer installed.") else {
Rise(0) { Eyebrow("Steam · ${g.library}") }
Rise(0) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Text(
"‹ Steam", fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant,
modifier = Modifier.clip(RoundedCornerShape(8.dp)).clickable { onSelect("steam") }.padding(horizontal = 6.dp, vertical = 4.dp),
)
Eyebrow(g.library)
}
}
Rise(1) { Title(g.name) }
Rise(2) {
Row {
@@ -613,7 +536,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
val others = s.steamGames.filter { it !== g }
if (others.isNotEmpty()) {
Rise(3) { SectionTitle("More from the library", null) }
Rise(4, Modifier.weight(1f).fillMaxWidth()) { ArtGrid(others.map { x -> Tile(x.name, x.library, x.art, "steam:${x.appId}", null) { a.onSteamGame(x) } }) }
Rise(4, Modifier.weight(1f).fillMaxWidth()) { ArtGrid(others.map { x -> Tile(x.name, x.library, x.art, "steam:${x.appId}", null) { onSelect("app:${x.appId}") } }) }
}
}
}
@@ -622,41 +545,85 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
Rise(3) {
Actions {
// Enabled without a runtime or the desktop: the session's loading screen installs them first.
PrimaryButton("Desktop", enabled = !s.busy, onClick = a.onDesktop)
SecondaryButton("Desktop & apps", onClick = a.onApps)
PrimaryButton(if (s.desktopInstalled) "Open desktop" else "Install & open desktop", enabled = !s.busy, onClick = a.onDesktop)
Cog(a.onDesktopSettings)
}
}
Rise(4) { SectionTitle("Emulators", "${s.emulators.count { it.installed }} installed · ${s.emulators.count { !it.installed }} available") }
Rise(5) {
Text("Why?", fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(bottom = 6.dp).clip(Shape10).clickable(onClick = a.onEmulatorHelp).padding(horizontal = 6.dp, vertical = 4.dp))
}
Rise(6, Modifier.weight(1f).fillMaxWidth()) {
ArtGrid(s.emulators.map { e -> Tile(e.name, if (e.installed) (if (e.id == "retroarch") null else "${e.games.size} game${if (e.games.size == 1) "" else "s"}") else "Not installed", null, "emu:${e.id}", e.iconRes, dim = !e.installed) { if (e.installed) a.onEmulator(e) else a.onApps() } })
Rise(5, Modifier.weight(1f).fillMaxWidth()) {
ArtGrid(s.emulators.map { e -> Tile(e.name, if (e.installed) (if (e.id == "retroarch") null else "${e.games.size} game${if (e.games.size == 1) "" else "s"}") else "Select to install", null, "emu:${e.id}", e.iconRes, dim = !e.installed) { onSelect("emu:${e.id}") } })
}
}
selected == "setup" -> SetupPanel(s, a)
selected.startsWith("emu:") -> {
val e = s.emulators.firstOrNull { "emu:${it.id}" == selected }
if (e == null) Note("Not installed.") else {
Rise(0) { Eyebrow("Desktop · ${e.system}") }
Rise(1) { Title(e.name) }
Rise(3) {
Actions {
Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp))
PrimaryButton("Open ${e.name}", enabled = s.ready && !s.busy) { a.onEmulator(e) }
SecondaryButton("ROMs folder", onClick = a.onRoms)
}
}
Rise(4) { SectionTitle("Games", e.games.size.toString()) }
if (e.games.isEmpty()) Rise(5) {
Note(
if (s.romsDir == null) "Choose a ROMs folder."
else if (e.id == "retroarch") "Browse to /root/ROMs in RetroArch."
else "Add ${e.system} games to ROMs/${e.system.substringBefore(' ')}.",
val pkgId = Library.packageId(e.id)
val pkg = pkgId?.let { id -> s.packages?.firstOrNull { it.id == id } }
Rise(0) {
Text(
"‹ Desktop", fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant,
modifier = Modifier.clip(RoundedCornerShape(8.dp)).clickable { onSelect("desktop") }.padding(horizontal = 6.dp, vertical = 4.dp),
)
}
else Rise(5, Modifier.weight(1f).fillMaxWidth()) {
ArtGrid(e.games.map { g -> Tile(g.name, if (g.art != null) "installed" else g.hostPath.extension.uppercase().ifEmpty { "folder" }, g.art, "rom:${g.hostPath}", e.iconRes) { a.onRom(g) } }, wide = e.games.none { it.art != null })
Rise(1) { Title(e.name) }
if (e.installed) {
Rise(3) {
Actions {
Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp))
PrimaryButton("Open ${e.name}", enabled = s.ready && !s.busy) { a.onEmulator(e) }
SecondaryButton("ROMs folder", onClick = a.onRoms)
if (pkg != null) SecondaryButton(
if (pkg.kind == "appimage") "Remove" else "Forget",
enabled = s.packageBusyId == null && !s.sessionRunning,
) { a.onRemovePackage(pkg.id) }
}
}
Rise(4) { SectionTitle("Games", e.games.size.toString()) }
if (e.games.isEmpty()) Rise(5) {
Note(
if (s.romsDir == null) "Choose a ROMs folder."
else if (e.id == "retroarch") "Browse to /root/ROMs in RetroArch."
else "Add ${e.system} games to ROMs/${e.system.substringBefore(' ')}.",
)
}
else Rise(5, Modifier.weight(1f).fillMaxWidth()) {
ArtGrid(e.games.mapIndexed { index, g -> Tile(g.name, if (g.art != null) "installed" else g.hostPath.extension.uppercase().ifEmpty { "folder" }, g.art, "rom:${e.id}:$index", e.iconRes) { onSelect("rom:${e.id}:$index") } }, wide = e.games.none { it.art != null })
}
} else {
if (pkg != null) Rise(2) {
Actions {
Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp))
PrimaryButton(
if (s.packageBusyId == pkg.id) "Installing…" else "Install ${e.name}",
enabled = s.packageBusyId == null && s.ready && !s.packageCatalogLoading && !s.sessionRunning,
) { a.onInstallPackage(pkg.id) }
if (s.sessionRunning) Chip("Stop session to install", ok = false)
else if (!s.ready) Chip("Runtime required", ok = false)
}
}
Rise(3) {
Box(Modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 8.dp)) {
Note(when {
s.packageCatalogLoading -> "Loading install details…"
pkg == null -> "Install details are unavailable right now. Try again when the package catalog is reachable."
!s.ready -> "Install the Linux runtime from Setup before installing desktop apps."
s.sessionRunning -> "Stop the active session before installing desktop apps."
pkg.notes.isNotBlank() -> pkg.notes
else -> "Install ${e.name} into the Linux desktop runtime."
})
}
}
if (s.packageBusyId == pkg?.id) Rise(4) {
val stage = s.packageStage
Text(
if (stage != null && s.packagePercent >= 0) "$stage · ${s.packagePercent}%" else stage ?: "Starting…",
fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(bottom = 6.dp),
)
if (s.packagePercent >= 0) LinearProgressIndicator(progress = { s.packagePercent / 100f }, modifier = Modifier.fillMaxWidth().height(4.dp))
else LinearProgressIndicator(modifier = Modifier.fillMaxWidth().height(4.dp))
}
if (pkg?.kind == "tar") Rise(5) { Note("Forgetting this package hides it from Desktop; its files remain in the Linux runtime.") }
}
}
}
@@ -664,7 +631,15 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
val pair = romFor(s, selected)
if (pair == null) Note("That game is gone from the ROMs folder.") else {
val (e, g) = pair
Rise(0) { Eyebrow("Desktop · ${e.name}") }
Rise(0) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
Text(
"‹ ${e.name}", fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant,
modifier = Modifier.clip(RoundedCornerShape(8.dp)).clickable { onSelect("emu:${e.id}") }.padding(horizontal = 6.dp, vertical = 4.dp),
)
Eyebrow("Desktop · ${e.system}")
}
}
Rise(1) { Title(g.name) }
Rise(2) {
Row {
@@ -684,7 +659,10 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
if (others.isNotEmpty()) {
Rise(3) { SectionTitle("Also in ${e.name}", null) }
Rise(4, Modifier.weight(1f).fillMaxWidth()) {
ArtGrid(others.map { x -> Tile(x.name, if (x.art != null) "installed" else x.hostPath.extension.uppercase().ifEmpty { "folder" }, x.art, "rom:${x.hostPath}", e.iconRes) { a.onRom(x) } }, wide = others.none { it.art != null })
ArtGrid(others.map { x ->
val index = e.games.indexOf(x)
Tile(x.name, if (x.art != null) "installed" else x.hostPath.extension.uppercase().ifEmpty { "folder" }, x.art, "rom:${e.id}:$index", e.iconRes) { onSelect("rom:${e.id}:$index") }
}, wide = others.none { it.art != null })
}
}
}
@@ -694,6 +672,63 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
}
}
@Composable
private fun SetupPanel(s: FrontEndState, a: FrontEndActions) {
val host = rememberMenuHost()
val runtime = when {
s.busy -> "Working…"
!s.ready -> "Install"
s.available != null && s.available != s.installed -> "Update"
else -> "Manage"
}
Rise(0, Modifier.fillMaxSize()) {
Column(modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
Rise(0) { Eyebrow("Setup") }
Rise(1) { Title("Setup") }
SettingsGroup("Launcher tools") {
ActionRow("Files", "Browse and manage files", "Open", a.onFiles)
ActionRow("Compatibility tools", "Install ARM64 Proton builds", "Manage", a.onProtons)
ActionRow("Performance", "CPU core assignment", "Configure", a.onPerformance)
ActionRow("ROMs folder", s.romsDir ?: "Choose where emulator games are stored", "Choose", a.onRoms)
}
SettingsGroup("Session") {
SettingsRow("Frame generation", "Select the frame generation mode") {
Box {
ValueChip(s.frameGenLabel, host.open == "fg") { host.open = if (host.open == "fg") null else "fg" }
AnchoredMenu(host.open == "fg", onDismiss = { if (host.open == "fg") host.open = null }, title = "Frame generation") {
val need = if (s.lsfgReady) null else "Install Lossless Scaling in Steam"
MenuItem("Off", checked = s.frameGenEngine == FrameGen.ENGINE_OFF) { a.onFrameGenPick(FrameGen.ENGINE_OFF, 2); host.open = null }
for (m in 2..4) MenuItem("Win-FG ${m}×", checked = s.frameGenEngine == FrameGen.ENGINE_WINFG && s.frameGenMultiplier == m) { a.onFrameGenPick(FrameGen.ENGINE_WINFG, m); host.open = null }
for (m in 2..4) MenuItem("LSFG ${m}×", checked = s.frameGenEngine == FrameGen.ENGINE_LSFG && s.frameGenMultiplier == m, enabled = s.lsfgReady, detail = need) { a.onFrameGenPick(FrameGen.ENGINE_LSFG, m); host.open = null }
}
}
}
SettingsRow("Session logs", "${if (s.logsEnabled) "Enabled" else "Disabled"} · logs are saved after each session") {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
SecondaryButton(if (s.logsEnabled) "Turn off" else "Turn on") { a.onLogs() }
SecondaryButton("Share latest") { a.onShareLogs() }
}
}
SettingsRow("Offline mode", s.offlineAccount?.let { if (s.offline) "Enabled for $it" else "Signed in as $it" } ?: "Sign in to Steam first") {
SecondaryButton(if (s.offline) "Turn off" else "Turn on", enabled = s.offlineAccount != null) { a.onOffline() }
}
}
SettingsGroup("Application") {
ActionRow("Linux runtime", "${s.installed ?: "Not installed"}${if (s.available != null && s.available != s.installed) " · update available" else ""}", runtime, a.onRuntime)
SettingsRow("Theme", "Choose the launcher appearance") {
Box {
ValueChip(Themes.byId(s.theme).label, host.open == "theme") { host.open = if (host.open == "theme") null else "theme" }
AnchoredMenu(host.open == "theme", onDismiss = { if (host.open == "theme") host.open = null }, title = "Theme") {
for (t in Themes.all) MenuItem(t.label, checked = s.theme == t.id) { a.onTheme(t.id); host.open = null }
}
}
}
ActionRow("Default Home app", s.defaultHomeLabel ?: "Choose a Home app", "Choose", a.onHomeApp)
}
}
}
}
private class Tile(
val title: String, val sub: String?, val art: File?, val key: String,
val iconRes: Int? = null, val dim: Boolean = false, val iconBitmap: Bitmap? = null,
@@ -13,16 +13,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@Composable
fun EmulatorHelpDialog(onDismiss: () -> Unit) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text("Emulators") },
text = { Text("Put games in /root/ROMs. Install RPCS3 firmware from File > Install Firmware.") },
confirmButton = { TextButton(onClick = onDismiss) { Text("OK") } },
)
}
@Composable
fun ConfirmDialog(title: String, text: String, confirm: String, onConfirm: () -> Unit, onDismiss: () -> Unit) {
AlertDialog(
@@ -0,0 +1,8 @@
package com.steamdeck.launcher.ui
/** Package metadata shown on an emulator's own detail page. */
class PackageRow(
val id: String,
val kind: String,
val notes: String,
)
@@ -1,64 +0,0 @@
package com.steamdeck.launcher.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
class ProtonRow(val id: String, val name: String, val installed: String?, val queued: Boolean)
@Composable
fun ProtonDialog(
rows: List<ProtonRow>,
onInstall: (String) -> Unit,
onCancel: (String) -> Unit,
onRemove: (String) -> Unit,
onDismiss: () -> Unit,
) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text("Compatibility tools") },
text = {
Column {
Text(
"Adds ARM64 Proton builds. Downloads at next session start; select per game in Steam > Properties > Compatibility.",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.height(10.dp))
for (row in rows) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) {
Column(modifier = Modifier.weight(1f)) {
Text(row.name, style = MaterialTheme.typography.bodyMedium)
Text(
when {
row.installed != null -> "installed: ${row.installed}"
row.queued -> "installs at the next session start"
else -> "not installed"
},
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
when {
row.installed != null -> TextButton(onClick = { onRemove(row.id) }) { Text("Remove") }
row.queued -> TextButton(onClick = { onCancel(row.id) }) { Text("Cancel") }
else -> TextButton(onClick = { onInstall(row.id) }) { Text("Install") }
}
}
}
}
},
confirmButton = { TextButton(onClick = onDismiss) { Text("OK") } },
)
}
@@ -0,0 +1,81 @@
package com.steamdeck.launcher.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
class ProtonRow(val id: String, val name: String, val installed: String?, val queued: Boolean)
@Composable
fun ProtonPage(
rows: List<ProtonRow>,
busyId: String?,
stage: String?,
percent: Int,
runtimeReady: Boolean,
sessionRunning: Boolean,
onInstall: (String) -> Unit,
onCancel: (String) -> Unit,
onRemove: (String) -> Unit,
onBack: () -> Unit,
) {
val host = rememberMenuHost()
val colors = MaterialTheme.colorScheme
SettingsPage(
host,
title = "Compatibility tools",
eyebrow = "Setup",
lede = "Download and install an ARM64 Proton build now, then select it per game in Steam > Properties > Compatibility.",
onBack = onBack,
) {
if (!runtimeReady) Text(
"Install the Linux runtime from Setup before managing compatibility tools.",
fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp, bottom = 6.dp),
)
if (sessionRunning) Text(
"Stop the active session before installing or removing a compatibility tool.",
fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 8.dp, bottom = 6.dp),
)
SettingsGroup("Available builds") {
for (row in rows) {
SettingsRow(
row.name,
when {
row.installed != null -> "Installed ${row.installed}"
row.queued -> "Pending from an earlier request"
else -> "Not installed"
},
) {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
when {
row.installed != null -> SecondaryButton("Remove", enabled = busyId == null && runtimeReady && !sessionRunning) { onRemove(row.id) }
busyId != null -> SecondaryButton(if (busyId == row.id) "Installing…" else "Install", enabled = false) {}
else -> SecondaryButton("Install now", enabled = runtimeReady && !sessionRunning) { onInstall(row.id) }
}
if (row.queued && row.installed == null && busyId == null) {
SecondaryButton("Cancel queued", enabled = !sessionRunning) { onCancel(row.id) }
}
}
}
if (busyId == row.id) Column(modifier = Modifier.fillMaxWidth().padding(start = 12.dp, end = 12.dp, bottom = 10.dp)) {
Text(
if (stage != null && percent >= 0) "$stage · $percent%" else stage ?: "Starting…",
fontSize = 11.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(bottom = 5.dp),
)
if (percent >= 0) LinearProgressIndicator(progress = { percent / 100f }, modifier = Modifier.fillMaxWidth().height(4.dp))
else LinearProgressIndicator(modifier = Modifier.fillMaxWidth().height(4.dp))
}
}
}
}
}
@@ -159,7 +159,6 @@ class DrawerActions(
val onKeyboard: () -> Unit,
val onSteamMenu: (() -> Unit)?,
val onQam: (() -> Unit)?,
val onProtons: () -> Unit,
val onOsc: (String) -> Unit,
val onTouch: (String) -> Unit,
val onShape: (String) -> Unit,
@@ -331,7 +330,6 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
host, "fex", "FEX preset", null,
FexPreset.all.map { it.id to it.label }, a.fexPreset, note = FexPreset.byId(a.fexPreset).detail, onPick = a.onFexPreset,
)
if (a.steam) ActionRow("Compatibility tools", null, "Manage") { host.open = null; a.onProtons() }
}
Spacer(Modifier.height(18.dp))