fix(settings): restore specialist origins and focus precise search controls

This commit is contained in:
xXJSONDeruloXx committed 2026-10-04 15:29:45 -04:00
1 parent cf556596f0
commit 8035963559
9 files changed
+70 -27

No files matched your search

@@ -525,7 +525,8 @@ class MainActivity : ComponentActivity() {
settingsCategory = (settingsHistory.current as? SettingsDestination.Category)?.category,
settingsMode = sm ?: SessionService.MODE_STEAM,
settingsTarget = (settingsHistory.current as? SettingsDestination.Category)?.target
?: (settingsHistory.current as? SettingsDestination.Performance)?.target,
?: (settingsHistory.current as? SettingsDestination.Performance)?.target
?: (settingsHistory.current as? SettingsDestination.Components)?.target,
requestedRailTab = requestedRailTab,
theme = theme,
isHomeApp = homeAppSelected,
@@ -1018,10 +1019,10 @@ class MainActivity : ComponentActivity() {
)
}
private fun openComponents(focusContent: Boolean = true, tab: String? = null) {
private fun openComponents(focusContent: Boolean = true, tab: String? = null, target: String? = null) {
focusComponentsContent = focusContent
if (tab != null) components.compComp = tab
settingsHistory = settingsHistory.open(SettingsDestination.Components(tab ?: components.compComp))
settingsHistory = settingsHistory.open(SettingsDestination.Components(tab ?: components.compComp, target))
components.refreshComponents(snapshotFirst = true)
drivers.refreshDrivers()
}
@@ -1366,9 +1367,11 @@ class MainActivity : ComponentActivity() {
val entry = com.droiddeck.launcher.ui.SettingsCatalog.entries.firstOrNull { it.target == target }
val mode = entry?.mode ?: SessionService.MODE_STEAM
refreshModeSettings(mode)
settingsHistory = settingsHistory.open(SettingsDestination.Category(category, mode, target))
val categoryTarget = com.droiddeck.launcher.ui.settingsCategoryTarget(target)
settingsHistory = settingsHistory.open(SettingsDestination.Category(category, mode, categoryTarget))
when {
target == "components" || target == "default-proton" -> openComponents(true, "fex")
target == "components" -> openComponents(true, "fex")
target == "default-proton" || target == "editing-proton" -> openComponents(true, "fex", target)
target == "gpu-drivers" -> openComponents(true, com.droiddeck.launcher.ui.GPU_TAB)
target == "protons" -> openProtons()
target == "controller-mapping" -> settingsHistory = settingsHistory.open(SettingsDestination.Mapping)
@@ -125,6 +125,7 @@ fun ComponentsPage(
fun ask(title: String, body: String, verb: Int, action: () -> Unit) { confirmTitle = title; confirmVerb = verb; confirm = body to action }
// The GPU drivers tab's Advanced pages: one driver list on its own, full page.
var driverPage by remember { mutableStateOf<String?>(null) }
val gpuScroll = rememberScrollState()
val gpuTab = comp == GPU_TAB
when (driverPage) {
"rt" -> {
@@ -182,7 +183,7 @@ fun ComponentsPage(
modifier = Modifier.fillMaxWidth().padding(top = 12.dp),
) {
if (view != null && !gpuTab) {
Column {
SettingsAnchor("default-proton", Modifier.widthIn(max = 300.dp)) { Column {
Text("Default Proton", fontSize = 12.sp, color = colors.onSurfaceVariant)
Box {
val defaultName = views.firstOrNull { it.proton.id == defaultProtonId }?.proton?.name ?: "Choose default"
@@ -196,8 +197,8 @@ fun ComponentsPage(
}
}
}
}
Column {
} }
SettingsAnchor("editing-proton", Modifier.widthIn(max = 300.dp)) { Column {
Text("Editing components for", fontSize = 12.sp, color = colors.onSurfaceVariant)
Box {
ValueChip(view.proton.name, protonMenu, modifier = Modifier.widthIn(max = 300.dp).heightIn(min = 44.dp)) { protonMenu = !protonMenu }
@@ -222,7 +223,7 @@ fun ComponentsPage(
}
}
}
}
} }
}
val tabs = listOf(GPU_TAB) + comps
TabStrip(tabs.map { ComponentsManager.LABEL[it] ?: stringResource(R.string.comp_gpu_drivers) }, tabs.indexOf(comp).coerceAtLeast(0), { onComp(tabs[it]) })
@@ -253,7 +254,7 @@ fun ComponentsPage(
// ---- the lists ------------------------------------------------------------------------------
when {
gpuTab -> Column(Modifier.weight(1f).fillMaxWidth().verticalScroll(rememberScrollState()).padding(bottom = 16.dp)) {
gpuTab -> Column(Modifier.weight(1f).fillMaxWidth().verticalScroll(gpuScroll).padding(bottom = 16.dp)) {
GpuDriversPanel(gpu, gpuActions) { driverPage = it }
Row(modifier = Modifier.padding(top = 14.dp)) {
SmallButton(stringResource(R.string.comp_import_zip), onClick = gpuActions.onImportZip)
@@ -47,7 +47,7 @@ fun ColumnScope.ControllerRows(host: MenuHost, oscMode: String, c: ControllerPre
oscMode, note = stringResource(R.string.mode_osc_note), onPick = a.onOsc,
)
val tintOpen = host.open == "controller-tint"
SettingsRow(stringResource(R.string.ctrl_color), stringResource(R.string.ctrl_color_hint), highlighted = tintOpen) {
SettingsAnchor("controller-tint") { SettingsRow(stringResource(R.string.ctrl_color), stringResource(R.string.ctrl_color_hint), highlighted = tintOpen) {
Box {
ValueChip(ControllerPrefs.tints.firstOrNull { it.first == c.tint }?.second ?: stringResource(R.string.ctrl_custom), tintOpen) {
host.open = if (tintOpen) null else "controller-tint"
@@ -61,7 +61,7 @@ fun ColumnScope.ControllerRows(host: MenuHost, oscMode: String, c: ControllerPre
}
}
}
}
} }
ChoiceRow(host, "controller-opacity", stringResource(R.string.ctrl_opacity), null, ControllerPrefs.opacities.map { it to stringResource(R.string.ctrl_percent, it) }, c.opacity, onPick = a.onOpacity)
ChoiceRow(host, "controller-size", stringResource(R.string.ctrl_size), stringResource(R.string.ctrl_size_hint), ControllerPrefs.sizes.map { it to stringResource(R.string.ctrl_percent, it) }, c.size, onPick = a.onSize)
ToggleRow(host, "controller-stick-click", stringResource(R.string.ctrl_stick_click), stringResource(R.string.ctrl_stick_click_hint), c.stickClick, onChange = a.onStickClick)
@@ -70,15 +70,15 @@ fun ColumnScope.ControllerRows(host: MenuHost, oscMode: String, c: ControllerPre
ToggleRow(host, "controller-steam", stringResource(R.string.ctrl_steam_button), null, c.steamButton, onChange = a.onSteamButton)
ToggleRow(host, "controller-qam", stringResource(R.string.ctrl_qam_button), null, c.qamButton, onChange = a.onQamButton)
ToggleRow(host, "controller-keyboard", stringResource(R.string.ctrl_keyboard_button), null, c.keyboardButton, onChange = a.onKeyboardButton)
SettingsRow(stringResource(R.string.ctrl_layout), if (c.customLayout) stringResource(R.string.ctrl_layout_custom) else stringResource(R.string.ctrl_layout_default)) {
SettingsAnchor("controller-layout") { SettingsRow(stringResource(R.string.ctrl_layout), if (c.customLayout) stringResource(R.string.ctrl_layout_custom) else stringResource(R.string.ctrl_layout_default)) {
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
SecondaryButton(stringResource(R.string.ctrl_edit)) { a.onEditLayout() }
SecondaryButton(stringResource(R.string.ctrl_reset), enabled = c.customLayout) { a.onResetLayout() }
}
}
} }
val remapped = c.mapping.count { (id, target) -> id != target }
ActionRow(stringResource(R.string.ctrl_mapping), if (remapped == 0) stringResource(R.string.ctrl_mapping_default) else stringResource(R.string.ctrl_mapping_count, remapped, c.mapping.size), stringResource(R.string.ctrl_configure), a.onMapping)
ActionRow(stringResource(R.string.ctrl_reset_all), stringResource(R.string.ctrl_reset_all_hint), stringResource(R.string.ctrl_reset), a.onResetAll)
SettingsAnchor("controller-mapping") { ActionRow(stringResource(R.string.ctrl_mapping), if (remapped == 0) stringResource(R.string.ctrl_mapping_default) else stringResource(R.string.ctrl_mapping_count, remapped, c.mapping.size), stringResource(R.string.ctrl_configure), a.onMapping) }
SettingsAnchor("controller-reset") { ActionRow(stringResource(R.string.ctrl_reset_all), stringResource(R.string.ctrl_reset_all_hint), stringResource(R.string.ctrl_reset), a.onResetAll) }
}
@Composable
@@ -387,12 +387,13 @@ fun ModeSettingsContent(
) { confirmDeckyRemoval = true }
}
} }
if (s.deckyInstalled != null) ToggleRow(
ToggleRow(
host, "decky-enabled", stringResource(R.string.mode_decky),
if (s.deckyEnabled) stringResource(R.string.mode_decky_on)
if (s.deckyInstalled == null) "Install Decky Loader above to enable it."
else if (s.deckyEnabled) stringResource(R.string.mode_decky_on)
else stringResource(R.string.mode_decky_off),
s.deckyEnabled,
enabled = !s.deckySessionRunning && s.deckyStage == null,
enabled = s.deckyInstalled != null && !s.deckySessionRunning && s.deckyStage == null,
onChange = a.onDeckyEnabled,
)
SettingsAnchor("decky-plugins") { SettingsRow(
@@ -1,6 +1,7 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.focusGroup
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@@ -39,6 +40,8 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.snapshotFlow
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -59,6 +62,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.droiddeck.launcher.core.PhantomProcessLimit
import kotlinx.coroutines.flow.filterNotNull
/** The settings taxonomy is shared by the hub, category pages, and the searchable index. */
enum class SettingsCategory(val title: String, val description: String) {
@@ -129,6 +133,9 @@ object SettingsCatalog {
SettingsEntry("controller", SettingsCategory.CONTROLS, "Controller type", "Choose the controller profile exposed to Steam", listOf("xbox", "steam deck"), "steam"),
SettingsEntry("back-actions", SettingsCategory.CONTROLS, "Back-button actions", "Choose the order of the Steam menu and Quick Access Menu", listOf("b button", "menu button", "qam")),
SettingsEntry("controller-mapping", SettingsCategory.CONTROLS, "Button mapping", "Remap controller buttons", listOf("mapping", "remap")),
SettingsEntry("controller-tint", SettingsCategory.CONTROLS, "Controller color", "Choose the on-screen controller color", listOf("tint")),
SettingsEntry("controller-layout", SettingsCategory.CONTROLS, "Controller layout", "Edit or reset the touch controller layout", listOf("custom layout")),
SettingsEntry("controller-reset", SettingsCategory.CONTROLS, "Reset controller settings", "Reset the on-screen controller configuration", listOf("reset all")),
SettingsEntry("controller-opacity", SettingsCategory.CONTROLS, "Controller opacity", "Adjust the on-screen controller opacity", listOf("transparency")),
SettingsEntry("controller-size", SettingsCategory.CONTROLS, "Controller size", "Adjust the on-screen controller size", listOf("scale")),
SettingsEntry("controller-stick-click", SettingsCategory.CONTROLS, "Stick click", "Enable stick-click controls", listOf("l3", "r3")),
@@ -139,7 +146,7 @@ object SettingsCatalog {
SettingsEntry("controller-keyboard", SettingsCategory.CONTROLS, "On-screen keyboard button", "Show the keyboard button on the virtual controller", listOf("keyboard")),
SettingsEntry("controller-actions", SettingsCategory.CONTROLS, "Controller layout and mapping", "Edit the on-screen layout, remap buttons, or reset controller settings", listOf("color", "opacity", "size", "stick click", "adaptive sticks", "rumble", "steam button", "qam button", "keyboard button", "layout", "mapping", "reset")),
SettingsEntry("da", SettingsCategory.AUDIO, "Direct audio", "Configure direct game audio", listOf("audio output"), "steam"),
SettingsEntry("clientAudio", SettingsCategory.AUDIO, "Steam client audio", "Choose Steam client audio mode", listOf("client audio"), "steam"),
SettingsEntry("clientAudio", SettingsCategory.AUDIO, "Steam-menu audio", "Choose the audio mode for Steam menus", listOf("client audio", "steam client audio"), "steam"),
SettingsEntry("mic", SettingsCategory.AUDIO, "Microphone", "Allow session microphone input", listOf("recording", "voice chat"), "steam"),
SettingsEntry("added-games", SettingsCategory.LIBRARY, "Added games", "Manage imported game folders and launch files", listOf("non-steam games", "exe"), "steam"),
SettingsEntry("addedArt", SettingsCategory.LIBRARY, "Added game artwork", "Show artwork for imported games", listOf("game covers", "covers"), "steam"),
@@ -161,7 +168,9 @@ object SettingsCatalog {
SettingsEntry("decky-enabled", SettingsCategory.SESSIONS, "Enable Decky Loader", "Start or stop Decky Loader with Steam", listOf("decky toggle"), "steam"),
SettingsEntry("decky-loader", SettingsCategory.SESSIONS, "Decky installation", "Install or repair the Decky loader", listOf("decky install", "decky status"), "steam"),
SettingsEntry("decky-plugins", SettingsCategory.SESSIONS, "Decky plugins", "Install a Decky plugin ZIP", listOf("plugin zip"), "steam"),
SettingsEntry("components", SettingsCategory.COMPATIBILITY, "Compatibility components", "Manage FEX, DXVK, and VKD3D-Proton", listOf("dxvk", "vkd3d", "fex", "default proton", "default-proton")),
SettingsEntry("components", SettingsCategory.COMPATIBILITY, "Compatibility components", "Manage FEX, DXVK, and VKD3D-Proton", listOf("dxvk", "vkd3d", "fex")),
SettingsEntry("default-proton", SettingsCategory.COMPATIBILITY, "Default Proton", "Choose the synchronized Steam default", listOf("default-proton")),
SettingsEntry("editing-proton", SettingsCategory.COMPATIBILITY, "Editing components for", "Choose which Proton build to edit", listOf("component editing target")),
SettingsEntry("protons", SettingsCategory.COMPATIBILITY, "Proton versions", "Install and manage Proton builds", listOf("wine", "proton-ge", "installed proton")),
SettingsEntry("performance", SettingsCategory.COMPATIBILITY, "Performance", "Tune CPU cores and graphics compatibility options", listOf("cpu", "cores", "zink", "fsync")),
SettingsEntry("performance:override", SettingsCategory.COMPATIBILITY, "Per-app core limits", "Override the Steam client CPU core selection", listOf("client core override", "cpu affinity")),
@@ -199,6 +208,18 @@ private data class CategoryCard(val category: SettingsCategory, val icon: ImageV
fun SettingsHub(s: FrontEndState, a: FrontEndActions) {
var query by rememberSaveable { mutableStateOf("") }
val frontFocus = LocalFrontFocus.current
var hasFocus by remember { mutableStateOf(false) }
var lastItem by rememberSaveable { mutableStateOf<String?>(null) }
LaunchedEffect(frontFocus) {
snapshotFlow { if (hasFocus) frontFocus?.last else null }.filterNotNull().collect { lastItem = it }
}
LaunchedEffect(Unit) {
if (frontFocus != null) focusWithinFrames({ hasFocus }) {
val id = lastItem
if (id != null && (frontFocus.attached[id] ?: 0) > 0) frontFocus.items.getValue(id)
else frontFocus.primary
}
}
DisposableEffect(frontFocus) {
frontFocus?.let { it.primaryAttached++ }
onDispose { frontFocus?.let { it.primaryAttached-- } }
@@ -214,7 +235,8 @@ fun SettingsHub(s: FrontEndState, a: FrontEndActions) {
CategoryCard(SettingsCategory.SUPPORT, Icons.Outlined.HelpOutline),
)
Column(
modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 12.dp),
modifier = Modifier.fillMaxSize().onFocusChanged { hasFocus = it.hasFocus }.focusGroup()
.verticalScroll(rememberScrollState()).padding(horizontal = 16.dp, vertical = 12.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
PageHeader("Settings")
@@ -304,7 +326,7 @@ private fun SettingsCategoryCard(card: CategoryCard, modifier: Modifier, onClick
.padding(14.dp),
) {
Icon(card.icon, contentDescription = null, tint = if (focused || hovered) pal.signal else colors.onSurfaceVariant, modifier = Modifier.size(22.dp))
Text(card.category.title, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(card.category.title, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, maxLines = 2, overflow = TextOverflow.Ellipsis)
Text(card.category.description, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
}
@@ -1,5 +1,12 @@
package com.droiddeck.launcher.ui
/** A specialist search returns to the category control that opens that specialist. */
internal fun settingsCategoryTarget(target: String?): String? = when {
target == "default-proton" || target == "editing-proton" -> "components"
target?.startsWith("performance:") == true -> "performance"
else -> target
}
sealed interface SettingsDestination {
val key: String
@@ -11,7 +18,7 @@ sealed interface SettingsDestination {
override val key = "settings:${category.name}:$mode:${target.orEmpty()}"
}
data class Components(val tab: String? = null) : SettingsDestination {
data class Components(val tab: String? = null, val target: String? = null) : SettingsDestination {
override val key = "components"
}
@@ -223,7 +223,7 @@ internal fun Modifier.settingsTarget(id: String): Modifier =
/** A non-stopping focus group that can reveal itself and request its first actionable child. */
@Composable
@OptIn(ExperimentalFoundationApi::class)
fun SettingsAnchor(id: String, content: @Composable () -> Unit) {
fun SettingsAnchor(id: String, modifier: Modifier = Modifier.fillMaxWidth(), content: @Composable () -> Unit) {
val target = LocalSettingsTarget.current
val enabled = LocalSettingsAnchorsEnabled.current
if (!enabled) {
@@ -233,7 +233,7 @@ fun SettingsAnchor(id: String, content: @Composable () -> Unit) {
val bringIntoView = remember { BringIntoViewRequester() }
val focusRequester = remember { FocusRequester() }
Column(
modifier = Modifier.fillMaxWidth()
modifier = modifier
.bringIntoViewRequester(bringIntoView)
.focusRequester(focusRequester)
.focusGroup(),
@@ -22,7 +22,8 @@ class SettingsCatalogTest {
}
@Test fun protonDefaultsInstalledBuildsAndComponentNamesRouteToTheirOwnPages() {
assertEquals(setOf("components"), targets("default proton"))
assertEquals(setOf("default-proton"), targets("default proton"))
assertEquals(setOf("editing-proton"), targets("component editing target"))
assertEquals(setOf("protons"), targets("installed proton"))
assertTrue(targets("DXVK").contains("components"))
assertTrue(targets("VKD3D").contains("components"))
@@ -26,4 +26,12 @@ class SettingsHistoryTest {
assertNull(history.back().back().current)
}
@Test fun specialistSearchesReturnToTheirCategoryLaunchControl() {
assertEquals("performance", settingsCategoryTarget("performance:gameCores"))
assertEquals("components", settingsCategoryTarget("default-proton"))
assertEquals("components", settingsCategoryTarget("editing-proton"))
assertEquals("controller-mapping", settingsCategoryTarget("controller-mapping"))
assertEquals("res", settingsCategoryTarget("res"))
assertNull(settingsCategoryTarget(null))
}
}