feat(ui): Decky and Boot movies get their own tabs, with a Decky plugin store (#3068)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-23 09:59:58 -05:00
1 parent d5b9cf5b41
commit 3e558ab33e
49 files changed
+538 -248

No files matched your search

@@ -6,6 +6,7 @@ import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.droiddeck.launcher.runtime.DeckyManager
import com.droiddeck.launcher.runtime.DeckyStore
import com.droiddeck.launcher.session.SessionState
import java.io.File
@@ -21,6 +22,59 @@ internal class DeckyMenu(private val activity: android.app.Activity, private val
var deckySupervisor by mutableStateOf(false)
var deckyPendingZip by mutableStateOf<File?>(null)
var deckyReleaseRequest = 0
var deckyPlugins by mutableStateOf<List<DeckyStore.Installed>>(emptyList())
var deckyStore by mutableStateOf<List<DeckyStore.Plugin>?>(null)
var deckyStoreFailed by mutableStateOf(false)
private var storeRequest = 0
fun refreshPlugins() {
Thread({
val found = DeckyStore.installed(activity)
ui.post { deckyPlugins = found }
}, "decky-plugins").start()
}
fun refreshStore() {
val request = ++storeRequest
deckyStore = null; deckyStoreFailed = false
Thread({
val listing = DeckyStore.fetch()
ui.post {
if (request != storeRequest) return@post
deckyStore = listing.orEmpty(); deckyStoreFailed = listing == null
}
}, "decky-store").start()
}
fun installStorePlugin(plugin: DeckyStore.Plugin) {
val version = plugin.latest ?: return
if (deckyStage != null || SessionState.running || deckyInstalled == null) return
deckyStage = activity.getString(R.string.decky_plugin_starting); deckyPercent = -1
Thread({
val problem = runCatching {
DeckyStore.install(activity, plugin, version) { label, value ->
val binary = DeckyManager.downloadingBinary
ui.post { deckyStage = label; deckyPercent = value; deckyDownloadingBinary = binary }
}
}.getOrElse { error -> activity.getString(R.string.decky_plugin_failed, error.message ?: error.javaClass.simpleName) }
ui.post {
deckyStage = null; deckyPercent = -1; deckyDownloadingBinary = false
android.widget.Toast.makeText(activity, problem ?: activity.getString(R.string.decky_plugin_installed), android.widget.Toast.LENGTH_LONG).show()
refreshPlugins()
}
}, "install-decky-store").start()
}
fun removePlugin(plugin: DeckyStore.Installed) {
if (deckyStage != null || SessionState.running) return
Thread({
val problem = DeckyStore.remove(activity, plugin)
ui.post {
if (problem != null) android.widget.Toast.makeText(activity, problem, android.widget.Toast.LENGTH_LONG).show()
refreshPlugins()
}
}, "remove-decky-plugin").start()
}
fun refreshDecky() {
val request = ++deckyReleaseRequest
@@ -90,6 +144,7 @@ internal class DeckyMenu(private val activity: android.app.Activity, private val
deckyStage = null; deckyPercent = -1; deckyDownloadingBinary = false
val message = problem ?: activity.getString(R.string.decky_plugin_installed)
android.widget.Toast.makeText(activity, message, android.widget.Toast.LENGTH_LONG).show()
refreshPlugins()
}
}, "import-decky-plugin").start()
}
@@ -921,7 +921,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
request.getStringExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV)?.let { navRequest = it; request.removeExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV) }
request.data?.takeIf { it.scheme == "droiddeck" && it.host == "settings" }?.let { uri ->
val section = uri.pathSegments.firstOrNull()
navRequest = if (section in setOf("storage", "sync", "downloads")) section
navRequest = if (section in setOf("storage", "sync", "downloads", "decky", "boot-movies")) section
else "settings:" + (com.droiddeck.launcher.ui.SettingsSection.of(section) ?: com.droiddeck.launcher.ui.SettingsSection.OVERVIEW).key
request.data = null
gameLinkReading = false
@@ -2690,6 +2690,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
deckyChecking = decky.deckyChecking, deckyStage = decky.deckyStage, deckyPercent = decky.deckyPercent,
deckyDownloadingBinary = decky.deckyDownloadingBinary,
deckyEnabled = decky.deckySupervisor, deckySessionRunning = SessionState.running,
deckyPlugins = decky.deckyPlugins, deckyStore = decky.deckyStore, deckyStoreFailed = decky.deckyStoreFailed,
),
ModeSettingsActions(
onIntegration = ::configureIntegration,
@@ -2800,6 +2801,9 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
decky.deckyInstalled = null
decky.deckySupervisor = false
},
onDeckyStoreRefresh = { decky.refreshStore() },
onDeckyStoreInstall = { plugin -> decky.installStorePlugin(plugin) },
onDeckyRemove = { plugin -> decky.removePlugin(plugin) },
onPickDeckyPluginZip = {
pickDeckyPluginZip.launch(InAppFilePicker.buildIntent(this, ZIP_EXT, getString(R.string.main_pick_decky_zip)))
},
@@ -3090,6 +3094,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
decky.deckyInstalled = deckyInstalled
decky.deckySupervisor = deckySupervisor
decky.refreshDecky()
decky.refreshPlugins()
}
fetchAddedGameArt()
}
@@ -0,0 +1,102 @@
package com.droiddeck.launcher.runtime
import android.content.Context
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.core.Downloader
import com.droiddeck.launcher.session.SessionState
import java.io.File
import org.json.JSONArray
import org.json.JSONObject
object DeckyStore {
private const val TAG = "DeckyStore"
private const val LISTING = "https://plugins.deckbrew.xyz/plugins"
private const val ARTIFACTS = "https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/"
data class Version(val name: String, val hash: String)
data class Plugin(val name: String, val author: String, val description: String, val tags: List<String>, val downloads: Long, val imageUrl: String, val versions: List<Version>) {
val latest: Version? get() = versions.firstOrNull()
}
data class Installed(val name: String, val folder: String, val author: String, val version: String)
fun parseListing(body: String): List<Plugin> {
val array = JSONArray(body)
return (0 until array.length()).mapNotNull { i ->
val row = array.optJSONObject(i) ?: return@mapNotNull null
val name = row.optString("name").takeIf { it.isNotBlank() } ?: return@mapNotNull null
val versions = row.optJSONArray("versions")?.let { list ->
(0 until list.length()).mapNotNull { v ->
val version = list.optJSONObject(v) ?: return@mapNotNull null
val hash = version.optString("hash")
if (!hash.matches(Regex("(?i)[0-9a-f]{64}"))) null else Version(version.optString("name"), hash.lowercase())
}
}.orEmpty()
if (versions.isEmpty()) return@mapNotNull null
val tags = row.optJSONArray("tags")?.let { list -> (0 until list.length()).map { list.optString(it) } }.orEmpty()
val downloads = row.optJSONArray("versions")?.let { list -> (0 until list.length()).sumOf { list.optJSONObject(it)?.optLong("downloads") ?: 0L } } ?: 0L
val image = row.optString("image_url").takeIf { it.startsWith("https://") }.orEmpty()
Plugin(name, row.optString("author"), row.optString("description"), tags, downloads, image, versions)
}
}
fun fetch(): List<Plugin>? {
val body = Downloader.downloadString(LISTING) ?: return null
return runCatching { parseListing(body) }.onFailure { Log.w(TAG, "store listing", it) }.getOrNull()
}
fun pluginsDir(context: Context) = File(LinuxRuntime.rootDir(context), "root/homebrew/plugins")
fun installed(context: Context): List<Installed> =
pluginsDir(context).listFiles().orEmpty()
.filter { it.isDirectory && !it.name.startsWith(".droiddeck-") }
.mapNotNull { folder ->
runCatching {
val meta = JSONObject(File(folder, "plugin.json").readText())
val version = runCatching { JSONObject(File(folder, "package.json").readText()).optString("version") }.getOrDefault("")
Installed(meta.getString("name"), folder.name, meta.optString("author"), version)
}.getOrNull()
}
.sortedBy { it.name.lowercase() }
fun updateAvailable(installed: Installed, plugin: Plugin?): Boolean {
val latest = plugin?.latest?.name ?: return false
return installed.version.isNotEmpty() && latest != installed.version
}
fun install(context: Context, plugin: Plugin, version: Version, progress: (String, Int) -> Unit): String? {
if (SessionState.running) return context.getString(R.string.deckymgr_stop_session_plugin)
if (DeckyManager.installed(context) == null) return context.getString(R.string.deckymgr_loader_required)
val cache = File(context.cacheDir, "decky-store").apply { mkdirs() }
val zip = File(cache, "${version.hash}.zip")
try {
val label = context.getString(R.string.decky_store_downloading, plugin.name)
progress(label, -1)
val ok = Downloader.downloadFile("$ARTIFACTS${version.hash}.zip", zip, true, version.hash) { fraction ->
progress(label, if (fraction < 0) -1 else (fraction * 100).toInt().coerceIn(0, 100))
}
if (!ok) return context.getString(R.string.decky_store_download_failed, plugin.name)
return DeckyManager.installPluginZip(context, zip, progress)
} finally {
zip.delete()
}
}
fun remove(context: Context, plugin: Installed): String? {
if (SessionState.running) return context.getString(R.string.deckymgr_stop_session_plugin)
val plugins = pluginsDir(context)
val folder = File(plugins, plugin.folder)
if (folder.parentFile?.canonicalFile != plugins.canonicalFile) return context.getString(R.string.decky_store_remove_failed)
if (!folder.deleteRecursively()) return context.getString(R.string.decky_store_remove_failed)
val settings = File(plugins.parentFile, "settings/loader.json")
runCatching {
val json = JSONObject(settings.readText())
for (key in listOf("pluginOrder", "frozenPlugins", "hiddenPlugins", "disabled_plugins")) {
val values = json.optJSONArray(key) ?: continue
json.put(key, JSONArray((0 until values.length()).map { values.get(it) }.filter { it != plugin.name }))
}
settings.writeText(json.toString(4))
}
return null
}
}
@@ -117,7 +117,7 @@ private fun rememberMovies(refresh: Int, onSelectionChanged: () -> Unit): MovieS
}
@Composable
private fun TabChip(label: String, selected: Boolean, modifier: Modifier = Modifier, onClick: () -> Unit) {
internal fun TabChip(label: String, selected: Boolean, modifier: Modifier = Modifier, onClick: () -> Unit) {
val pal = LocalPalette.current
val src = remember { MutableInteractionSource() }
val hot = rememberHot(src)
@@ -0,0 +1,16 @@
package com.droiddeck.launcher.ui
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.addPathNodes
import androidx.compose.ui.unit.dp
internal val DeckyIcon: ImageVector = ImageVector.Builder("Decky", 24.dp, 24.dp, 24f, 24f).apply {
for (d in listOf(
"M8,2h2v6H8Z",
"M14,2h2v6h-2Z",
"M5,8h14v3a7,7 0 0 1 -5,6.7V19h-4v-1.3A7,7 0 0 1 5,11Z",
"M11,19h2v3h-2Z",
)) addPath(addPathNodes(d), fill = SolidColor(Color.Black))
}.build()
@@ -0,0 +1,245 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import coil.compose.AsyncImage
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Search
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.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.droiddeck.launcher.R
import com.droiddeck.launcher.runtime.DeckyManager
import com.droiddeck.launcher.runtime.DeckyStore
private enum class DeckyTab { INSTALLED, STORE, ZIP }
private const val STORE_PAGE = 30
internal fun deckyStoreMatches(plugins: List<DeckyStore.Plugin>, query: String): List<DeckyStore.Plugin> {
val words = query.trim().lowercase().split(Regex("\\s+")).filter { it.isNotEmpty() }
return plugins.filter { p ->
val haystack = (p.name + " " + p.author + " " + p.description + " " + p.tags.joinToString(" ")).lowercase()
words.all { it in haystack }
}.sortedByDescending { it.downloads }
}
@Composable
internal fun DeckyGroups(s: ModeSettings, a: ModeSettingsActions, host: MenuHost) {
val idle = s.deckyStage == null && !s.deckySessionRunning
SettingsGroup(stringResource(R.string.mode_decky_loader)) {
val updateAvailable = s.deckyInstalled != null && s.deckyLatestRelease != null &&
s.deckyInstalled != s.deckyLatestRelease.tag
val status = when {
s.deckyStage != null -> s.deckyStage
s.deckyChecking -> stringResource(R.string.mode_decky_checking)
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_ready, s.deckyLatestRelease.tag)
s.deckyInstalled == null -> stringResource(R.string.mode_decky_none)
s.deckyLatestRelease == null -> stringResource(R.string.mode_decky_installed, s.deckyInstalled)
updateAvailable -> stringResource(R.string.mode_decky_update, s.deckyLatestRelease.tag)
else -> stringResource(R.string.mode_decky_current, s.deckyInstalled)
}
SettingsRow(stringResource(R.string.decky_status), status) {
val action = when {
s.deckyStage != null -> stringResource(R.string.common_working)
s.deckyChecking -> stringResource(R.string.common_checking)
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_install_latest)
s.deckyInstalled != null && updateAvailable -> stringResource(R.string.common_update)
else -> stringResource(R.string.common_check)
}
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
SecondaryButton(action, enabled = s.deckyStage == null && !s.deckyChecking && !s.deckySessionRunning) {
if (s.deckyLatestRelease == null || (s.deckyInstalled != null && !updateAvailable)) a.onDeckyCheck()
else s.deckyLatestRelease?.let(a.onDeckyInstall)
}
if (s.deckyInstalled != null) DeckyUninstall(enabled = idle, onUninstall = a.onDeckyUninstall)
}
}
if (s.deckyInstalled != null) ToggleRow(
host, "decky-enabled", stringResource(R.string.decky_enable),
null,
s.deckyEnabled,
enabled = idle,
onChange = a.onDeckyEnabled,
)
ChoiceRow(
host, "decky-channel", stringResource(R.string.decky_release_channel),
null,
listOf(
DeckyManager.BRANCH_STABLE to stringResource(R.string.decky_channel_stable),
DeckyManager.BRANCH_PRERELEASE to stringResource(R.string.decky_channel_prerelease),
) + if (s.deckyBranch == DeckyManager.BRANCH_TESTING) listOf(
DeckyManager.BRANCH_TESTING to stringResource(R.string.decky_channel_testing),
) else emptyList(),
s.deckyBranch,
enabled = idle,
onPick = a.onDeckyBranch,
)
if (s.deckyStage != null && s.deckyPercent >= 0) {
LinearProgressIndicator(
progress = { s.deckyPercent / 100f },
modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 8.dp),
)
}
}
if (s.deckyInstalled == null) return
var tab by rememberSaveable { mutableStateOf(DeckyTab.INSTALLED) }
SettingsGroup(stringResource(R.string.mode_decky_plugins)) {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 10.dp)) {
TabChip(stringResource(R.string.decky_tab_installed, s.deckyPlugins.size), tab == DeckyTab.INSTALLED, Modifier.weight(1f)) { tab = DeckyTab.INSTALLED }
TabChip(stringResource(R.string.decky_tab_store), tab == DeckyTab.STORE, Modifier.weight(1f)) { tab = DeckyTab.STORE }
TabChip(stringResource(R.string.decky_tab_zip), tab == DeckyTab.ZIP, Modifier.weight(1f)) { tab = DeckyTab.ZIP }
}
LaunchedEffect(tab) { if (tab != DeckyTab.ZIP && s.deckyStore == null && !s.deckyStoreFailed) a.onDeckyStoreRefresh() }
when (tab) {
DeckyTab.INSTALLED -> InstalledPlugins(s, a, idle)
DeckyTab.STORE -> PluginStore(s, a, idle)
DeckyTab.ZIP -> SettingsRow(
stringResource(R.string.decky_tab_zip),
stringResource(R.string.mode_decky_plugins_hint),
) {
SecondaryButton(
if (s.deckyStage != null && s.deckyDownloadingBinary) stringResource(R.string.mode_decky_plugin_downloading) else stringResource(R.string.mode_decky_plugin_install_zip),
enabled = idle,
modifier = Modifier.testTag("decky-install-zip"),
onClick = a.onPickDeckyPluginZip,
)
}
}
}
}
@Composable
private fun InstalledPlugins(s: ModeSettings, a: ModeSettingsActions, idle: Boolean) {
var removing by remember { mutableStateOf<DeckyStore.Installed?>(null) }
if (s.deckyPlugins.isEmpty()) {
Text(stringResource(R.string.decky_none_installed), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp))
}
for (plugin in s.deckyPlugins) {
val listed = s.deckyStore?.firstOrNull { it.name == plugin.name }
val update = listed?.takeIf { DeckyStore.updateAvailable(plugin, it) }
PluginRow(
plugin.name,
listOf(plugin.version, plugin.author).filter { it.isNotBlank() }.joinToString(" · ") +
(update?.latest?.let { " · " + stringResource(R.string.decky_update_to, it.name) } ?: ""),
listed?.imageUrl.orEmpty(),
) {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
if (update != null) SecondaryButton(stringResource(R.string.common_update), enabled = idle, compact = true) { a.onDeckyStoreInstall(update) }
SecondaryButton(stringResource(R.string.decky_remove), enabled = idle, compact = true, modifier = Modifier.testTag("decky-remove-${plugin.folder}")) { removing = plugin }
}
}
}
if (s.deckyPlugins.isNotEmpty()) Text(stringResource(R.string.decky_changes_next_session), fontSize = 12.sp,
color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp))
removing?.let { plugin ->
androidx.compose.material3.AlertDialog(
onDismissRequest = { removing = null },
title = { Text(stringResource(R.string.decky_remove_confirm, plugin.name)) },
text = { Text(stringResource(R.string.decky_remove_confirm_body)) },
confirmButton = { androidx.compose.material3.TextButton(onClick = { removing = null; a.onDeckyRemove(plugin) }) { Text(stringResource(R.string.decky_remove)) } },
dismissButton = { androidx.compose.material3.TextButton(onClick = { removing = null }) { Text(stringResource(R.string.common_cancel)) } },
)
}
}
@Composable
private fun PluginStore(s: ModeSettings, a: ModeSettingsActions, idle: Boolean) {
var query by rememberSaveable { mutableStateOf("") }
var searching by remember { mutableStateOf(false) }
var shown by rememberSaveable { mutableIntStateOf(STORE_PAGE) }
val plugins = s.deckyStore
Column(verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp).padding(bottom = 12.dp)) {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth()) {
Box(Modifier.weight(1f)) {
ListRow(tall = true, onClick = { searching = true }) {
androidx.compose.material3.Icon(Icons.Filled.Search, contentDescription = null,
tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(18.dp))
Text(
query.ifEmpty { stringResource(R.string.decky_store_search) }, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis,
color = if (query.isEmpty()) MaterialTheme.colorScheme.onSurfaceVariant else MaterialTheme.colorScheme.onBackground,
modifier = Modifier.weight(1f),
)
}
}
if (query.isNotEmpty()) SecondaryButton(stringResource(R.string.boot_movie_repo_clear), compact = true) { query = ""; shown = STORE_PAGE }
}
when {
plugins == null -> Text(stringResource(R.string.common_working), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(vertical = 12.dp))
s.deckyStoreFailed -> Row(verticalAlignment = androidx.compose.ui.Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Text(stringResource(R.string.decky_store_failed), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.weight(1f))
SecondaryButton(stringResource(R.string.boot_movie_repo_retry), compact = true) { a.onDeckyStoreRefresh() }
}
else -> {
val matches = remember(plugins, query) { deckyStoreMatches(plugins, query) }
if (matches.isEmpty()) Text(stringResource(R.string.decky_store_empty), fontSize = 13.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(vertical = 12.dp))
for (plugin in matches.take(shown)) {
val have = s.deckyPlugins.firstOrNull { it.name == plugin.name }
val current = have != null && !DeckyStore.updateAvailable(have, plugin)
PluginRow(
plugin.name,
listOf(plugin.latest?.name.orEmpty(), plugin.author, plugin.description).filter { it.isNotBlank() }.joinToString(" · "),
plugin.imageUrl,
) {
SecondaryButton(
stringResource(when { current -> R.string.setup_installed; have != null -> R.string.common_update; else -> R.string.boot_movie_repo_install }),
enabled = idle && !current, compact = true,
modifier = Modifier.testTag("decky-store-${plugin.name}"),
) { a.onDeckyStoreInstall(plugin) }
}
}
if (matches.size > shown) SecondaryButton(stringResource(R.string.decky_store_more, matches.size - shown), compact = true) { shown += STORE_PAGE }
}
}
}
if (searching) TextEntryDialog(
stringResource(R.string.decky_store_search), query, number = false, confirm = stringResource(R.string.stores_search_open),
onSubmit = { query = it; shown = STORE_PAGE; searching = false }, onDismiss = { searching = false }, id = "decky-store-entry",
)
}
@Composable
private fun PluginRow(name: String, detail: String, imageUrl: String, actions: @Composable () -> Unit) {
val colors = MaterialTheme.colorScheme
Column(verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 10.dp)) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = androidx.compose.ui.Alignment.CenterVertically) {
val shape = RoundedCornerShape(8.dp)
Box(Modifier.width(96.dp).aspectRatio(16f / 9f).clip(shape).background(Color(0xFF0E1218))) {
if (imageUrl.isNotEmpty()) AsyncImage(model = imageUrl, contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.fillMaxSize())
}
Column(Modifier.weight(1f)) {
Text(name, fontSize = 15.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(detail, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
}
Row(horizontalArrangement = Arrangement.End, modifier = Modifier.fillMaxWidth()) { actions() }
}
}
@@ -263,6 +263,10 @@ private fun Content(
SyncTabPage(s, modifier.padding(horizontal = padH).padding(top = padV))
return
}
if (selected == "decky" || selected == "boot-movies") {
SteamTabPage(selected, a, modifier.padding(horizontal = padH).padding(top = padV))
return
}
if (selected == "updates") {
UpdatesPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
return
@@ -56,6 +56,7 @@ import androidx.compose.material.icons.filled.Terminal
import androidx.compose.material.icons.filled.Apps
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.SdStorage
import androidx.compose.material.icons.filled.Movie
import androidx.compose.material.icons.filled.Sync
import androidx.compose.material.icons.filled.MoreHoriz
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
@@ -206,6 +207,8 @@ internal fun railLabelIcon(key: String): Pair<Int, ImageVector> = when (key) {
"setup" -> R.string.rail_setup to Icons.Filled.Settings
"storage" -> R.string.rail_storage to Icons.Filled.SdStorage
"sync" -> R.string.rail_sync to Icons.Filled.Sync
"decky" -> R.string.rail_decky to DeckyIcon
"boot-movies" -> R.string.rail_boot_movies to Icons.Filled.Movie
NavTabs.MORE -> R.string.rail_more to Icons.Filled.MoreHoriz
else -> R.string.rail_updates to updatesIcon(RunningBuild.kind())
}
@@ -126,6 +126,8 @@ internal object SheetTab {
const val LIBRARY = "library"
const val STEAM = "steam"
const val FILES = "files"
const val DECKY = "decky"
const val BOOT_MOVIES = "boot-movies"
}
internal fun sheetTop(paneH: Float, buttonH: Float, minAbove: Float, ride: Float): Float =
@@ -113,6 +113,9 @@ class ModeSettings(
val deckyDownloadingBinary: Boolean = false,
val deckyEnabled: Boolean = false,
val deckySessionRunning: Boolean = false,
val deckyPlugins: List<com.droiddeck.launcher.runtime.DeckyStore.Installed> = emptyList(),
val deckyStore: List<com.droiddeck.launcher.runtime.DeckyStore.Plugin>? = null,
val deckyStoreFailed: Boolean = false,
)
class ModeSettingsActions(
@@ -171,6 +174,9 @@ class ModeSettingsActions(
val onDeckyEnabled: (Boolean) -> Unit = {},
val onDeckyUninstall: () -> Unit = {},
val onPickDeckyPluginZip: () -> Unit = {},
val onDeckyStoreRefresh: () -> Unit = {},
val onDeckyStoreInstall: (com.droiddeck.launcher.runtime.DeckyStore.Plugin) -> Unit = {},
val onDeckyRemove: (com.droiddeck.launcher.runtime.DeckyStore.Installed) -> Unit = {},
val onDismiss: () -> Unit,
)
@@ -220,6 +226,8 @@ class SheetExtras(
fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras: SheetExtras = SheetExtras()) {
val steam = s.mode == SessionService.MODE_STEAM
val host = rememberMenuHost()
if (tab == SheetTab.DECKY) { DeckyGroups(s, a, host); return }
if (tab == SheetTab.BOOT_MOVIES) { if (s.bootMovie != null) BootMovieGroup(s, a, host); return }
Text(
stringResource(when (s.mode) {
SessionService.MODE_STEAM -> R.string.sheet_scope_steam
@@ -509,75 +517,6 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
}
if (tab == SheetTab.STEAM && steam) {
extras.account(host)
SettingsGroup(stringResource(R.string.mode_decky)) {
val updateAvailable = s.deckyInstalled != null && s.deckyLatestRelease != null &&
s.deckyInstalled != s.deckyLatestRelease.tag
val status = when {
s.deckyStage != null -> s.deckyStage
s.deckyChecking -> stringResource(R.string.mode_decky_checking)
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_ready, s.deckyLatestRelease.tag)
s.deckyInstalled == null -> stringResource(R.string.mode_decky_none)
s.deckyLatestRelease == null -> stringResource(R.string.mode_decky_installed, s.deckyInstalled)
updateAvailable -> stringResource(R.string.mode_decky_update, s.deckyLatestRelease.tag)
else -> stringResource(R.string.mode_decky_current, s.deckyInstalled)
}
SettingsRow(stringResource(R.string.mode_decky_loader), status) {
val action = when {
s.deckyStage != null -> stringResource(R.string.common_working)
s.deckyChecking -> stringResource(R.string.common_checking)
s.deckyInstalled == null && s.deckyLatestRelease != null -> stringResource(R.string.mode_decky_install_latest)
s.deckyInstalled != null && updateAvailable -> stringResource(R.string.common_update)
else -> stringResource(R.string.common_check)
}
Row(horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(6.dp)) {
SecondaryButton(
action,
enabled = s.deckyStage == null && !s.deckyChecking && !s.deckySessionRunning,
) {
if (s.deckyLatestRelease == null || (s.deckyInstalled != null && !updateAvailable)) a.onDeckyCheck()
else s.deckyLatestRelease?.let(a.onDeckyInstall)
}
if (s.deckyInstalled != null) DeckyUninstall(enabled = s.deckyStage == null && !s.deckySessionRunning, onUninstall = a.onDeckyUninstall)
}
}
ChoiceRow(
host, "decky-channel", stringResource(R.string.decky_channel),
stringResource(R.string.decky_channel_hint),
listOf(
DeckyManager.BRANCH_STABLE to stringResource(R.string.decky_channel_stable),
DeckyManager.BRANCH_PRERELEASE to stringResource(R.string.decky_channel_prerelease),
) + if (s.deckyBranch == DeckyManager.BRANCH_TESTING) listOf(
DeckyManager.BRANCH_TESTING to stringResource(R.string.decky_channel_testing),
) else emptyList(),
s.deckyBranch,
enabled = s.deckyStage == null && !s.deckySessionRunning,
onPick = a.onDeckyBranch,
)
if (s.deckyInstalled != null) ToggleRow(
host, "decky-enabled", stringResource(R.string.mode_decky),
if (s.deckyEnabled) stringResource(R.string.mode_decky_on)
else stringResource(R.string.mode_decky_off),
s.deckyEnabled,
enabled = !s.deckySessionRunning && s.deckyStage == null,
onChange = a.onDeckyEnabled,
)
SettingsRow(
stringResource(R.string.mode_decky_plugins),
stringResource(R.string.mode_decky_plugins_hint),
) {
SecondaryButton(
if (s.deckyStage != null && s.deckyDownloadingBinary) stringResource(R.string.mode_decky_plugin_downloading) else stringResource(R.string.mode_decky_plugin_install_zip),
enabled = s.deckyInstalled != null && s.deckyStage == null && !s.deckySessionRunning,
onClick = a.onPickDeckyPluginZip,
)
}
if (s.deckyStage != null && s.deckyPercent >= 0) {
LinearProgressIndicator(
progress = { s.deckyPercent / 100f },
modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 8.dp),
)
}
}
SettingsGroup(stringResource(R.string.mode_client)) {
ToggleRow(
host, "mangoapp", stringResource(R.string.mode_mangoapp),
@@ -607,7 +546,6 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
onPick = a.onSteamClientArch,
)
}
if (s.bootMovie != null) BootMovieGroup(s, a, host)
if (s.integration != null) SteamIntegrationGroup(s.integration,
onFeature = a.onIntegration, onAppInfo = a.onIntegrationAppInfo, onLocation = a.onIntegrationLocation)
}
@@ -669,7 +607,7 @@ internal fun DeckyZipWarningDialog(onConfirm: () -> Unit, onCancel: () -> Unit)
private const val DECKY_ZIP_WARNING_SECONDS = 5
@Composable
private fun DeckyUninstall(enabled: Boolean, onUninstall: () -> Unit) {
internal fun DeckyUninstall(enabled: Boolean, onUninstall: () -> Unit) {
val colors = MaterialTheme.colorScheme
val label = stringResource(R.string.common_uninstall)
val title = stringResource(R.string.mode_decky_remove_title)
@@ -26,10 +26,10 @@ internal object DeveloperTools {
internal object NavTabs {
const val MORE = "more"
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "android-apps", "agent")
val DEFAULT_SHELVED = setOf("stores", "soundtracks", "components", "storage", "sync", "android-apps", "agent")
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
val DEFAULT_SHELVED = setOf("stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
val DEFAULT_HIDDEN = setOf("android-apps", "agent")
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "android-apps", "agent")
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "android-apps", "agent")
private val OLD_ORDER = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates")
private val OLD_SHELVED = setOf("soundtracks", "agent", "storage", "sync")
private const val LAYOUT_VERSION = 2
@@ -75,6 +75,19 @@ internal fun SyncTabPage(s: FrontEndState, modifier: Modifier) {
}
}
@Composable
internal fun SteamTabPage(key: String, a: FrontEndActions, modifier: Modifier) {
LaunchedEffect(Unit) { a.onSteamSettings() }
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
PageHeader(stringResource(if (key == "decky") R.string.rail_decky else R.string.rail_boot_movies))
a.modeSheet(
com.droiddeck.launcher.session.SessionService.MODE_STEAM,
if (key == "decky") SheetTab.DECKY else SheetTab.BOOT_MOVIES,
SheetExtras(),
)
}
}
@Composable
private fun ResetTabsRow() {
val ctx = androidx.compose.ui.platform.LocalContext.current
@@ -93,6 +93,8 @@ internal object SettingsIndex {
s(SettingsSection.CONTROLLER, R.string.setup_tab_controller, "gamepad", "buttons", "mapping", "profile", "remap"),
SettingsEntry(SettingsPlace.TAB, R.string.rail_storage, tab = "storage", words = listOf("sd card", "space", "uninstall", "disk")),
SettingsEntry(SettingsPlace.TAB, R.string.rail_sync, tab = "sync", words = listOf("syncthing", "saves")),
SettingsEntry(SettingsPlace.TAB, R.string.rail_decky, tab = "decky", words = listOf("plugins", "plugin store", "homebrew", "loader")),
SettingsEntry(SettingsPlace.TAB, R.string.rail_boot_movies, tab = "boot-movies", words = listOf("startup movie", "boot video", "animation", "steamdeckrepo")),
s(SettingsSection.GLASSES, R.string.setup_tab_glasses, "xreal", "viture", "vr", "ar"),
s(SettingsSection.LAUNCHER, R.string.setup_theme, "color", "dark"),