feat: components newest first, Steam settings open on Steam with offline mode, smoother chip selection (#606)

* feat: components list newest first, Steam's sheet opens on its Steam tab with offline mode, and Setup's overview drops the account group

* fix: chip selections stretch across on every move, drawn over the chips instead of behind them
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-12 03:25:55 +00:00
1 parent 9836dade79
commit 06269aab24
8 files changed
+33 -23

No files matched your search

@@ -406,9 +406,11 @@ object ComponentsManager {
return Package(f.name, comp, prof.optString("versionName", f.nameWithoutExtension), prof.optString("description"), f.length())
}
/** The stored packages, newest version first. */
fun packages(context: Context): List<Package> = packagesDir(context).listFiles()
?.filter { it.isFile && it.name.endsWith(".wcp") }?.sortedBy { it.name }
?.filter { it.isFile && it.name.endsWith(".wcp") }
?.mapNotNull { f -> runCatching { packageInfo(context, f) }.onFailure { Log.w(TAG, "skipping ${f.name}", it) }.getOrNull() }
?.sortedWith(newestFirst { it.version.ifEmpty { it.file } })
?: emptyList()
/** Unpacks a package's files/ into a Proton; for DXVK/VKD3D the component's own DLLs are replaced as a set. */
@@ -852,10 +854,14 @@ object ComponentsManager {
val arr = o.optJSONArray("items") ?: JSONArray()
val items = (0 until arr.length()).map { arr.getJSONObject(it) }.map {
CatalogItem(it.optString("file"), it.optString("comp"), it.optString("release"), it.optString("url"), it.optLong("size"), it.optString("digest"))
}.sortedWith(compareBy({ it.comp }, { it.release }, { it.file }))
}.sortedWith(compareBy<CatalogItem> { it.comp }.then(newestFirst { it.file }))
return Catalog(items, o.optLong("fetchedAt"))
}
/** By the version in [of], highest first: the newest builds lead a list, as they are what is picked. */
private fun <T> newestFirst(of: (T) -> String): Comparator<T> =
Comparator { a, b -> ProtonExtras.compareVersions(of(b), of(a)) }
/**
* A package Proton does not ship, required on the GPUs listed here. An empty [models] set
* means every model in [families]. A row the user already chose in Components is left alone;
@@ -901,7 +901,6 @@ fun ComponentsPage(
) {
val tint = rememberUpdatedState(pal.signal)
val local = cardsAt[layer]?.translate(-stackAt)
ChipGlide(LAYERS.indexOf(layer), local, tint, GlideAxis.Vertical, corner = 12.dp)
Stack(
layer, view, gpu, focus = layerFocus, landed = landed, rings = rings,
onPlaced = { l, r -> cardsAt[l] = r },
@@ -912,6 +911,8 @@ fun ComponentsPage(
else runCatching { firstRow.requestFocus() }
},
)
// Over the cards: under them, their rest fill hid it as it crossed them.
ChipGlide(LAYERS.indexOf(layer), local, tint, GlideAxis.Vertical, corner = 12.dp)
}
if (!narrow) {
Spacer(Modifier.width(16.dp))
@@ -321,14 +321,6 @@ internal fun SetupPanel(
}
}
}
SettingsGroup(stringResource(R.string.setup_account)) {
accountCheck(true)
ToggleRow(
host, "offline", stringResource(R.string.setup_offline),
s.offlineAccount?.let { if (it.isEmpty()) stringResource(R.string.setup_signed_in_unnamed) else stringResource(R.string.setup_signed_in, it) } ?: stringResource(R.string.setup_sign_in_first),
s.offline, enabled = s.offlineAccount != null,
) { a.onOffline() }
}
SettingsGroup(stringResource(R.string.setup_runtime)) { runtimeCheck(false) }
}
1 -> {
@@ -775,7 +775,6 @@ internal fun SheetChips(labels: List<String>, selected: Int, focus: List<FocusRe
val scroll = rememberScrollState()
// Room inside the scroll for the focus ring, which the scroll's clip would otherwise cut.
Box(if (equal) Modifier.fillMaxWidth() else Modifier.edgeFade(scroll).horizontalScroll(scroll).padding(3.dp)) {
ChipGlide(selected, bounds[selected], tint)
Row(
horizontalArrangement = Arrangement.spacedBy(6.dp),
// Up from the rows lands on the picked chip, not whichever sits above: landing picks.
@@ -790,6 +789,8 @@ internal fun SheetChips(labels: List<String>, selected: Int, focus: List<FocusRe
SheetChip(label, i == selected, m.onFocusChanged { if (it.isFocused && i != selected) onPick(i) }) { onPick(i) }
}
}
// Over the chips: under them, their rest fill hid it as it crossed them.
ChipGlide(selected, bounds[selected], tint)
}
}
}
@@ -159,7 +159,7 @@ class ModeSettingsActions(
* Session (its Files chip is the Desktop page's own).
*/
internal fun modeSheetTabs(steam: Boolean): List<String> =
if (steam) listOf(SheetTab.DISPLAY, SheetTab.CONTROLS, SheetTab.AUDIO, SheetTab.SESSION, SheetTab.LIBRARY, SheetTab.STEAM)
if (steam) listOf(SheetTab.STEAM, SheetTab.DISPLAY, SheetTab.CONTROLS, SheetTab.AUDIO, SheetTab.SESSION, SheetTab.LIBRARY)
else listOf(SheetTab.DISPLAY, SheetTab.CONTROLS, SheetTab.SESSION)
/** A sheet tab's chip label. */
@@ -182,6 +182,8 @@ class SheetExtras(
val frameGen: @Composable () -> Unit = {},
val performance: @Composable () -> Unit = {},
val drivers: @Composable (summary: String?) -> Unit = {},
/** The Steam tab's account rows (offline mode), from the front end's own state. */
val account: @Composable (host: MenuHost) -> Unit = {},
)
/** One tab of a mode's lifted sheet: the rows the settings page had, grouped by what they are for. */
@@ -360,6 +362,7 @@ 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
@@ -46,8 +46,8 @@ internal enum class GlideAxis { Horizontal, Vertical }
/**
* The selection under a row of chips: [at] (in the row) of chip [index], in [tint]. A move to the
* next chip stretches it - the leading edge on the focus ring's lead spring, the trailing one a
* beat later on its trail spring - and a hop past a chip fades it out where it was and in where it
* lands (carried over as a drop, it sat on chips the pad had already left). [axis] runs it down a column instead (the rail, a stack of layers). [corner] is the
* beat later on its trail spring - and a hop past chips stretches the same way, across them.
* Draw it over the chips: under them, their own rest fill hid it in flight. [axis] runs it down a column instead (the rail, a stack of layers). [corner] is the
* chips' own corner; null draws a capsule. [fill] and [outline] are the resting alphas. Not
* [visible], it fades away, and comes back on whichever chip it is on by then.
*/
@@ -97,13 +97,9 @@ internal fun BoxScope.ChipGlide(
return@LaunchedEffect
}
coroutineScope {
if (abs(index - from) > 1) {
// Too far to stretch: out where it is, in where it lands.
shown.animateTo(0f, Motion.tw(90))
pinch.snapTo(0f); start.snapTo(s); end.snapTo(e)
shown.animateTo(1f, Motion.tw(160))
} else {
// An adjacent move can interrupt a long hop while it is still faded.
run {
// Every move stretches across, however far: a long one used to go as a drop (which
// sat on chips already left) and then as a fade (a flash of no fill at all).
launch { pinch.animateTo(0f, Motion.sp(0.6f, 500f)) }
launch { shown.animateTo(1f, Motion.tw(120)) }
val forward = index > from
@@ -92,6 +92,16 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
frameGen = { FrameGenGroup(s, a) },
performance = { PerformanceLink(a, "steam", SheetTab.SESSION) },
drivers = { summary -> DriversLink(a, summary, "steam", back) },
// Offline mode lives with Steam's other settings; Setup only checks the account.
account = { host ->
SettingsGroup(stringResource(R.string.setup_account)) {
ToggleRow(
host, "offline", stringResource(R.string.setup_offline),
s.offlineAccount?.let { if (it.isEmpty()) stringResource(R.string.setup_signed_in_unnamed) else stringResource(R.string.setup_signed_in, it) } ?: stringResource(R.string.setup_sign_in_first),
s.offline, enabled = s.offlineAccount != null,
) { a.onOffline() }
}
},
)
LiftHero(
key = "steam", tabs = tabs,
@@ -392,7 +392,6 @@ private fun FlathubChips(mode: String, modes: List<String>, installed: Int, upda
val bounds = remember { mutableStateMapOf<String, Rect>() }
val tint = rememberUpdatedState(pal.signal)
Box(Modifier.fillMaxWidth()) {
ChipGlide(modes.indexOf(mode), bounds[mode], tint)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
for (m in modes) {
key(m) {
@@ -431,6 +430,8 @@ private fun FlathubChips(mode: String, modes: List<String>, installed: Int, upda
}
}
}
// Over the chips: under them, their rest fill hid it as it crossed them.
ChipGlide(modes.indexOf(mode), bounds[mode], tint)
}
}