feat(settings): one home per setting, Storage/Syncthing/Downloads tabs, scoped frame limit, clearer menus (#2791)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-17 20:26:37 -05:00
1 parent 868207baf8
commit 0ce168b913
41 files changed
+1283 -187

No files matched your search

+1
View File
@@ -150,6 +150,7 @@
<category android:name="android.intent.category.CAR_LAUNCHER" />
<data android:scheme="droiddeck" android:host="game" />
<data android:scheme="droiddeck" android:host="soundtrack" />
<data android:scheme="droiddeck" android:host="settings" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
@@ -46,6 +46,7 @@ class App : Application() {
com.droiddeck.launcher.input.ShortcutsRelay.Holder.install(this)
com.droiddeck.launcher.agent.AgentHost.refresh(this)
com.droiddeck.launcher.agent.AgentTab.load(this)
com.droiddeck.launcher.ui.DeveloperTools.load(this)
com.droiddeck.launcher.ui.NavTabs.load(this)
com.droiddeck.launcher.ui.AgentPet.install(this)
if (com.droiddeck.launcher.agent.AgentTab.visible) com.droiddeck.launcher.lab.LabNotice.openOnInstall = "agent"
@@ -911,6 +911,16 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private fun readGameIntent(request: Intent) {
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
else "settings:" + (com.droiddeck.launcher.ui.SettingsSection.of(section) ?: com.droiddeck.launcher.ui.SettingsSection.OVERVIEW).key
request.data = null
gameLinkReading = false
pendingGameLink = null
syncDualPanel()
return
}
if (navRequest == com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_APPS) {
homeAppSelected = HomeApp.isHomeScreenEnabled(this) && HomeApp.isDefault(this)
if (!homeAppSelected) navRequest = null
@@ -1493,6 +1503,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
},
onSaveExport = { sg, layout -> exportSaves(sg.name, layout) { GameSaves.game(sg) } },
onPerformance = { refreshCores(); showComponents = false; showMapping = false; showPerformance = true },
performancePanel = { PerformanceHost(embedded = true) },
onRoms = { showRoms = true },
onFiles = { startActivity(Intent(this, com.droiddeck.launcher.files.FileManagerActivity::class.java)) },
onBrowseFiles = { dir ->
@@ -2704,7 +2715,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
}
@Composable
private fun PerformanceHost() {
private fun PerformanceHost(embedded: Boolean = false) {
if (embedded) androidx.compose.runtime.LaunchedEffect(Unit) { refreshCores() }
PerformancePage(
cores = CpuCores.all.map { c -> CoreRow(c, "cpu$c" + (CpuCores.maxGhz(c)?.let { String.format(java.util.Locale.US, " · %.1f GHz", it) } ?: "")) },
clientOverride = clientOverride, clientCores = clientCores, gameCores = gameCores, paceCores = paceCores,
@@ -2750,6 +2762,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
SessionPrefs.setGameCpus(this, CpuCores.format(gameCores))
},
onDismiss = { showPerformance = false },
embedded = embedded,
)
}
@@ -3300,6 +3313,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
if (!ok) android.widget.Toast.makeText(this, R.string.setup_reset_settings_partial, android.widget.Toast.LENGTH_LONG).show()
com.droiddeck.launcher.ui.Motion.refresh(this)
com.droiddeck.launcher.agent.AgentTab.load(this)
com.droiddeck.launcher.ui.DeveloperTools.load(this)
com.droiddeck.launcher.ui.NavTabs.load(this)
if (!switchLauncherIcon(LauncherIcon.DARK)) recreate()
}
@@ -502,6 +502,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private var drawerGameProfileId by mutableStateOf<Long?>(null)
private var drawerGameProfileSelectionMade = false
private var fpsLimit by mutableStateOf(SessionState.fpsLimit)
private var cornerTap by mutableStateOf(false)
private fun fpsLimitKey(): String? = if (SessionState.running) SessionPrefs.fpsLimitKey(SessionState.mode, SessionState.gameId)
else SessionPrefs.fpsLimitKey(intent.getStringExtra(SessionService.EXTRA_MODE), intent.getStringExtra(SessionService.EXTRA_GAME_ID))
private var blackFrameInsertion by mutableStateOf(false)
private fun noSteamSession(): Boolean = (SessionState.mode == SessionService.MODE_RUN &&
@@ -795,9 +798,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
com.droiddeck.launcher.gpu.SteamVrHealth.begin(this, SessionState.sessionId)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
if (!SessionState.running) {
SessionState.fpsLimit = 0
fpsLimit = 0
SessionState.fpsLimit = SessionPrefs.savedFpsLimit(this, fpsLimitKey())
}
fpsLimit = SessionState.fpsLimit
cornerTap = SessionPrefs.drawerCornerTap(this)
applyOutputPacing()
if (!SessionState.running) {
SessionState.followScreen = followChoice()
@@ -1139,6 +1143,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
drawerPage = com.droiddeck.launcher.ui.SessionDrawerPage.GLASSES
drawerOpen = true
}
if (!drawerOpen && !pcKeyboardOpen && !loading.visible) {
com.droiddeck.launcher.ui.DrawerEntryHint(SessionState.mode == SessionService.MODE_STEAM, backActionsInverted) { drawerOpen = true }
if (cornerTap) com.droiddeck.launcher.ui.DrawerCornerTap { drawerOpen = true }
}
if (loading.visible) LoadingOverlay(
loading.step, loading.percent, loading.elapsed, loading.hint, loading.ended,
topic = loading.topic, readable = loading.readable,
@@ -1609,8 +1617,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
onFpsLimit = { fps ->
SessionState.fpsLimit = fps
fpsLimit = fps
SessionPrefs.saveFpsLimit(this@SessionActivity, fpsLimitKey(), fps)
applyOutputPacing()
},
cornerTap = cornerTap,
onCornerTap = { on -> SessionPrefs.setDrawerCornerTap(this@SessionActivity, on); cornerTap = on },
blackFrameInsertion = blackFrameInsertion,
blackFrameInsertionAvailable = blackFrameInsertion || blackFrameInsertionAvailable(),
onBlackFrameInsertion = { on ->
@@ -279,6 +279,39 @@ object SessionPrefs {
prefs(context).edit().putBoolean("agentTab", show).apply()
}
fun developerTools(context: Context): Boolean =
prefs(context).getBoolean("developerTools", agentTab(context) || com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(context))
fun setDeveloperTools(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("developerTools", on).apply()
}
fun fpsLimitKey(mode: String?, game: String?): String? = when (mode) {
SessionService.MODE_RUN -> game?.trim()?.takeIf(com.droiddeck.launcher.frontend.GameLaunchLink::validId)?.let { "fpsLimit.game.$it" }
SessionService.MODE_DESKTOP -> "fpsLimit.desktop"
else -> null
}
fun savedFpsLimit(context: Context, key: String?): Int = key?.let { prefs(context).getInt(it, 0) } ?: 0
fun saveFpsLimit(context: Context, key: String?, fps: Int) {
key ?: return
prefs(context).edit().apply { if (fps > 0) putInt(key, fps) else remove(key) }.apply()
}
fun drawerCornerTap(context: Context): Boolean =
prefs(context).getBoolean("drawerCornerTap", android.os.Build.MANUFACTURER.equals("Oculus", true) || android.os.Build.MANUFACTURER.equals("Meta", true))
fun setDrawerCornerTap(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("drawerCornerTap", on).apply()
}
fun drawerHintShown(context: Context): Int = prefs(context).getInt("drawerHintShown", 0)
fun countDrawerHint(context: Context) {
prefs(context).edit().putInt("drawerHintShown", drawerHintShown(context) + 1).apply()
}
fun libraryShowUninstalled(context: Context): Boolean = prefs(context).getBoolean("libraryShowUninstalled", false)
fun setLibraryShowUninstalled(context: Context, show: Boolean) {
@@ -309,7 +342,7 @@ object SessionPrefs {
prefs(context).edit().putString("navTabOrder", order.joinToString(",")).apply()
}
fun navTabShelved(context: Context): Set<String> = idList(prefs(context).getString("navTabShelved", "soundtracks,agent")).toSet()
fun navTabShelved(context: Context): Set<String> = idList(prefs(context).getString("navTabShelved", "soundtracks,agent,storage,sync")).toSet()
fun setNavTabShelved(context: Context, keys: Set<String>) {
prefs(context).edit().putString("navTabShelved", keys.joinToString(",")).apply()
@@ -411,6 +411,7 @@ class SessionService : Service() {
?.takeIf(GameLaunchLink::validId)
?: steamUrlGameId
SessionState.gameId = resolvedGameId
SessionState.fpsLimit = SessionPrefs.savedFpsLimit(this, SessionPrefs.fpsLimitKey(SessionState.mode, resolvedGameId))
SessionPrefs.setActiveScreenEffectsProfile(
this,
SessionPrefs.screenEffectsProfileId(SessionState.mode, resolvedGameId, SessionState.program),
@@ -0,0 +1,70 @@
package com.droiddeck.launcher.stores
import android.content.Context
import java.io.File
import org.json.JSONArray
import org.json.JSONObject
internal object StoreLibraryCache {
private fun file(context: Context, store: Store) = File(context.filesDir, "store-library/${store.id}.json")
fun load(context: Context, store: Store): List<CatalogItem>? {
val f = file(context, store)
if (!f.isFile) return null
return runCatching { decode(store, f.readText()) }.getOrNull()
}
private val locks = Store.entries.associateWith { Any() }
fun save(context: Context, store: Store, items: List<CatalogItem>, current: () -> Boolean) = synchronized(locks.getValue(store)) {
if (!current()) return@synchronized
val f = file(context, store)
runCatching {
f.parentFile?.mkdirs()
val tmp = File(f.parentFile, f.name + ".tmp")
tmp.writeText(encode(items))
if (!tmp.renameTo(f)) { f.delete(); tmp.renameTo(f) }
}
}
fun clear(context: Context, store: Store) = synchronized(locks.getValue(store)) {
file(context, store).delete()
}
internal fun encode(items: List<CatalogItem>): String {
val out = JSONArray()
items.forEach { i ->
out.put(JSONObject()
.put("id", i.id).put("title", i.title)
.put("image", i.imageUrl ?: "").put("tall", i.tallImageUrl ?: "").put("logo", i.logoUrl ?: "")
.put("tags", i.tags).put("free", i.isFree).put("hasPrice", i.hasPrice)
.put("finalPrice", i.finalPrice).put("originalPrice", i.originalPrice).put("discount", i.discountPercent)
.put("url", i.storeUrl).put("developer", i.developer).put("publisher", i.publisher)
.put("releaseDate", i.releaseDate).put("description", i.description)
.put("owned", i.owned).put("size", i.sizeBytes).put("extra", JSONObject(i.extra))
.put("mature", i.mature).put("subscription", i.subscription).put("includedWith", i.includedWith))
}
return out.toString()
}
internal fun decode(store: Store, text: String): List<CatalogItem> {
val raw = JSONArray(text)
return (0 until raw.length()).mapNotNull { n ->
val o = raw.optJSONObject(n) ?: return@mapNotNull null
val extra = o.optJSONObject("extra")
val map = HashMap<String, String>()
extra?.keys()?.forEach { k -> map[k] = extra.optString(k) }
CatalogItem(
store = store, id = o.optString("id"), title = o.optString("title"),
imageUrl = o.optString("image").ifBlank { null }, tallImageUrl = o.optString("tall").ifBlank { null },
logoUrl = o.optString("logo").ifBlank { null },
tags = o.optString("tags"), isFree = o.optBoolean("free"), hasPrice = o.optBoolean("hasPrice"),
finalPrice = o.optString("finalPrice"), originalPrice = o.optString("originalPrice"), discountPercent = o.optInt("discount"),
storeUrl = o.optString("url"), developer = o.optString("developer"), publisher = o.optString("publisher"),
releaseDate = o.optString("releaseDate"), description = o.optString("description"),
owned = o.optBoolean("owned"), sizeBytes = o.optLong("size"), extra = map,
mature = o.optBoolean("mature"), subscription = o.optBoolean("subscription"), includedWith = o.optString("includedWith"),
)
}
}
}
@@ -202,6 +202,7 @@ object StoresState {
backend?.signOut(app)
if (store == Store.GOG) com.droiddeck.launcher.stores.gog.GogComet.replaceAccount { StoreAccounts.clear(app, store) }
else if (store != Store.XBOX || backend == null) StoreAccounts.clear(app, store)
StoreLibraryCache.clear(app, store)
if (store == Store.GAMEJOLT) {
com.droiddeck.launcher.stores.gamejolt.GameJoltCollections.clear()
com.droiddeck.launcher.stores.gamejolt.GameJoltUpdates.clear(app)
@@ -14,6 +14,7 @@ import com.droiddeck.launcher.stores.StoreFront
import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.StoreLoginActivity
import com.droiddeck.launcher.stores.StoreShelves
import com.droiddeck.launcher.stores.StoreLibraryCache
import com.droiddeck.launcher.stores.StoresState
import com.droiddeck.launcher.stores.WebCookies
import com.droiddeck.launcher.stores.download.DownloadEntry
@@ -163,7 +164,16 @@ object RockstarLibrary {
post(gen) { StoresState.status.remove(Store.ROCKSTAR); StoresState.problems[Store.ROCKSTAR] = app.getString(R.string.stores_sync_sign_in) }
return
}
if (StoresState.library[Store.ROCKSTAR].isNullOrEmpty()) post(gen) { StoresState.status[Store.ROCKSTAR] = app.getString(R.string.stores_sync_game_list) }
val cached = StoreLibraryCache.load(app, Store.ROCKSTAR)
post(gen) {
if (StoresState.library[Store.ROCKSTAR] == null) {
if (cached != null) {
StoresState.library[Store.ROCKSTAR] = cached
StoresState.shelves[Store.ROCKSTAR]?.let { StoresState.shelves[Store.ROCKSTAR] = StoreFront.markOwned(it, cached, RockstarCatalog::sameGame) }
}
else StoresState.status[Store.ROCKSTAR] = app.getString(R.string.stores_sync_game_list)
}
}
val account = RockstarApps.fetch(t.ticket) { StoresState.logLine(it) }
val games = games(account)
owned(account).filter { o -> games.none { it.id == o.id } }.takeIf { it.isNotEmpty() }?.let { elsewhere ->
@@ -175,6 +185,7 @@ object RockstarLibrary {
StoresState.library[Store.ROCKSTAR] = games
StoresState.shelves[Store.ROCKSTAR]?.let { StoresState.shelves[Store.ROCKSTAR] = StoreFront.markOwned(it, games, RockstarCatalog::sameGame) }
}
StoreLibraryCache.save(app, Store.ROCKSTAR, games) { generation.get() == gen }
StoresState.logLine("Rockstar: ${games.size} owned games")
} catch (e: Exception) {
StoresState.logLine("Rockstar: library sync failed: ${e.javaClass.simpleName} ${e.message.orEmpty().take(300)}")
@@ -15,6 +15,7 @@ import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.download.DownloadEntry
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.StoreLoginActivity
import com.droiddeck.launcher.stores.StoreLibraryCache
import com.droiddeck.launcher.stores.StoresState
import com.droiddeck.launcher.stores.WebCookies
import org.json.JSONObject
@@ -206,7 +207,16 @@ object UbisoftLibrary {
post(gen) { StoresState.status.remove(Store.UBISOFT); StoresState.problems[Store.UBISOFT] = app.getString(R.string.stores_sync_sign_in) }
return
}
if (StoresState.library[Store.UBISOFT].isNullOrEmpty()) post(gen) { StoresState.status[Store.UBISOFT] = app.getString(R.string.stores_sync_game_list) }
val cached = StoreLibraryCache.load(app, Store.UBISOFT)
post(gen) {
if (StoresState.library[Store.UBISOFT] == null) {
if (cached != null) {
StoresState.library[Store.UBISOFT] = cached
StoresState.shelves[Store.UBISOFT]?.let { StoresState.shelves[Store.UBISOFT] = StoreFront.markOwned(it, cached, UbisoftStore::sameGame) }
}
else StoresState.status[Store.UBISOFT] = app.getString(R.string.stores_sync_game_list)
}
}
val all = ArrayList<CatalogItem>()
var offset = 0
while (true) {
@@ -241,6 +251,7 @@ object UbisoftLibrary {
StoresState.library[Store.UBISOFT] = games
StoresState.shelves[Store.UBISOFT]?.let { StoresState.shelves[Store.UBISOFT] = StoreFront.markOwned(it, games, UbisoftStore::sameGame) }
}
StoreLibraryCache.save(app, Store.UBISOFT, games) { generation.get() == gen }
StoresState.logLine("Ubisoft: ${games.size} owned games")
} catch (e: Exception) {
StoresState.logLine("Ubisoft: library sync failed: ${e.javaClass.simpleName} ${e.message.orEmpty().take(200)}")
@@ -156,7 +156,10 @@ internal fun DesktopPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie
},
rows = { tab ->
if (tab == SheetTab.FILES) DesktopFiles(s, a)
else a.modeSheet(mode, tab, SheetExtras())
else a.modeSheet(mode, tab, SheetExtras(
performance = { PerformanceLink(a, "desktop", SheetTab.SESSION) },
drivers = { summary -> DriversLink(a, summary, "desktop", stringResource(R.string.hop_from_play)) },
))
},
)
if (adding && !s.busy) AddAppDialog(s.ready, onDismiss = { adding = false }) { request, label -> UserAppsState.add(ctx, request, label) }
@@ -0,0 +1,70 @@
package com.droiddeck.launcher.ui
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInRoot
import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.droiddeck.launcher.R
internal object DownloadsNav {
var showSettings = false
}
@Composable
internal fun DownloadsPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier) {
val pal = LocalPalette.current
val live = androidx.compose.runtime.rememberUpdatedState(s)
var gearAt by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf<androidx.compose.ui.geometry.Rect?>(null) }
val openSettings = { gearAt?.let { StoresMotion.ask(downloadsSettingsStep(it, live, a, pal.signal)) } }
androidx.compose.runtime.LaunchedEffect(gearAt != null) {
if (gearAt != null && DownloadsNav.showSettings) { DownloadsNav.showSettings = false; openSettings() }
}
var hostAt by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(androidx.compose.ui.geometry.Offset.Zero) }
androidx.compose.runtime.DisposableEffect(Unit) { val page = Any(); StoresMotion.hosting(page); onDispose { StoresMotion.release(page) } }
androidx.activity.compose.BackHandler(enabled = StoresMotion.stepOpen) { StoresMotion.fold() }
androidx.compose.foundation.layout.Box(androidx.compose.ui.Modifier.fillMaxSize().onGloballyPositioned { hostAt = it.positionInRoot() }) {
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
PageHeader(stringResource(R.string.stores_tab_downloads)) {
Spacer(Modifier.weight(1f))
androidx.compose.foundation.layout.Box(Modifier.onGloballyPositioned { gearAt = it.boundsInRoot() }) {
SmallIconButton(Icons.Filled.Settings, stringResource(R.string.downloads_settings), tint = MaterialTheme.colorScheme.onSurfaceVariant) {
openSettings()
}
}
}
StoresDownloadsPane(s, a)
}
StoresMotion.step?.let { ask ->
androidx.compose.runtime.key(ask) {
StepOut(
open = StoresMotion.stepOpen, pill = ask.anchor.translate(-hostAt), preferredSide = ask.side, accent = ask.accent,
onDismiss = { StoresMotion.fold() }, onClosed = { StoresMotion.closed(ask) },
pillCorner = ask.pillCorner, maxWidth = ask.maxWidth, items = ask.items, handle = ask.handle, content = ask.content,
)
}
}
}
}
@@ -0,0 +1,101 @@
package com.droiddeck.launcher.ui
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft
import androidx.compose.material3.Icon
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.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.droiddeck.launcher.R
import com.droiddeck.launcher.session.SessionPrefs
import kotlinx.coroutines.delay
private const val HINT_SESSIONS = 3
private const val HINT_MS = 6_000L
private var hintedSession: Any? = null
@Composable
internal fun DrawerEntryHint(steam: Boolean, inverted: Boolean, onOpen: () -> Unit) {
val context = LocalContext.current
var shown by remember { mutableStateOf(false) }
LaunchedEffect(Unit) {
val session = com.droiddeck.launcher.session.SessionState.sessionId
if (hintedSession == session || SessionPrefs.drawerHintShown(context) >= HINT_SESSIONS) return@LaunchedEffect
hintedSession = session
SessionPrefs.countDrawerHint(context)
shown = true
delay(HINT_MS)
shown = false
}
Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.displayCutout), contentAlignment = Alignment.CenterEnd) {
AnimatedVisibility(shown, enter = slideInHorizontally { it } + fadeIn(), exit = slideOutHorizontally { it } + fadeOut()) {
Row(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier
.clip(RoundedCornerShape(topStart = 14.dp, bottomStart = 14.dp))
.background(Color(0xE6101216))
.clickable(role = Role.Button, onClickLabel = stringResource(R.string.drawer_handle)) { shown = false; onOpen() }
.padding(start = 10.dp, end = 14.dp, top = 10.dp, bottom = 10.dp)
.widthIn(max = 260.dp)
.testTag("drawer-hint"),
) {
Icon(Icons.AutoMirrored.Filled.KeyboardArrowLeft, null, tint = Color.White, modifier = Modifier.size(20.dp))
val bound = remember {
com.droiddeck.launcher.input.PhysicalShortcuts.read(context)
.filter { it.action == com.droiddeck.launcher.input.PhysicalShortcuts.Action.DROIDDECK }
.map { it.button.label }.distinct().joinToString(" / ")
}
Text(
if (bound.isNotEmpty()) stringResource(R.string.drawer_hint_button, bound)
else stringResource(if (!steam) R.string.drawer_hint else if (inverted) R.string.drawer_hint_steam_inverted else R.string.drawer_hint_steam),
fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = Color.White,
)
}
}
}
}
@Composable
internal fun DrawerCornerTap(onOpen: () -> Unit) {
Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.displayCutout), contentAlignment = Alignment.TopEnd) {
Box(
Modifier.size(64.dp).testTag("drawer-corner")
.pointerInput(Unit) { detectTapGestures(onDoubleTap = { onOpen() }) },
)
}
}
@@ -465,7 +465,7 @@ internal fun BoxWithConstraintsScope.DropSheet(
var handleSize by remember { mutableStateOf(androidx.compose.ui.unit.IntSize.Zero) }
val lipH = 32.dp + state.pull.value.dp
val drop = { if (!state.open && enabled) state.open = true }
val settingsLabel = stringResource(R.string.drawer_page_settings)
val settingsLabel = stringResource(R.string.sheet_lip)
Box(
contentAlignment = Alignment.BottomCenter,
modifier = Modifier
@@ -251,6 +251,18 @@ private fun Content(
}
return
}
if (selected == "downloads") {
DownloadsPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
return
}
if (selected == "storage") {
StorageTabPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
return
}
if (selected == "sync") {
SyncTabPage(s, modifier.padding(horizontal = padH).padding(top = padV))
return
}
if (selected == "updates") {
UpdatesPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
return
@@ -276,7 +288,10 @@ private fun Content(
return
}
if (selected == NavTabs.MORE) {
MorePage(s, a, onSelect, modifier.padding(horizontal = padH).padding(top = padV))
Box(modifier) {
MorePage(s, a, onSelect, Modifier.padding(horizontal = padH).padding(top = padV))
EditTabsSheet(s, a)
}
return
}
if (selected == "agent") {
@@ -47,6 +47,9 @@ import androidx.compose.foundation.relocation.bringIntoViewRequester
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Apps
import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.icons.outlined.SdStorage
import androidx.compose.material.icons.outlined.Sync
import androidx.compose.material.icons.outlined.Terminal
import androidx.compose.material.icons.outlined.DesktopWindows
import androidx.compose.material.icons.outlined.Layers
@@ -195,28 +198,32 @@ internal fun railLabelIcon(key: String): Pair<Int, ImageVector> = when (key) {
"games" -> R.string.rail_games to Icons.Outlined.VideoLibrary
"soundtracks" -> R.string.rail_music to SoundtrackIcon
"stores" -> R.string.rail_stores to Icons.Outlined.LocalMall
"downloads" -> R.string.stores_tab_downloads to Icons.Outlined.Download
"desktop" -> R.string.rail_desktop to Icons.Outlined.DesktopWindows
"components" -> R.string.rail_components to Icons.Outlined.Layers
"agent" -> R.string.rail_agent to Icons.Outlined.Terminal
"android-apps" -> R.string.rail_apps to Icons.Outlined.Apps
"setup" -> R.string.rail_setup to Icons.Outlined.Tune
"storage" -> R.string.rail_storage to Icons.Outlined.SdStorage
"sync" -> R.string.rail_sync to Icons.Outlined.Sync
NavTabs.MORE -> R.string.rail_more to Icons.Outlined.MoreHoriz
else -> R.string.rail_updates to Icons.Outlined.SystemUpdate
}
internal fun setupNeedsAttention(s: FrontEndState): Boolean = !s.ready || (s.available != null && s.available != s.installed) ||
PhantomProcessLimit.blocksSteam(s.phantomProcessStatus) || com.droiddeck.launcher.sync.Syncthing.needsAttention
PhantomProcessLimit.blocksSteam(s.phantomProcessStatus)
internal fun railBadge(s: FrontEndState, key: String, setupNeedsAttention: Boolean = setupNeedsAttention(s)): Boolean = when (key) {
"setup" -> setupNeedsAttention
"sync" -> com.droiddeck.launcher.sync.Syncthing.needsAttention
"updates" -> s.updates.hasUpdate
NavTabs.MORE -> NavTabs.more(s).any { it != NavTabs.MORE && railBadge(s, it, setupNeedsAttention) }
else -> false
}
internal fun railCount(s: FrontEndState, key: String): Int = when (key) {
"stores" -> s.storeDownloadsActive
NavTabs.MORE -> if ("stores" in NavTabs.more(s)) s.storeDownloadsActive else 0
"downloads" -> s.storeDownloadsActive
NavTabs.MORE -> if ("downloads" in NavTabs.more(s)) s.storeDownloadsActive else 0
else -> 0
}
@@ -226,13 +233,15 @@ private fun NavigationItems(
place: (String) -> Modifier, onSelect: (String) -> Unit, onFocusSelect: (String) -> Unit,
) {
val setupNeedsAttention = setupNeedsAttention(s)
val downloadsAt = if ("downloads" in NavTabs.more(s)) NavTabs.MORE else "downloads"
for (key in navigationKeys(s)) {
val (label, icon) = railLabelIcon(key)
key(key) {
RailItem(stringResource(label), icon, key, shown == key, compact, iconOnly, height, width,
badge = railBadge(s, key, setupNeedsAttention),
count = railCount(s, key),
place = place, onFocus = { onFocusSelect(key) }) { onSelect(key) }
place = { k -> if (k == downloadsAt) place(k).onGloballyPositioned { StoresMotion.downloadsChip = it.boundsInRoot() } else place(k) },
onFocus = { onFocusSelect(key) }) { onSelect(key) }
}
}
}
@@ -1,5 +1,6 @@
package com.droiddeck.launcher.ui
import androidx.compose.ui.input.pointer.pointerInput
import java.io.File
import androidx.compose.ui.res.stringResource
import com.droiddeck.launcher.R
@@ -246,6 +247,7 @@ class FrontEndActions(
val onAddonDelete: (com.droiddeck.launcher.runtime.WowAddons.Target, String) -> Unit = { _, _ -> },
val onSaveExport: (Library.SteamGame, com.droiddeck.launcher.session.GameSaves.Layout) -> Unit = { _, _ -> },
val onPerformance: () -> Unit,
val performancePanel: @Composable () -> Unit = {},
val onRoms: () -> Unit,
val onFiles: () -> Unit,
val onBrowseFiles: (File) -> Unit = {},
@@ -455,16 +457,26 @@ fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -
val frontFocus = remember { FrontFocus() }
val textInput = androidx.compose.ui.platform.LocalTextInputService.current
val bottomTextInput = remember(textInput) { textInput?.let { androidx.compose.ui.text.input.TextInputService(BottomScreenTextInput(it)) } }
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxSize()) {
androidx.compose.foundation.layout.BoxWithConstraints(Modifier.fillMaxSize().pointerInput(Unit) {
awaitPointerEventScope {
while (true) {
val e = awaitPointerEvent(androidx.compose.ui.input.pointer.PointerEventPass.Initial)
e.changes.firstOrNull { it.pressed && !it.previousPressed }?.let { StoresMotion.touched(it.position) }
}
}
}) {
CompositionLocalProvider(
LocalFrontFocus provides frontFocus,
LocalNarrowPane provides (maxWidth < NarrowPaneWidth),
androidx.compose.ui.platform.LocalTextInputService provides (if (s.dualScreen) bottomTextInput else textInput),
LocalBottomTyping provides s.dualScreen,
) { FrontEndScreenBody(s, a, page, frontFocus) }
DownloadFlights()
}
}
private val SETTINGS_NAV = SettingsSection.entries.map { "settings:${it.key}" }.toSet() + "settings"
@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)?, frontFocus: FrontFocus) {
@@ -475,11 +487,12 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
LaunchedEffect(s.navigate) {
val target = s.navigate ?: return@LaunchedEffect
when (target) {
"stores:downloads" -> { com.droiddeck.launcher.stores.StoresState.openDownloads = true; selected = "stores" }
"stores:downloads" -> selected = "downloads"
"components" -> a.onComponents(true)
"setup:launcher" -> { SetupTabs.openLauncher = true; selected = "setup" }
com.droiddeck.launcher.sync.SyncthingService.NAV -> com.droiddeck.launcher.sync.Syncthing.requestOpen()
"setup:integration" -> { SetupTabs.openOverview = true; selected = "setup" }
in SETTINGS_NAV -> { SetupTabs.openSection = SettingsSection.of(target.removePrefix("settings:")) ?: SettingsSection.OVERVIEW; selected = "setup" }
com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_APPS -> {
// Home lands on the apps page itself, so a page open over the rail (Components, Performance) closes first.
if (s.pageKey != null) a.onPageBack()
@@ -595,7 +608,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
val openTab = when {
Hops.origin != null && s.pageKey == Hops.origin?.page -> Hops.origin!!.dest
s.pageKey == "performance" -> "steam"
s.pageKey == "performance" -> "setup"
s.pageKey == "controller-mapping" -> "setup"
selected.startsWith("app:") -> "games"
selected.startsWith("sound:") -> "soundtracks"
@@ -616,10 +629,29 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
}
}
LaunchedEffect(com.droiddeck.launcher.storage.StorageState.openRequests) {
if (com.droiddeck.launcher.storage.StorageState.openPending) showRailPage("setup", true)
if (com.droiddeck.launcher.storage.StorageState.openPending) {
com.droiddeck.launcher.storage.StorageState.openPending = false
showRailPage("storage", true)
}
}
LaunchedEffect(com.droiddeck.launcher.sync.Syncthing.openRequests) {
if (com.droiddeck.launcher.sync.Syncthing.openPending) showRailPage("setup", true)
if (com.droiddeck.launcher.sync.Syncthing.openPending) {
com.droiddeck.launcher.sync.Syncthing.openPending = false
showRailPage("sync", true)
}
}
LaunchedEffect(com.droiddeck.launcher.stores.StoresState.openDownloads) {
if (com.droiddeck.launcher.stores.StoresState.openDownloads) {
com.droiddeck.launcher.stores.StoresState.openDownloads = false
showRailPage("downloads", true)
}
}
LaunchedEffect(RailRequest.key) {
RailRequest.key?.let { showRailPage(it, true) }
RailRequest.key = null
}
LaunchedEffect(SetupTabs.openSection) {
if (SetupTabs.openSection != null && (railSelection != "setup" || s.pageKey != null)) showRailPage("setup", true)
}
val onRailFocus: (String) -> Unit = { key ->
if (key != railSelection) showRailPage(key, false)
@@ -86,16 +86,19 @@ import com.droiddeck.launcher.R
internal enum class CheckState { OK, WARN, BUSY }
private const val STORAGE_TAB = 3
private const val LAUNCHER_TAB = 2
private val OVERVIEW_TAB = SettingsSection.OVERVIEW.ordinal
private val PERFORMANCE_TAB = SettingsSection.PERFORMANCE.ordinal
private val CONTROLLER_TAB = SettingsSection.CONTROLLER.ordinal
private val GLASSES_TAB = SettingsSection.GLASSES.ordinal
private val LAUNCHER_TAB = SettingsSection.LAUNCHER.ordinal
private val DEVELOPER_TAB = SettingsSection.DEVELOPER.ordinal
internal object SetupTabs {
var openLauncher = false
var focusTabs = false
var openOverview = false
var openSection by mutableStateOf<SettingsSection?>(null)
}
private const val GLASSES_TAB = 6
private const val SYNC_TAB = 4
@Composable
internal fun CheckRow(state: CheckState, title: String, detail: String?, divider: Boolean = true, action: (@Composable () -> Unit)? = null) {
@@ -193,40 +196,28 @@ internal fun SetupPanel(
onDismiss = { editDownloadProxy = false },
onSave = { a.onDownloadProxy(it); editDownloadProxy = false },
)
val tabs = listOf(stringResource(R.string.setup_tab_overview), stringResource(R.string.setup_tab_controller), stringResource(R.string.setup_tab_launcher), stringResource(R.string.setup_tab_storage), stringResource(R.string.setup_tab_sync), stringResource(R.string.setup_tab_diagnostics), stringResource(R.string.setup_tab_glasses))
var tab by rememberSaveable { mutableStateOf(if (SetupTabs.openLauncher) LAUNCHER_TAB else 0) }
val tabs = SettingsSection.entries.map { stringResource(it.title) }
var tab by rememberSaveable { mutableStateOf(SetupTabs.openSection?.ordinal ?: if (SetupTabs.openLauncher) LAUNCHER_TAB else OVERVIEW_TAB) }
var query by rememberSaveable { mutableStateOf("") }
var searching by rememberSaveable { mutableStateOf(false) }
var logsRefresh by remember { mutableStateOf(0) }
var deleteSessionLogs by remember { mutableStateOf<java.io.File?>(null) }
SetupTabs.openLauncher = false
if (SetupTabs.openOverview) { tab = 0; SetupTabs.openOverview = false }
if (SetupTabs.openOverview) { tab = OVERVIEW_TAB; SetupTabs.openOverview = false }
LaunchedEffect(SetupTabs.openSection) {
SetupTabs.openSection?.let { tab = it.ordinal; searching = false; query = "" }
SetupTabs.openSection = null
}
val chipFocus = remember { List(tabs.size) { FocusRequester() } }
var tabTurned by remember { mutableStateOf(false) }
val pick: (Int) -> Unit = { i -> tab = i; tabTurned = true; if (i == 5) logsRefresh++ }
val pick: (Int) -> Unit = { i -> tab = i; tabTurned = true; searching = false; query = ""; if (i == DEVELOPER_TAB) logsRefresh++ }
val inputModeManager = LocalInputModeManager.current
LaunchedEffect(com.droiddeck.launcher.storage.StorageState.openRequests) {
if (com.droiddeck.launcher.storage.StorageState.openPending) {
com.droiddeck.launcher.storage.StorageState.openPending = false
tab = STORAGE_TAB
}
}
LaunchedEffect(Unit) {
while (true) {
kotlinx.coroutines.delay(2_000)
a.onRefreshPhantomStatus()
}
}
LaunchedEffect(com.droiddeck.launcher.sync.Syncthing.openRequests) {
if (com.droiddeck.launcher.sync.Syncthing.openPending) {
com.droiddeck.launcher.sync.Syncthing.openPending = false
tab = SYNC_TAB
}
}
var syncAdvanced by rememberSaveable { mutableStateOf(false) }
if (syncAdvanced) {
androidx.activity.compose.BackHandler { syncAdvanced = false }
SyncAdvancedPage(host) { syncAdvanced = false }
return
}
LaunchedEffect(tab) {
if (tabTurned && inputModeManager.inputMode == InputMode.Keyboard) {
androidx.compose.runtime.withFrameNanos { }
@@ -246,10 +237,18 @@ internal fun SetupPanel(
) {
PageHeader(stringResource(R.string.setup_title)) {
Box(Modifier.weight(1f)) { SheetChips(tabs, tab, chipFocus, onPick = pick) }
if (!searching) SearchIcon(stringResource(R.string.settings_search)) { searching = true }
}
Column(modifier = Modifier.weight(1f).fillMaxWidth().then(if (tab == 1) Modifier else Modifier.verticalScroll(rememberScrollState())).padding(bottom = if (tab == 1) 0.dp else 24.dp)) {
when (tab) {
0 -> {
if (searching) {
androidx.activity.compose.BackHandler { searching = false; query = "" }
SettingsSearchField(query, { query = it }) { searching = false; query = "" }
}
val listing = searching && query.isNotBlank()
val fixed = tab == CONTROLLER_TAB && !listing
Column(modifier = Modifier.weight(1f).fillMaxWidth().then(if (fixed) Modifier else Modifier.verticalScroll(rememberScrollState())).padding(bottom = if (fixed) 0.dp else 24.dp)) {
if (listing) SettingsSearchResults(query) { section -> pick(section.ordinal) }
else when (tab) {
OVERVIEW_TAB -> {
// Setup's "Safe mode" row, under the GPU row while the bridge is on and can be used here.
val bridgeModeRow = !s.adreno && s.vkBridge && com.droiddeck.launcher.core.DeviceSupport.bridgeUsable()
val gpuCheck: @Composable (Boolean) -> Unit = { divider ->
@@ -413,12 +412,16 @@ internal fun SetupPanel(
SettingsGroup(stringResource(R.string.setup_runtime)) { runtimeCheck(false) }
SteamIntegrationGroup(s.integration, s.integrationFocus, a.onIntegration, a.onIntegrationAppInfo, a.onIntegrationLocation)
}
1 -> {
PERFORMANCE_TAB -> {
a.performancePanel()
MemoryGroup(s, a, host, onPairWirelessDebugging)
}
CONTROLLER_TAB -> {
val controller = s.controller
if (controller != null && a.controller != null) InputSettingsPage(onBack = { pick(0) }, embedded = true)
if (controller != null && a.controller != null) InputSettingsPage(onBack = { pick(OVERVIEW_TAB) }, embedded = true)
if (s.controller == null || a.controller == null) Note(stringResource(R.string.setup_controller_unavailable))
}
2 -> {
LAUNCHER_TAB -> {
val look: @Composable () -> Unit = {
SettingsGroup(stringResource(R.string.setup_group_look)) {
SettingsRow(stringResource(R.string.setup_theme), stringResource(R.string.setup_theme_hint)) {
@@ -461,7 +464,6 @@ internal fun SetupPanel(
LanguageRow(host, s.language, a.onLanguage)
if (s.soundtracksEnabled) ToggleRow(host, "soundtracks-ingame", stringResource(R.string.setup_soundtracks_ingame), stringResource(R.string.setup_soundtracks_ingame_hint), s.soundtracksIngame, onChange = a.onSoundtracksIngame)
}
TabsSettingsGroup(host, s, a)
}
val device: @Composable () -> Unit = {
SettingsGroup(stringResource(R.string.setup_group_device)) {
@@ -588,12 +590,16 @@ internal fun SetupPanel(
} else Column { look(); device(); art(); download() }
}
}
STORAGE_TAB -> StoragePanel(s, a)
SYNC_TAB -> SyncPanel(host, runtimeOk) { syncAdvanced = true }
5 -> {
SettingsGroup(stringResource(R.string.setup_tab_diagnostics)) {
DEVELOPER_TAB -> {
val devContext = LocalContext.current
SettingsGroup(stringResource(R.string.dev_tools_title)) {
ToggleRow(host, "developer-tools", stringResource(R.string.dev_tools_title), stringResource(R.string.dev_tools_hint), DeveloperTools.on) {
DeveloperTools.set(devContext, it)
}
}
SettingsGroup(stringResource(R.string.dev_group_logs)) {
ToggleRow(host, "logs", stringResource(R.string.setup_logs), stringResource(R.string.setup_logs_hint), s.logsEnabled) { a.onLogs() }
ToggleRow(
if (DeveloperTools.on) ToggleRow(
host, "enhanced-diagnostics", stringResource(R.string.setup_enhanced_diagnostics),
stringResource(R.string.setup_enhanced_diagnostics_hint), s.enhancedDiagnosticsArmed,
) { a.onEnhancedDiagnostics() }
@@ -603,9 +609,9 @@ internal fun SetupPanel(
s.gameDebugLogsEnabled,
enabled = s.logsEnabled,
) { a.onGameDebugLogs() }
ToggleRow(host, "vacdiag", stringResource(R.string.setup_vac_diag), stringResource(R.string.setup_vac_diag_hint), s.vacDiagnostics) { a.onVacDiagnostics() }
ToggleRow(host, "agent-commands", stringResource(R.string.setup_agent_commands), null, s.agentCommands) { a.onAgentCommands() }
if (com.droiddeck.launcher.agent.AgentHost.available) {
if (DeveloperTools.on) ToggleRow(host, "vacdiag", stringResource(R.string.setup_vac_diag), stringResource(R.string.setup_vac_diag_hint), s.vacDiagnostics) { a.onVacDiagnostics() }
if (DeveloperTools.on) ToggleRow(host, "agent-commands", stringResource(R.string.setup_agent_commands), null, s.agentCommands) { a.onAgentCommands() }
if (DeveloperTools.on && com.droiddeck.launcher.agent.AgentHost.available) {
val agentContext = androidx.compose.ui.platform.LocalContext.current
ToggleRow(host, "agent-pet", stringResource(R.string.setup_agent_pet), stringResource(R.string.setup_agent_pet_hint), AgentPet.enabled) {
AgentPet.set(agentContext, it)
@@ -615,8 +621,8 @@ internal fun SetupPanel(
stringResource(R.string.setup_agent_pet_allow), onClick = { AgentPet.requestFloating(agentContext) },
)
}
ToggleRow(host, "graphics-logs", stringResource(R.string.setup_graphics_logs), stringResource(R.string.setup_graphics_logs_hint), s.graphicsLogs) { a.onGraphicsLogs() }
if (!s.adreno && com.droiddeck.launcher.session.SessionPrefs.steamGpuCompositingAllowed()) ToggleRow(host, "steam-gpu-drawing", stringResource(R.string.setup_steam_gpu_drawing), stringResource(R.string.setup_steam_gpu_drawing_hint), s.steamGpuDrawing) { a.onSteamGpuDrawing() }
if (DeveloperTools.on) ToggleRow(host, "graphics-logs", stringResource(R.string.setup_graphics_logs), stringResource(R.string.setup_graphics_logs_hint), s.graphicsLogs) { a.onGraphicsLogs() }
if (DeveloperTools.on && !s.adreno && com.droiddeck.launcher.session.SessionPrefs.steamGpuCompositingAllowed()) ToggleRow(host, "steam-gpu-drawing", stringResource(R.string.setup_steam_gpu_drawing), stringResource(R.string.setup_steam_gpu_drawing_hint), s.steamGpuDrawing) { a.onSteamGpuDrawing() }
ActionRow(stringResource(R.string.setup_latest_logs), stringResource(R.string.drawer_logs_hint), stringResource(R.string.drawer_share_logs), a.onShareLogs,
progress = com.droiddeck.launcher.session.SessionLogShare.progress)
androidx.compose.material3.HorizontalDivider()
@@ -661,38 +667,6 @@ internal fun SetupPanel(
ActionRow(stringResource(R.string.setup_reset_settings), stringResource(R.string.setup_reset_settings_hint),
stringResource(R.string.setup_reset_settings_button), a.onResetSettings)
}
SettingsGroup(stringResource(R.string.setup_group_memory)) {
ToggleRow(
host, "clear-cached-apps", stringResource(R.string.setup_clear_cached),
stringResource(if (s.adbPaired) R.string.setup_clear_cached_hint else R.string.setup_clear_cached_unpaired),
s.clearCachedApps, enabled = s.adbPaired || s.clearCachedApps,
) { a.onClearCachedApps(it) }
ChoiceRow(
host, "background-app-limit", stringResource(R.string.setup_bg_limit),
stringResource(if (s.adbPaired) R.string.setup_bg_limit_hint else R.string.setup_clear_cached_unpaired),
listOf(
com.droiddeck.launcher.core.BackgroundAppLimit.OFF to stringResource(R.string.game_env_off),
4 to stringResource(R.string.setup_bg_limit_4),
1 to stringResource(R.string.setup_bg_limit_1),
0 to stringResource(R.string.setup_bg_limit_0),
),
s.backgroundAppLimit, enabled = s.adbPaired || s.backgroundAppLimit != com.droiddeck.launcher.core.BackgroundAppLimit.OFF,
onPick = a.onBackgroundAppLimit,
)
ChoiceRow(
host, "memory-hud", stringResource(R.string.setup_memory_hud), stringResource(R.string.setup_memory_hud_hint),
listOf(
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_OFF to stringResource(R.string.game_env_off),
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_SIMPLE to stringResource(R.string.setup_memory_hud_simple),
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_ADVANCED to stringResource(R.string.setup_memory_hud_advanced),
),
s.memoryHud, onPick = a.onMemoryHud,
)
if (!s.adbPaired) ActionRow(
stringResource(R.string.setup_adb_pair), stringResource(R.string.setup_adb_pair_hint),
stringResource(R.string.setup_adb_pair_button), onPairWirelessDebugging,
)
}
}
GLASSES_TAB -> GlassesSetupPanel()
}
@@ -715,6 +689,42 @@ internal fun SetupPanel(
}
}
@Composable
private fun MemoryGroup(s: FrontEndState, a: FrontEndActions, host: MenuHost, onPairWirelessDebugging: () -> Unit) {
SettingsGroup(stringResource(R.string.setup_group_background_apps)) {
ToggleRow(
host, "clear-cached-apps", stringResource(R.string.setup_clear_cached),
stringResource(if (s.adbPaired) R.string.setup_clear_cached_hint else R.string.setup_clear_cached_unpaired),
s.clearCachedApps, enabled = s.adbPaired || s.clearCachedApps,
) { a.onClearCachedApps(it) }
ChoiceRow(
host, "background-app-limit", stringResource(R.string.setup_bg_limit),
stringResource(if (s.adbPaired) R.string.setup_bg_limit_hint else R.string.setup_clear_cached_unpaired),
listOf(
com.droiddeck.launcher.core.BackgroundAppLimit.OFF to stringResource(R.string.game_env_off),
4 to stringResource(R.string.setup_bg_limit_4),
1 to stringResource(R.string.setup_bg_limit_1),
0 to stringResource(R.string.setup_bg_limit_0),
),
s.backgroundAppLimit, enabled = s.adbPaired || s.backgroundAppLimit != com.droiddeck.launcher.core.BackgroundAppLimit.OFF,
onPick = a.onBackgroundAppLimit,
)
ChoiceRow(
host, "memory-hud", stringResource(R.string.setup_memory_hud), stringResource(R.string.setup_memory_hud_hint),
listOf(
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_OFF to stringResource(R.string.game_env_off),
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_SIMPLE to stringResource(R.string.setup_memory_hud_simple),
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_ADVANCED to stringResource(R.string.setup_memory_hud_advanced),
),
s.memoryHud, onPick = a.onMemoryHud,
)
if (!s.adbPaired) ActionRow(
stringResource(R.string.setup_adb_pair), stringResource(R.string.setup_adb_pair_hint),
stringResource(R.string.setup_adb_pair_button), onPairWirelessDebugging,
)
}
}
@Composable
internal fun ReadinessCard(
passing: Int, total: Int, line: String, open: Boolean, onDetails: () -> Unit, title: String? = null, ready: Boolean = passing == total,
@@ -322,7 +322,7 @@ internal fun LiftHero(
val touchOnly = inputMode.inputMode == InputMode.Touch
val lipFocus = remember { FocusRequester() }
val settingsLabel = stringResource(R.string.drawer_page_settings)
val settingsLabel = stringResource(R.string.sheet_lip)
var lipFocused by remember { mutableStateOf(false) }
val lipWanted = !open && (!shown || lipBack) && (playFocused || playHovered || touchOnly || lipFocused) && drop?.let { it.open || it.shown } != true
LaunchedEffect(lipWanted) {
@@ -666,7 +666,7 @@ internal fun Handle(height: Dp, above: Boolean = false) {
.drawBorderSidesAndFoot(pal.line, 12.dp, flip = above)
.padding(start = 14.dp, end = 10.dp),
) {
Text(stringResource(R.string.drawer_page_settings), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant, maxLines = 1)
Text(stringResource(R.string.sheet_lip), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant, maxLines = 1)
Icon(
if (above) Icons.Filled.KeyboardArrowDown else Icons.Filled.KeyboardArrowUp, null, tint = colors.onSurfaceVariant,
modifier = Modifier.size(16.dp).graphicsLayer { translationY = if (still) 0f else (if (above) 3.dp else -3.dp).toPx() * lift },
@@ -213,6 +213,14 @@ class SheetExtras(
fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras: SheetExtras = SheetExtras()) {
val steam = s.mode == SessionService.MODE_STEAM
val host = rememberMenuHost()
Text(
stringResource(when (s.mode) {
SessionService.MODE_STEAM -> R.string.sheet_scope_steam
SessionService.MODE_DESKTOP -> R.string.sheet_scope_desktop
else -> R.string.sheet_scope_other
}),
fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = 2.dp, bottom = 4.dp),
)
if (tab == SheetTab.DISPLAY) {
val context = LocalContext.current
val portraitWindow = SessionPrefs.portrait(context)
@@ -28,6 +28,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
@@ -43,10 +44,9 @@ internal fun MorePage(s: FrontEndState, a: FrontEndActions, onSelect: (String) -
Column(modifier.verticalScroll(rememberScrollState())) {
PageHeader(stringResource(R.string.rail_more)) {
Spacer(Modifier.weight(1f))
SecondaryButton(stringResource(R.string.more_edit_tabs), compact = true) {
SetupTabs.openLauncher = true
SetupTabs.focusTabs = true
onSelect("setup")
SecondaryButton(stringResource(R.string.more_edit_tabs), compact = true,
modifier = Modifier.focusRequester(MoreTabs.button).testTag("more-edit-tabs")) {
MoreTabs.editing = true
}
}
BoxWithConstraints(Modifier.fillMaxWidth()) {
@@ -10,10 +10,25 @@ import com.droiddeck.launcher.session.SessionPrefs
internal enum class TabPlace { BAR, MORE, HIDDEN }
internal object DeveloperTools {
var on by mutableStateOf(false)
private set
fun load(context: Context) {
on = SessionPrefs.developerTools(context)
}
fun set(context: Context, enabled: Boolean) {
on = enabled
SessionPrefs.setDeveloperTools(context, enabled)
}
}
internal object NavTabs {
const val MORE = "more"
val FEATURES = setOf("stores", "soundtracks", "agent")
val ALL = listOf("steam", "games", "soundtracks", "stores", "desktop", "agent", "components", "android-apps", "setup", "updates")
val ALL = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates")
private val SHELVED_WHEN_NEW = setOf("storage", "sync")
var order by mutableStateOf(ALL)
private set
@@ -23,8 +38,10 @@ internal object NavTabs {
private set
fun load(context: Context) {
order = arrange(SessionPrefs.navTabOrder(context))
shelved = SessionPrefs.navTabShelved(context).intersect(ALL.toSet())
val saved = SessionPrefs.navTabOrder(context)
order = arrange(saved)
shelved = SessionPrefs.navTabShelved(context).intersect(ALL.toSet()) +
if (saved.isEmpty()) emptySet() else SHELVED_WHEN_NEW - saved.toSet()
hidden = SessionPrefs.navTabHidden(context).intersect(ALL.toSet()) - FEATURES - "setup"
}
@@ -41,7 +58,7 @@ internal object NavTabs {
fun available(s: FrontEndState, key: String): Boolean = when (key) {
"android-apps" -> s.isHomeApp
"agent" -> AgentHost.available
"agent" -> AgentHost.available && DeveloperTools.on
else -> true
}
@@ -54,7 +71,7 @@ internal object NavTabs {
}
private fun featureOff(s: FrontEndState, key: String) = when (key) {
"stores" -> !s.gameStoresEnabled
"stores", "downloads" -> !s.gameStoresEnabled
"soundtracks" -> !s.soundtracksEnabled
"agent" -> !AgentTab.shown
else -> false
@@ -83,15 +83,12 @@ fun PerformancePage(
onClientCore: (Int, Boolean) -> Unit,
onGameCore: (Int, Boolean) -> Unit,
onDismiss: () -> Unit,
embedded: Boolean = false,
) {
val host = rememberMenuHost()
val colors = MaterialTheme.colorScheme
val coreItems = cores.map { it.core to it.label }
SettingsPage(
host, title = stringResource(R.string.perf_title),
lede = stringResource(R.string.perf_lede),
onBack = onDismiss,
) {
val body: @Composable () -> Unit = {
SettingsGroup(stringResource(R.string.perf_client_cores_group)) {
ToggleRow(
host, "override", stringResource(R.string.perf_override),
@@ -252,4 +249,12 @@ fun PerformancePage(
}
}
}
if (embedded) Column {
Text(stringResource(R.string.perf_lede), fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp, vertical = 6.dp))
body()
} else SettingsPage(
host, title = stringResource(R.string.perf_title),
lede = stringResource(R.string.perf_lede),
onBack = onDismiss,
) { body() }
}
@@ -0,0 +1,131 @@
package com.droiddeck.launcher.ui
import androidx.activity.compose.BackHandler
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
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.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.foundation.focusGroup
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.droiddeck.launcher.R
internal object MoreTabs {
var editing by mutableStateOf(false)
val button = FocusRequester()
}
@Composable
internal fun StorageTabPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier) {
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
PageHeader(stringResource(R.string.rail_storage))
StoragePanel(s, a)
}
}
@Composable
internal fun SyncTabPage(s: FrontEndState, modifier: Modifier) {
val host = rememberMenuHost()
var advanced by rememberSaveable { mutableStateOf(false) }
if (advanced) {
BackHandler { advanced = false }
Box(modifier) { SyncAdvancedPage(host) { advanced = false } }
return
}
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
PageHeader(stringResource(R.string.rail_sync))
SyncPanel(host, s.ready && !s.busy && !s.removalPending) { advanced = true }
}
}
@OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class)
@Composable
internal fun EditTabsSheet(s: FrontEndState, a: FrontEndActions) {
val pal = LocalPalette.current
BackHandler(enabled = MoreTabs.editing) { MoreTabs.editing = false }
androidx.compose.runtime.DisposableEffect(Unit) { onDispose { MoreTabs.editing = false } }
var wasOpen by remember { mutableStateOf(false) }
val closeInput = androidx.compose.ui.platform.LocalInputModeManager.current
LaunchedEffect(MoreTabs.editing) {
if (MoreTabs.editing) wasOpen = true
else if (wasOpen && closeInput.inputMode == androidx.compose.ui.input.InputMode.Keyboard) focusSoon { MoreTabs.button }
}
Box(Modifier.fillMaxSize()) {
AnimatedVisibility(MoreTabs.editing, enter = fadeIn(), exit = fadeOut()) {
Box(
Modifier.fillMaxSize().background(Color.Black.copy(alpha = 0.45f))
.focusProperties { canFocus = false }
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) { MoreTabs.editing = false },
)
}
BoxWithConstraints(Modifier.fillMaxSize(), contentAlignment = Alignment.CenterEnd) {
val width = minOf(560.dp, maxWidth * 0.92f)
AnimatedVisibility(MoreTabs.editing, enter = slideInHorizontally { it } + fadeIn(), exit = slideOutHorizontally { it } + fadeOut()) {
val inside = remember { FocusRequester() }
var holds by remember { mutableStateOf(false) }
val openInput = androidx.compose.ui.platform.LocalInputModeManager.current
// The launcher only takes focus in controller mode, so opening by touch switches to it like startup does.
LaunchedEffect(Unit) {
repeat(60) {
androidx.compose.runtime.withFrameNanos { }
if (holds || !MoreTabs.editing) return@LaunchedEffect
if (openInput.inputMode != androidx.compose.ui.input.InputMode.Keyboard) openInput.requestInputMode(androidx.compose.ui.input.InputMode.Keyboard)
runCatching { inside.requestFocus() }
}
}
Column(
Modifier.width(width).fillMaxHeight()
.onFocusChanged { holds = it.hasFocus }
.focusRequester(inside)
.focusProperties { exit = { if (MoreTabs.editing) FocusRequester.Cancel else FocusRequester.Default } }
.focusGroup()
.background(MaterialTheme.colorScheme.background)
.border(1.dp, pal.line).padding(horizontal = 18.dp, vertical = 16.dp).testTag("edit-tabs-sheet"),
) {
PageHeader(stringResource(R.string.more_edit_tabs)) {
Spacer(Modifier.weight(1f))
SmallIconButton(Icons.Filled.Close, stringResource(R.string.common_close), tint = MaterialTheme.colorScheme.onSurfaceVariant) {
MoreTabs.editing = false
}
}
Column(Modifier.weight(1f).verticalScroll(rememberScrollState())) {
TabsSettingsGroup(rememberMenuHost(), s, a)
}
}
}
}
}
}
@@ -14,7 +14,7 @@ internal enum class SessionDrawerPage(val firstControl: String) {
}
internal fun sessionDrawerPages(
hasSecondScreen: Boolean, hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentHost.installed && com.droiddeck.launcher.agent.AgentTab.shown,
hasSecondScreen: Boolean, hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentHost.installed && com.droiddeck.launcher.agent.AgentTab.shown && DeveloperTools.on,
): List<SessionDrawerPage> =
SessionDrawerPage.entries.filter {
(hasSecondScreen || it != SessionDrawerPage.SECOND_SCREEN) && (hasGlasses || it != SessionDrawerPage.GLASSES) &&
@@ -77,6 +77,7 @@ import androidx.compose.ui.text.PlatformTextStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.platform.testTag
@Composable
@@ -223,6 +224,9 @@ fun LoadingOverlay(
modifier = Modifier.align(Alignment.BottomCenter).padding(start = 120.dp, end = 120.dp, bottom = 28.dp),
)
if (!ended && onCancel != null) CancelHint(onCancel, Modifier.align(Alignment.BottomEnd).padding(end = 16.dp, bottom = 16.dp))
if (!ended && onShareLogs != null) androidx.compose.material3.TextButton(
onClick = onShareLogs, modifier = Modifier.align(Alignment.BottomStart).padding(start = 16.dp, bottom = 12.dp).testTag("loading-report"),
) { Text(stringResource(R.string.report_problem), fontSize = 13.sp, color = colors.onSurfaceVariant) }
if (flood != null) FloodGather(flood, ball, onFlooded)
}
}
@@ -242,7 +246,7 @@ private fun EndedActions(onRetry: (() -> Unit)?, onRepair: (() -> Unit)?, onShar
if (onRepair != null) SecondaryButton(stringResource(R.string.store_try_again), modifier = claim(), onClick = onRetry)
else PrimaryButton(stringResource(R.string.store_try_again), modifier = claim(), onClick = onRetry)
}
if (onShareLogs != null) SecondaryButton(stringResource(R.string.drawer_share_logs), modifier = claim(),
if (onShareLogs != null) SecondaryButton(stringResource(R.string.report_problem), modifier = claim(),
progress = com.droiddeck.launcher.session.SessionLogShare.progress, onClick = onShareLogs)
if (onClose != null) SecondaryButton(stringResource(R.string.mode_back), modifier = claim(), onClick = onClose)
}
@@ -277,6 +277,8 @@ class DrawerActions(
val onFrameGenReset: () -> Unit = {},
val fpsLimit: Int = 0,
val onFpsLimit: (Int) -> Unit = {},
val cornerTap: Boolean = false,
val onCornerTap: (Boolean) -> Unit = {},
val blackFrameInsertion: Boolean = false,
val blackFrameInsertionAvailable: Boolean = false,
val onBlackFrameInsertion: (Boolean) -> Unit = {},
@@ -618,6 +620,14 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
format = { if (it <= SessionPrefs.FPS_LIMIT_OFF) offLabel else it.toString() },
modifier = focus.track(page, "fps-limit"),
onChange = { a.onFpsLimit(if (it <= SessionPrefs.FPS_LIMIT_OFF) 0 else it) })
if (a.steam && !a.direct && a.onQam != null) SettingsRow(
stringResource(R.string.drawer_frame_limit), stringResource(R.string.drawer_frame_limit_steam_hint),
) {
DrawerOutlineButton(stringResource(R.string.drawer_open_steam_qam), modifier = focus.track(page, "fps-limit-steam")) {
host.open = null
a.onQam?.invoke()
}
}
}
SettingsGroup(stringResource(R.string.display_image_scaling)) {
if (a.steam) SettingsRow(stringResource(R.string.display_integer_scaling), null) {
@@ -728,6 +738,9 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
SessionPrefs.BACK_DOUBLE_TAP_MS_OPTIONS.map { it to stringResource(R.string.back_tap_ms, it) },
a.backDoubleTapMs, chipModifier = focus.track(page, "back-double-tap"), onPick = a.onBackDoubleTapMs)
PhysicalShortcutRows(modifierFor = { focus.track(page, "physical-shortcut-${it.name}") })
ToggleRow(host, "corner-tap", stringResource(R.string.drawer_corner_tap),
stringResource(R.string.drawer_corner_tap_hint), a.cornerTap,
chipModifier = focus.track(page, "corner-tap"), onChange = a.onCornerTap)
}
SettingsGroup(stringResource(R.string.drawer_latency)) {
ToggleRow(host, "low-latency", stringResource(R.string.drawer_low_latency),
@@ -820,6 +833,15 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
}
SessionDrawerPage.AGENT -> Unit
SessionDrawerPage.SESSION -> {
SettingsGroup(stringResource(R.string.drawer_support)) {
SettingsRow(stringResource(R.string.report_problem), stringResource(R.string.report_problem_hint)) {
DrawerOutlineButton(stringResource(R.string.drawer_share_logs), modifier = focus.track(page, "share-logs"),
progress = com.droiddeck.launcher.session.SessionLogShare.progress) {
host.open = null
a.onShareLogs()
}
}
}
if (a.isHomeApp) SettingsGroup(stringResource(R.string.drawer_android_apps)) {
SettingsRow(stringResource(R.string.drawer_launch_app), null) {
DrawerOutlineButton(if (androidAppsExpanded) stringResource(R.string.common_hide) else stringResource(R.string.common_show), modifier = focus.track(page, "apps")) {
@@ -874,15 +896,6 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
onChange = a.onSteamDownloadsInBackground,
)
}
SettingsGroup(stringResource(R.string.drawer_support)) {
SettingsRow(stringResource(R.string.drawer_logs), stringResource(R.string.drawer_logs_hint)) {
DrawerOutlineButton(stringResource(R.string.drawer_share_logs), modifier = focus.track(page, "share-logs"),
progress = com.droiddeck.launcher.session.SessionLogShare.progress) {
host.open = null
a.onShareLogs()
}
}
}
if (a.pipSupported) SettingsGroup(stringResource(R.string.pip_title)) {
ToggleRow(host, "pip-auto", stringResource(R.string.pip_auto), null,
a.pipAutoEnter, onChange = a.onPipAutoEnter)
@@ -0,0 +1,153 @@
package com.droiddeck.launcher.ui
import android.content.Context
import androidx.annotation.StringRes
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import com.droiddeck.launcher.R
internal enum class SettingsSection(val key: String, @StringRes val title: Int) {
OVERVIEW("overview", R.string.setup_tab_overview),
PERFORMANCE("performance", R.string.setup_tab_performance),
CONTROLLER("controller", R.string.setup_tab_controller),
GLASSES("glasses", R.string.setup_tab_glasses),
LAUNCHER("launcher", R.string.setup_tab_launcher),
DEVELOPER("developer", R.string.setup_tab_diagnostics);
companion object {
fun of(key: String?): SettingsSection? = entries.firstOrNull { it.key == key }
}
}
internal object RailRequest {
var key by androidx.compose.runtime.mutableStateOf<String?>(null)
}
internal enum class SettingsPlace(@StringRes val title: Int) {
SETTINGS(R.string.settings_place_settings),
TAB(R.string.settings_place_tab),
DRAWER(R.string.settings_place_drawer),
SHEET(R.string.settings_place_sheet),
STEAM_QAM(R.string.settings_place_steam_qam),
}
internal class SettingsEntry(
val place: SettingsPlace,
@StringRes val title: Int,
@StringRes val group: Int? = null,
val section: SettingsSection? = null,
val words: List<String> = emptyList(),
val developer: Boolean = false,
val tab: String? = null,
) {
val within: Int? get() = section?.title ?: tab?.let { railLabelIcon(it).first } ?: group
fun path(context: Context): List<String> =
listOfNotNull(context.getString(place.title), within?.let(context::getString), context.getString(title))
fun matches(context: Context, query: String): Boolean {
val q = query.trim().lowercase()
if (q.isEmpty()) return false
val text = (path(context) + words).joinToString(" ").lowercase()
return q.split(Regex("\\s+")).all { it in text }
}
}
internal object SettingsIndex {
private fun s(section: SettingsSection, @StringRes title: Int, vararg words: String) =
SettingsEntry(SettingsPlace.SETTINGS, title, section = section, words = words.toList())
private fun d(@StringRes group: Int, @StringRes title: Int, vararg words: String) =
SettingsEntry(SettingsPlace.DRAWER, title, group = group, words = words.toList())
private fun sh(@StringRes group: Int, @StringRes title: Int, vararg words: String) =
SettingsEntry(SettingsPlace.SHEET, title, group = group, words = words.toList())
val entries: List<SettingsEntry> = listOf(
s(SettingsSection.OVERVIEW, R.string.setup_runtime, "ubuntu", "linux", "repair", "update"),
s(SettingsSection.OVERVIEW, R.string.setup_limit, "phantom", "process", "killed", "background"),
s(SettingsSection.OVERVIEW, R.string.setup_account, "steam", "login", "sign in"),
s(SettingsSection.PERFORMANCE, R.string.perf_override, "steam client cores", "cpu"),
s(SettingsSection.PERFORMANCE, R.string.perf_game_cores, "cpu", "pin", "cores", "affinity"),
s(SettingsSection.PERFORMANCE, R.string.perf_pace_cores, "cpu"),
s(SettingsSection.PERFORMANCE, R.string.perf_glthread, "opengl", "gl"),
s(SettingsSection.PERFORMANCE, R.string.perf_zink),
s(SettingsSection.PERFORMANCE, R.string.perf_noglerror),
s(SettingsSection.PERFORMANCE, R.string.perf_gsrealtime, "gamescope"),
s(SettingsSection.PERFORMANCE, R.string.perf_gpuclock, "gpu", "clock", "max"),
s(SettingsSection.PERFORMANCE, R.string.perf_ram_cap, "ram", "memory"),
s(SettingsSection.PERFORMANCE, R.string.perf_vram_cap, "vram", "memory"),
s(SettingsSection.PERFORMANCE, R.string.perf_zram_idle, "zram", "swap", "memory"),
s(SettingsSection.PERFORMANCE, R.string.perf_zram_client, "zram", "swap", "memory"),
s(SettingsSection.PERFORMANCE, R.string.setup_clear_cached, "memory", "ram", "crash", "sleep", "killed"),
s(SettingsSection.PERFORMANCE, R.string.setup_bg_limit, "memory", "ram", "background apps"),
s(SettingsSection.PERFORMANCE, R.string.setup_memory_hud, "memory", "ram", "overlay"),
s(SettingsSection.PERFORMANCE, R.string.perf_sysmem),
s(SettingsSection.PERFORMANCE, R.string.perf_xalia),
s(SettingsSection.PERFORMANCE, R.string.perf_esync, "esync", "sync", "wine"),
s(SettingsSection.PERFORMANCE, R.string.perf_fsync, "fsync", "sync", "wine"),
s(SettingsSection.PERFORMANCE, R.string.perf_fastsync, "ntsync", "sync", "wine"),
s(SettingsSection.PERFORMANCE, R.string.perf_seccomp, "proot"),
s(SettingsSection.PERFORMANCE, R.string.perf_fastpath, "proot"),
s(SettingsSection.PERFORMANCE, R.string.perf_native_userland, "proot"),
s(SettingsSection.PERFORMANCE, R.string.perf_cursor_composite, "mouse", "cursor"),
s(SettingsSection.PERFORMANCE, R.string.perf_hostname, "name"),
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")),
s(SettingsSection.GLASSES, R.string.setup_tab_glasses, "xreal", "viture", "vr", "ar"),
s(SettingsSection.LAUNCHER, R.string.setup_theme, "color", "dark"),
s(SettingsSection.LAUNCHER, R.string.setup_app_scale, "size", "zoom"),
s(SettingsSection.LAUNCHER, R.string.setup_launcher_icon),
s(SettingsSection.LAUNCHER, R.string.setup_animations),
s(SettingsSection.LAUNCHER, R.string.setup_rail_labels, "sidebar"),
s(SettingsSection.LAUNCHER, R.string.setup_language, "translate"),
SettingsEntry(SettingsPlace.TAB, R.string.setup_stores_speed, tab = "downloads", words = listOf("download", "speed", "bandwidth", "slow")),
SettingsEntry(SettingsPlace.TAB, R.string.stores_parallel, tab = "downloads", words = listOf("download", "parallel", "queue", "at once")),
SettingsEntry(SettingsPlace.TAB, R.string.setup_group_tabs, tab = NavTabs.MORE, words = listOf("tabs", "hide", "reorder", "agent", "stores", "edit tabs")),
s(SettingsSection.LAUNCHER, R.string.setup_home, "home screen", "launcher"),
s(SettingsSection.LAUNCHER, R.string.setup_launcher_orientation, "rotate", "portrait"),
s(SettingsSection.LAUNCHER, R.string.setup_session_orientation, "rotate", "portrait"),
s(SettingsSection.LAUNCHER, R.string.setup_fullscreen),
s(SettingsSection.LAUNCHER, R.string.setup_dual_screen_launcher, "thor", "second screen", "bottom screen"),
s(SettingsSection.LAUNCHER, R.string.setup_low_storage_warning),
s(SettingsSection.LAUNCHER, R.string.mode_sgdb_key, "artwork", "steamgriddb"),
s(SettingsSection.LAUNCHER, R.string.setup_download_source, "mirror", "china"),
s(SettingsSection.LAUNCHER, R.string.setup_download_proxy),
s(SettingsSection.DEVELOPER, R.string.setup_latest_logs, "logs", "log", "bug", "report", "crash", "zip"),
s(SettingsSection.DEVELOPER, R.string.setup_logs, "logs"),
s(SettingsSection.DEVELOPER, R.string.setup_game_debug_logs, "logs", "wine", "proton"),
SettingsEntry(SettingsPlace.SETTINGS, R.string.setup_enhanced_diagnostics, section = SettingsSection.DEVELOPER, words = listOf("logs"), developer = true),
s(SettingsSection.DEVELOPER, R.string.setup_reset_settings, "default"),
s(SettingsSection.DEVELOPER, R.string.dev_tools_title, "agent", "ai", "claude", "codex"),
SettingsEntry(SettingsPlace.SETTINGS, R.string.setup_graphics_logs, section = SettingsSection.DEVELOPER, words = listOf("logs", "gpu"), developer = true),
d(R.string.drawer_page_display, R.string.drawer_frame_limit, "fps", "cap", "limit", "non-steam", "desktop"),
d(R.string.drawer_page_display, R.string.frame_gen_title, "lsfg", "lossless", "fps"),
d(R.string.drawer_page_display, R.string.display_filter, "upscale", "fsr", "sharpness"),
d(R.string.drawer_hud, R.string.drawer_hud, "fps", "counter", "overlay", "performance"),
d(R.string.drawer_page_controller, R.string.input_touchscreen, "touch", "mouse", "direct", "touchpad", "click"),
d(R.string.drawer_page_controller, R.string.mode_osc, "on-screen", "controls", "touch controls", "buttons"),
d(R.string.drawer_page_controller, R.string.osc_steam_layout, "touch layout", "edit layout", "on-screen"),
d(R.string.drawer_page_controller, R.string.drawer_pc_keyboard, "keyboard", "typing"),
d(R.string.mode_session, R.string.report_problem, "logs", "log", "bug", "crash", "share", "zip"),
d(R.string.mode_session, R.string.mode_suspend, "sleep", "background", "native", "resume"),
SettingsEntry(SettingsPlace.STEAM_QAM, R.string.drawer_frame_limit, R.string.perf_title, words = listOf("fps", "cap", "limit", "steam games")),
SettingsEntry(SettingsPlace.STEAM_QAM, R.string.perf_title, words = listOf("performance overlay", "fps", "counter", "tdp")),
sh(R.string.drawer_page_display, R.string.display_session, "resolution", "scaling", "hdr", "refresh"),
sh(R.string.drawer_page_display, R.string.sheet_graphics_drivers, "turnip", "driver", "gpu", "adreno", "mali"),
sh(R.string.mode_tab_steam, R.string.setup_offline, "offline", "steam"),
sh(R.string.mode_audio, R.string.mode_mic, "microphone", "voice"),
sh(R.string.mode_session, R.string.mode_suspend, "sleep", "background"),
sh(R.string.stores_tab_library, R.string.stores_tab_library, "second library", "sd card", "steam library"),
)
fun search(context: Context, query: String): List<SettingsEntry> =
entries.filter { (!it.developer || DeveloperTools.on) && it.matches(context, query) }
}
@@ -0,0 +1,68 @@
package com.droiddeck.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.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import com.droiddeck.launcher.R
@Composable
internal fun SettingsSearchField(query: String, onQuery: (String) -> Unit, onClose: () -> Unit) {
Row(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp),
) {
AdbTextField(
value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search,
placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = true,
modifier = Modifier.weight(1f),
)
SmallIconButton(Icons.Filled.Close, stringResource(R.string.settings_search_clear), tint = MaterialTheme.colorScheme.onSurfaceVariant, onClick = onClose)
}
}
@Composable
internal fun SettingsSearchResults(query: String, onOpen: (SettingsSection) -> Unit) {
val ctx = LocalContext.current
val found = remember(query) { SettingsIndex.search(ctx, query) }
if (found.isEmpty()) {
Note(stringResource(R.string.settings_search_none, query.trim()))
return
}
Column {
found.groupBy { it.place }.forEach { (place, entries) ->
SettingsGroup(stringResource(place.title)) {
entries.forEach { entry ->
val within = entry.within?.let { stringResource(it) }
val title = stringResource(entry.title)
val section = entry.section
val tab = entry.tab
if (section != null) {
ActionRow(title, within, stringResource(R.string.store_open), onClick = { onOpen(section) })
} else if (tab != null) {
ActionRow(title, within, stringResource(R.string.store_open), onClick = {
if (tab == NavTabs.MORE) MoreTabs.editing = true
if (tab == "downloads") DownloadsNav.showSettings = true
RailRequest.key = tab
})
} else {
SettingsRow(title, entry.path(ctx).dropLast(1).joinToString(" › ")) {}
}
}
}
}
}
}
@@ -23,7 +23,7 @@ internal fun FrameGenGroup(s: FrontEndState, a: FrontEndActions) {
internal fun PerformanceLink(a: FrontEndActions, rail: String, tab: String) {
val id = "sheet:performance"
val title = stringResource(R.string.setup_tool_performance)
SettingsGroup(title) {
SettingsGroup(stringResource(R.string.sheet_all_settings_hint)) {
LinkRow(title, stringResource(R.string.setup_tool_performance_hint), stringResource(R.string.store_open), id, arrow = "›") {
Hops.sources[id]?.let { at ->
PageOrigin.mark(Origin(at, 12f * Hops.density))
@@ -31,6 +31,9 @@ internal fun PerformanceLink(a: FrontEndActions, rail: String, tab: String) {
}
a.onPerformance()
}
LinkRow(stringResource(R.string.sheet_all_settings), stringResource(R.string.setup_title), stringResource(R.string.store_open), "sheet:all-settings", arrow = "›") {
SetupTabs.openSection = SettingsSection.OVERVIEW
}
}
}
@@ -145,6 +145,8 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
words = {
val runtimeStatus: @Composable () -> Unit = {
if (s.busy || (s.available != null && s.available != s.installed)) RuntimeChip(s)
else if (setupNeedsAttention(s)) SecondaryButton(stringResource(R.string.play_needs_you), compact = true,
modifier = Modifier.testTag("play-needs-you")) { SetupTabs.openSection = SettingsSection.OVERVIEW }
else if (s.integration.suggested && signedIn && !com.droiddeck.launcher.core.PhantomProcessLimit.blocksSteam(s.phantomProcessStatus))
IntegrationSuggestion(s.integration, { a.onSteamIntegration(null) }, a.onDismissIntegration)
}
@@ -39,6 +39,7 @@ import androidx.compose.foundation.relocation.bringIntoViewRequester
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Extension
import androidx.compose.material.icons.outlined.Folder
import androidx.compose.material.icons.outlined.Layers
@@ -907,19 +908,31 @@ private fun SelectBox(on: Boolean, enabled: Boolean, onToggle: () -> Unit) {
@Composable
private fun ConfirmDialog(title: String, body: String, confirm: String, danger: Boolean = true, onConfirm: () -> Unit, onDismiss: () -> Unit) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
AlertDialog(
onDismissRequest = onDismiss,
title = { Text(title) },
text = { Text(body, fontSize = 14.sp) },
confirmButton = { FocusText(confirm, if (danger) colors.error else pal.signal) { onDismiss(); onConfirm() } },
dismissButton = {
val cancel = remember { FocusRequester() }
LaunchedEffect(Unit) { runCatching { cancel.requestFocus() } }
FocusText(stringResource(R.string.common_cancel), colors.onBackground, modifier = Modifier.focusRequester(cancel), onClick = onDismiss)
},
)
val accent = if (danger) MaterialTheme.colorScheme.error else LocalPalette.current.signal
val cancel = stringResource(R.string.common_cancel)
val glide = LocalFocusGlide.current
val view = androidx.compose.ui.platform.LocalView.current
val confirmNow = androidx.compose.runtime.rememberUpdatedState(onConfirm)
val dismissNow = androidx.compose.runtime.rememberUpdatedState(onDismiss)
androidx.compose.runtime.DisposableEffect(Unit) {
val at = focusAnchor(glide, androidx.compose.ui.geometry.Offset.Zero)
?: androidx.compose.ui.geometry.Rect(androidx.compose.ui.geometry.Offset(view.rootView.width / 2f, view.rootView.height / 2f), 1f)
var confirmed = false
val ask = StepAsk(
anchor = at, side = StepSide.Left, accent = accent, items = 3, pillCorner = 12.dp, maxWidth = 360.dp,
onDismiss = { dismissNow.value(); if (confirmed) confirmNow.value() },
handle = { Icon(if (danger) Icons.Outlined.Delete else Icons.Filled.Check, null, tint = accent, modifier = Modifier.size(18.dp)) },
) {
StepTitle(title)
Text(body, fontSize = 13.sp, lineHeight = 18.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.stepItem(1).padding(start = 4.dp, bottom = 12.dp))
Row(horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End), modifier = Modifier.fillMaxWidth().stepItem(2)) {
StepChoice(cancel, enabled = open, modifier = Modifier.focusRequester(first)) { Steps.fold() }
StepChoice(confirm, danger = danger, enabled = open) { confirmed = true; Steps.fold() }
}
}
Steps.ask(ask)
onDispose { if (Steps.step === ask) Steps.drop() }
}
}
private class DataTarget(val key: String, val label: String, val prefixes: List<Pair<java.io.File, Long>>, val shaders: List<Pair<java.io.File, Long>>)
@@ -535,7 +535,6 @@ internal fun storesSettingsStep(at: Rect, s: androidx.compose.runtime.State<Fron
}
}
}
Column(Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 11.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { DownloadControls(st, a) }
var gogAchievements by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(com.droiddeck.launcher.stores.gog.GogComet.enabled(context)) }
androidx.compose.runtime.LaunchedEffect(Unit) {
if (gogAchievements) com.droiddeck.launcher.core.AddonPack.COMET.ensure(context)
@@ -548,3 +547,12 @@ internal fun storesSettingsStep(at: Rect, s: androidx.compose.runtime.State<Fron
}
}
}
internal fun downloadsSettingsStep(at: Rect, s: androidx.compose.runtime.State<FrontEndState>, a: FrontEndActions, accent: androidx.compose.ui.graphics.Color): StepAsk =
StepAsk(
anchor = at, side = StepSide.Left, accent = accent, items = 2, maxWidth = 440.dp,
handle = { androidx.compose.material3.Icon(androidx.compose.material.icons.Icons.Filled.Settings, null, tint = accent, modifier = Modifier.size(20.dp)) },
) {
StepTitle(stringResource(R.string.downloads_settings))
Column(Modifier.stepItem(1).fillMaxWidth().focusRequester(first).focusGroup().padding(horizontal = 14.dp, vertical = 11.dp)) { DownloadControls(s.value, a) }
}
@@ -1,5 +1,8 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Box
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInRoot
import android.os.SystemClock
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.EnterTransition
@@ -67,6 +70,13 @@ internal object StoresMotion {
var downloadsChip by mutableStateOf<Rect?>(null)
private var touch: Offset? = null
private var touchAt = 0L
fun touched(at: Offset) { touch = at; touchAt = SystemClock.uptimeMillis() }
fun recentTouch(): Offset? = touch.takeIf { SystemClock.uptimeMillis() - touchAt < 4_000 }
var landed by mutableIntStateOf(0)
val flights = mutableStateListOf<Flight>()
@@ -87,6 +97,16 @@ internal object StoresMotion {
stepOpen = true
}
private var host: Any? = null
fun hosting(page: Any) { host = page }
fun release(page: Any) {
if (host !== page) return
host = null
drop()
}
fun drop() {
step?.let { step = null; it.onDismiss() }
stepOpen = false
@@ -301,3 +321,28 @@ internal fun <T> AnimatedRows(
}
}
}
@Composable
internal fun DownloadFlights() {
val glide = LocalFocusGlide.current
var origin by remember { mutableStateOf(Offset.Zero) }
val active = com.droiddeck.launcher.stores.StoresState.downloads.filter { it.isActive }.map { it.key }.toSet()
val seen = remember { mutableSetOf<String>().also { it.addAll(active) } }
LaunchedEffect(active) {
val fresh = active - seen
seen.clear(); seen.addAll(active)
if (fresh.isEmpty()) return@LaunchedEffect
val from = StoresMotion.takeInstall() ?: focusAnchor(glide, origin)
if (from != null) StoresMotion.fly(from) else StoresMotion.landed++
}
Box(Modifier.fillMaxSize().onGloballyPositioned { origin = it.positionInRoot() }) { FlightLayer(origin) }
}
internal fun focusAnchor(glide: FocusGlide?, origin: Offset): Rect? {
val ring = glide?.let { g ->
val src = g.current ?: return@let null
val host = g.host?.takeIf { it.isAttached } ?: return@let null
g.boundsOf(src)?.translate(host.positionInRoot())
}
return ring ?: StoresMotion.recentTouch()?.let { Rect(it + origin - Offset(24f, 24f), androidx.compose.ui.geometry.Size(48f, 48f)) }
}
@@ -143,7 +143,6 @@ import com.droiddeck.launcher.stores.formatBytes
import androidx.compose.runtime.setValue
private const val DOWNLOADS = "downloads"
private data class PaneKey(val chip: String, val signedIn: Boolean, val accountsLoaded: Boolean)
@@ -196,10 +195,9 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
var query by rememberSaveable { mutableStateOf("") }
var openGame by rememberSaveable { mutableStateOf<String?>(null) }
val liveState = androidx.compose.runtime.rememberUpdatedState(s)
LaunchedEffect(StoresState.openDownloads) { if (StoresState.openDownloads) { chip = DOWNLOADS; StoresState.openDownloads = false } }
val store = Store.byId(chip)
LaunchedEffect(tabs.toList()) {
if (chip != DOWNLOADS && Store.byId(chip) !in shownStores) chip = shownStores.firstOrNull()?.id ?: DOWNLOADS
if (Store.byId(chip) !in shownStores) chip = shownStores.firstOrNull()?.id ?: chip
}
val pane = PaneKey(
chip,
@@ -333,9 +331,8 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
StoreTheme(Store.byId(focusedChip ?: chip)) {
Rise(0) {
StoreChips(
chip, focusedChip, s.storeDownloadsActive, tabs, arranging,
chip, focusedChip, tabs, arranging,
onStore = { st -> openModes(st) },
onDownloads = { if (chip != DOWNLOADS) pickChip(DOWNLOADS) else move("first") },
onFocusChip = { focusedChip = it },
onArrangeDone = { arranging = false },
onMoveTab = { st, to -> moveTab(st, to) },
@@ -378,7 +375,6 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
.focusGroup(),
) {
when {
k.chip == DOWNLOADS -> Column(Modifier.fillMaxWidth().verticalScroll(scroll).padding(top = 4.dp, bottom = 16.dp)) { StoresDownloadsPane(s, a) }
st == null -> {}
!k.accountsLoaded -> Box(Modifier.fillMaxWidth().padding(top = 16.dp)) {
androidx.compose.material3.LinearProgressIndicator(Modifier.fillMaxWidth().height(3.dp))
@@ -393,7 +389,6 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
},
) { key -> GameDetail(key, s, a, heroFocus, backLabel, hopRail = null, onBack = { closeGame() }, inStore = true) }
}
FlightLayer(hostAt)
StoresMotion.step?.let { ask ->
key(ask) {
StepOut(
@@ -405,14 +400,7 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
}
SignInFloodLayer(hostAt)
}
androidx.compose.runtime.DisposableEffect(Unit) { onDispose { StoresMotion.drop() } }
val activeKeys = StoresState.downloads.filter { it.isActive }.map { it.key }.toSet()
val seenActive = remember { mutableSetOf<String>().also { it.addAll(activeKeys) } }
LaunchedEffect(activeKeys) {
val fresh = activeKeys - seenActive
seenActive.clear(); seenActive.addAll(activeKeys)
if (fresh.isNotEmpty()) StoresMotion.takeInstall()?.let { StoresMotion.fly(it) }
}
androidx.compose.runtime.DisposableEffect(Unit) { val page = Any(); StoresMotion.hosting(page); onDispose { StoresMotion.release(page) } }
}
@Composable
@@ -594,12 +582,12 @@ private fun RowScope.ArrangeStoreChip(
@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)
@Composable
private fun StoreChips(
selected: String, focused: String?, active: Int, tabs: List<StoreTab>, arranging: Boolean,
onStore: (Store) -> Unit, onDownloads: () -> Unit, onSettings: (Rect?) -> Unit, onFocusChip: (String?) -> Unit,
selected: String, focused: String?, tabs: List<StoreTab>, arranging: Boolean,
onStore: (Store) -> Unit, onSettings: (Rect?) -> Unit, onFocusChip: (String?) -> Unit,
onArrangeDone: () -> Unit, onMoveTab: (Store, Int) -> Unit, onToggleTab: (Store) -> Unit,
) {
val pal = LocalPalette.current
val keys = tabs.filter { it.shown }.map { it.store.id } + DOWNLOADS
val keys = tabs.filter { it.shown }.map { it.store.id }
val bounds = remember { androidx.compose.runtime.mutableStateMapOf<String, Rect>() }
val highlighted = focused ?: selected
val inputMode = androidx.compose.ui.platform.LocalInputModeManager.current.inputMode
@@ -638,25 +626,11 @@ private fun StoreChips(
}
}
}
ChipGlide(keys.indexOf(highlighted), bounds[highlighted], tint, visible = fillShown && highlighted != DOWNLOADS)
ChipGlide(keys.indexOf(highlighted), bounds[highlighted], tint, visible = fillShown)
}
if (arranging) {
IconChip(Icons.Filled.Check, stringResource(R.string.stores_tabs_arrange_done)) { onArrangeDone() }
} else {
Box {
StoreChip(
label = null, on = selected == DOWNLOADS, under = fillShown && highlighted == DOWNLOADS, key = DOWNLOADS, mark = pal.signal,
modifier = Modifier.onGloballyPositioned {
bounds[DOWNLOADS] = it.boundsInParent()
StoresMotion.downloadsChip = it.boundsInRoot()
},
lead = { Icon(Icons.Outlined.Download, null, modifier = Modifier.size(18.dp)) },
trail = if (active > 0) { { CountPill(active) } } else null,
description = stringResource(R.string.stores_tab_downloads),
onFocused = onFocusChip,
) { onDownloads() }
ChipGlide(keys.indexOf(DOWNLOADS), bounds[DOWNLOADS], tint, visible = fillShown && highlighted == DOWNLOADS)
}
var cogAt by remember { mutableStateOf<Rect?>(null) }
Box(Modifier.onGloballyPositioned { cogAt = it.boundsInRoot() }) {
IconChip(Icons.Filled.Settings, stringResource(R.string.stores_settings)) { onSettings(cogAt) }
+38 -3
View File
@@ -702,7 +702,7 @@
<string name="driver_delete_in_use">Its files are removed. It\'s in use, so the default takes over.</string>
<string name="drawer_page_display">Display</string>
<string name="drawer_frame_limit">Frame limit</string>
<string name="drawer_frame_limit_note">Caps this game. The display switches to a refresh rate the cap divides evenly when it has one; other caps can look uneven. Steam games use Steam\'s Frame Limit in the Quick Access menu.</string>
<string name="drawer_frame_limit_note">Remembered for this game, or for Desktop. The display switches to a refresh rate the cap divides evenly; other caps can look uneven.</string>
<string name="drawer_bfi">Black frame insertion</string>
<string name="drawer_bfi_note">Sharper motion: a black refresh follows every frame. Needs 100 Hz or more; the game runs at half the refresh rate and looks dimmer. Off while frame generation is on.</string>
<string name="drawer_page_effects">Effects</string>
@@ -926,7 +926,7 @@
<string name="setup_tab_controller">Controller</string>
<string name="setup_tab_session">Session</string>
<string name="setup_tab_launcher">Launcher</string>
<string name="setup_title">Setup</string>
<string name="setup_title">Settings</string>
<string name="setup_all_set">● All set</string>
<string name="setup_n_ready">%1$d of %2$d ready</string>
<string name="setup_system_check">System check</string>
@@ -1676,7 +1676,7 @@
<string name="rail_store">Store</string>
<string name="rail_components">Components</string>
<string name="rail_apps">Apps</string>
<string name="rail_setup">Setup</string>
<string name="rail_setup">Settings</string>
<string name="rail_updates">Updates</string>
<string name="rail_more">More</string>
<string name="more_edit_tabs">Edit tabs</string>
@@ -4219,4 +4219,39 @@
<string name="hud_readings_count">%1$d of %2$d</string>
<string name="exit_hint_back">Press back once more to exit</string>
<string name="display_scaling_integer">Integer</string>
<string name="setup_tab_performance">Performance</string>
<string name="setup_group_background_apps">Android memory</string>
<string name="settings_search">Search settings</string>
<string name="settings_search_none">No setting matches \"%1$s\"</string>
<string name="settings_search_clear">Clear search</string>
<string name="settings_place_settings">Settings</string>
<string name="settings_place_drawer">In-game menu</string>
<string name="settings_place_sheet">Steam or Desktop options (swipe up)</string>
<string name="settings_place_steam_qam">Steam quick menu (•••)</string>
<string name="dev_group_logs">Logs</string>
<string name="settings_place_tab">Tabs</string>
<string name="rail_storage">Storage</string>
<string name="rail_sync">Syncthing</string>
<string name="downloads_settings">Download settings</string>
<string name="dev_tools_title">Developer tools</string>
<string name="dev_tools_hint">Agent, graphics logs and other tools for testing DroidDeck</string>
<string name="sheet_lip">Options</string>
<string name="sheet_scope_steam">Steam defaults · used each time Steam starts</string>
<string name="sheet_scope_desktop">Desktop defaults · used each time Desktop starts</string>
<string name="sheet_scope_other">Defaults · used each time this mode starts</string>
<string name="sheet_all_settings">All settings</string>
<string name="sheet_all_settings_hint">Applies to every mode</string>
<string name="drawer_frame_limit_steam">Set in Steam</string>
<string name="drawer_frame_limit_steam_hint">Steam games use the Frame Limit in Steam\'s quick menu › Performance</string>
<string name="drawer_open_steam_qam">Open</string>
<string name="report_problem">Report a problem</string>
<string name="report_problem_hint">Shares this session\'s logs for a bug report</string>
<string name="drawer_hint_steam">Back opens this menu · Back twice opens Steam\'s menu</string>
<string name="drawer_hint">Back opens this menu</string>
<string name="drawer_hint_button">%1$s opens this menu</string>
<string name="drawer_hint_steam_inverted">Back twice opens this menu · Back once opens Steam\'s menu</string>
<string name="drawer_corner_tap">Corner tap opens this menu</string>
<string name="drawer_corner_tap_hint">Double-tap the top-right corner, for devices without a Back button</string>
<string name="drawer_handle">Open the session menu</string>
<string name="play_needs_you">Settings need you</string>
</resources>
@@ -85,4 +85,23 @@ class SessionScalingPrefsTest {
SessionPrefs.setUpscaler(context, 1)
assertEquals(0, prefs.getInt("upscaler", -1))
}
private fun fpsContext(): Context = RuntimeEnvironment.getApplication().also {
it.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit()
}
@Test fun aFrameLimitStaysWithTheGameOrDesktopItWasSetIn() {
val ctx = fpsContext()
val game = SessionPrefs.fpsLimitKey(SessionService.MODE_RUN, "123")
val desktop = SessionPrefs.fpsLimitKey(SessionService.MODE_DESKTOP, null)
SessionPrefs.saveFpsLimit(ctx, game, 45)
SessionPrefs.saveFpsLimit(ctx, desktop, 30)
assertEquals(45, SessionPrefs.savedFpsLimit(ctx, game))
assertEquals(30, SessionPrefs.savedFpsLimit(ctx, desktop))
assertEquals(0, SessionPrefs.savedFpsLimit(ctx, SessionPrefs.fpsLimitKey(SessionService.MODE_RUN, "456")))
assertEquals(null, SessionPrefs.fpsLimitKey(SessionService.MODE_STEAM, "123"))
assertEquals(null, SessionPrefs.fpsLimitKey(SessionService.MODE_RUN, "not-a-game"))
SessionPrefs.saveFpsLimit(ctx, game, 0)
assertEquals(0, SessionPrefs.savedFpsLimit(ctx, game))
}
}
@@ -42,4 +42,20 @@ class StoreCacheTest {
val fresh = listOf(a)
assertSame(fresh, mergeItems(null, fresh))
}
@Test fun aSavedStoreLibraryRoundTripsWithItsStoreAndExtras() {
val games = listOf(
CatalogItem(
Store.UBISOFT, "4553", "Far Cry 3 Blood Dragon", "https://img/wide.jpg", tallImageUrl = "https://img/tall.jpg",
logoUrl = "https://img/logo.png", owned = true, sizeBytes = 2_000_000L, extra = mapOf("productId" to "205", "spaceId" to "abc"),
subscription = true, includedWith = "Ubisoft+",
),
CatalogItem(Store.UBISOFT, "1", "No art", null),
)
assertEquals(games, StoreLibraryCache.decode(Store.UBISOFT, StoreLibraryCache.encode(games)))
}
@Test fun aSavedEmptyStoreLibraryStaysEmptyRatherThanUnknown() {
assertEquals(emptyList<CatalogItem>(), StoreLibraryCache.decode(Store.ROCKSTAR, StoreLibraryCache.encode(emptyList())))
}
}
@@ -41,23 +41,23 @@ class NavTabsTest {
}
@Test fun musicStartsInMore() {
assertEquals(listOf("steam", "games", "stores", "desktop", "components", "setup", "updates", NavTabs.MORE), navigationKeys(state()))
assertEquals(listOf("soundtracks"), NavTabs.more(state()))
assertEquals(setOf("soundtracks", "agent"), NavTabs.shelved)
assertEquals(listOf("steam", "games", "stores", "downloads", "desktop", "components", "setup", "updates", NavTabs.MORE), navigationKeys(state()))
assertEquals(listOf("soundtracks", "storage", "sync"), NavTabs.more(state()))
assertEquals(setOf("soundtracks", "agent", "storage", "sync"), NavTabs.shelved)
assertFalse(com.droiddeck.launcher.agent.AgentTab.shown)
}
@Test fun showingMusicOnceKeepsItShownAfterReload() {
place("soundtracks", TabPlace.BAR)
NavTabs.load(ctx)
assertEquals(listOf("steam", "games", "soundtracks", "stores", "desktop", "components", "setup", "updates"), navigationKeys(state()))
assertEquals(listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "components", "setup", "updates", NavTabs.MORE), navigationKeys(state()))
}
@Test fun shelvedTabsLeaveTheBarAndAddMoreAtTheEnd() {
place("stores", TabPlace.MORE)
place("components", TabPlace.MORE)
val s = state()
assertEquals(listOf("components", "soundtracks", "stores"), NavTabs.more(s))
assertEquals(listOf("components", "soundtracks", "stores", "storage", "sync"), NavTabs.more(s))
assertEquals(NavTabs.MORE, navigationKeys(s).last())
assertFalse("stores" in navigationKeys(s))
}
@@ -73,6 +73,7 @@ class NavTabsTest {
@Test fun disabledStoresFeatureReadsAsHidden() {
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(storesOn = false), "stores"))
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(storesOn = false), "downloads"))
}
@Test fun movingSwapsWithTheNextVisibleTabAndPersists() {
@@ -84,25 +85,37 @@ class NavTabsTest {
}
@Test fun tabsMissingFromASavedOrderSlotInAfterTheirDefaultNeighbour() {
assertEquals(listOf("updates", "steam", "games", "soundtracks", "stores", "desktop", "agent", "components", "android-apps", "setup"),
assertEquals(listOf("updates", "steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup"),
NavTabs.arrange(listOf("updates", "steam")))
assertEquals(listOf("games", "soundtracks", "steam", "setup", "stores", "desktop", "agent", "components", "android-apps", "updates"),
assertEquals(listOf("games", "soundtracks", "steam", "setup", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "updates"),
NavTabs.arrange(listOf("games", "steam", "setup", "stores", "desktop", "components", "android-apps", "updates", "bogus")))
}
@Test fun storageAndSyncJoinMoreForUsersWithASavedLayout() {
ctx.getSharedPreferences("session", Context.MODE_PRIVATE).edit()
.putString("navTabOrder", "steam,games,soundtracks,stores,desktop,agent,components,android-apps,setup,updates")
.putString("navTabShelved", "soundtracks").commit()
NavTabs.load(ctx)
assertEquals(listOf("soundtracks", "storage", "sync"), NavTabs.more(state()))
place("sync", TabPlace.BAR)
NavTabs.load(ctx)
assertTrue("sync" in navigationKeys(state()))
}
@Test fun moreCarriesTheDownloadCountAndBadgesOfShelvedTabs() {
place("stores", TabPlace.MORE)
place("downloads", TabPlace.MORE)
place("setup", TabPlace.MORE)
val s = state(downloads = 3, setupReady = false)
assertEquals(3, railCount(s, NavTabs.MORE))
assertTrue(railBadge(s, NavTabs.MORE))
place("stores", TabPlace.BAR)
place("downloads", TabPlace.BAR)
assertEquals(0, railCount(s, NavTabs.MORE))
assertEquals(3, railCount(s, "stores"))
assertEquals(3, railCount(s, "downloads"))
assertEquals(0, railCount(s, "stores"))
}
@Test fun sideRailShowsTheDownloadCountOnMoreWhenStoresIsShelved() {
place("stores", TabPlace.MORE)
@Test fun sideRailShowsTheDownloadCountOnMoreWhenDownloadsIsShelved() {
place("downloads", TabPlace.MORE)
val s = state(downloads = 2)
compose.setContent {
DroidDeckTheme {
@@ -111,13 +124,13 @@ class NavTabsTest {
}
}
}
compose.onNodeWithTag("rail-stores").assertDoesNotExist()
compose.onNodeWithTag("rail-downloads").assertDoesNotExist()
compose.onNode(hasTestTag("rail-more")).assertIsDisplayed()
compose.onNode(hasText("2") and hasParentTag("rail-more"), useUnmergedTree = true).assertIsDisplayed()
}
@Test fun morePageListsShelvedTabsWithTheirCount() {
place("stores", TabPlace.MORE)
place("downloads", TabPlace.MORE)
place("components", TabPlace.MORE)
val s = state(downloads = 4)
compose.setContent {
@@ -127,9 +140,9 @@ class NavTabsTest {
}
}
}
compose.onNodeWithTag("more-stores").assertIsDisplayed()
compose.onNodeWithTag("more-downloads").assertIsDisplayed()
compose.onNodeWithTag("more-components").assertIsDisplayed()
compose.onNode(hasText("4") and hasParentTag("more-stores"), useUnmergedTree = true).assertIsDisplayed()
compose.onNode(hasText("4") and hasParentTag("more-downloads"), useUnmergedTree = true).assertIsDisplayed()
}
@Test fun backFromAShelvedTabReturnsToMore() {
@@ -0,0 +1,69 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.R
import java.io.File
import javax.xml.parsers.DocumentBuilderFactory
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
class SettingsMapTest {
private val strings: Map<String, String> by lazy {
File("src/main/res/values").listFiles { f -> f.extension == "xml" }.orEmpty().flatMap { file ->
val doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file)
val nodes = doc.getElementsByTagName("string")
(0 until nodes.length).map { i ->
val n = nodes.item(i)
n.attributes.getNamedItem("name").nodeValue to n.textContent.replace("\\'", "'").replace("\\\"", "\"")
}
}.toMap()
}
private val names: Map<Int, String> by lazy {
R.string::class.java.fields.associate { it.getInt(null) to it.name }
}
private fun text(id: Int): String = strings.getValue(names.getValue(id))
private fun render(): String = buildString {
appendLine("# Where settings live")
appendLine()
appendLine("Generated from `SettingsIndex.kt` by `SettingsMapTest`. Run `UPDATE_SETTINGS_MAP=1 ./gradlew :app:testDebugUnitTest --tests '*SettingsMapTest*'` after changing the index.")
appendLine()
appendLine("Links of the form `droiddeck://settings/<section>` open a Settings section directly.")
appendLine()
SettingsIndex.entries.groupBy { it.place }.forEach { (place, entries) ->
appendLine("## ${text(place.title)}")
appendLine()
appendLine("| Setting | Where | Also matches |")
appendLine("| --- | --- | --- |")
entries.forEach { e ->
val where = listOfNotNull(text(place.title), e.within?.let(::text)).joinToString(" › ") +
(e.section?.let { " (`droiddeck://settings/${it.key}`)" } ?: "")
appendLine("| ${text(e.title)} | $where | ${e.words.joinToString(", ")} |")
}
appendLine()
}
}
@Test
fun everyIndexedStringExists() {
SettingsIndex.entries.forEach { e ->
listOfNotNull(e.title, e.within).forEach { id -> assertTrue("missing string $id", names[id] in strings) }
}
SettingsSection.entries.forEach { assertTrue(names[it.title] in strings) }
}
@Test
fun docsMatchIndex() {
val doc = File("../docs/settings-map.md")
val now = render()
if (System.getenv("UPDATE_SETTINGS_MAP") == "1") doc.writeText(now)
assertEquals("docs/settings-map.md is stale; regenerate it", now, doc.readText().replace("\r\n", "\n"))
}
@Test
fun sectionKeysRoundTrip() {
SettingsSection.entries.forEach { assertEquals(it, SettingsSection.of(it.key)) }
}
}
+106
View File
@@ -0,0 +1,106 @@
# Where settings live
Generated from `SettingsIndex.kt` by `SettingsMapTest`. Run `UPDATE_SETTINGS_MAP=1 ./gradlew :app:testDebugUnitTest --tests '*SettingsMapTest*'` after changing the index.
Links of the form `droiddeck://settings/<section>` open a Settings section directly.
## Settings
| Setting | Where | Also matches |
| --- | --- | --- |
| Linux runtime | Settings › Overview (`droiddeck://settings/overview`) | ubuntu, linux, repair, update |
| Child-process limit | Settings › Overview (`droiddeck://settings/overview`) | phantom, process, killed, background |
| Steam account | Settings › Overview (`droiddeck://settings/overview`) | steam, login, sign in |
| Override Steam's core choice | Settings › Performance (`droiddeck://settings/performance`) | steam client cores, cpu |
| Game cores | Settings › Performance (`droiddeck://settings/performance`) | cpu, pin, cores, affinity |
| Save power on steady games | Settings › Performance (`droiddeck://settings/performance`) | cpu |
| Threaded GL | Settings › Performance (`droiddeck://settings/performance`) | opengl, gl |
| Zink: lazy descriptors | Settings › Performance (`droiddeck://settings/performance`) | |
| Skip GL error checks | Settings › Performance (`droiddeck://settings/performance`) | |
| gamescope: realtime GPU queue | Settings › Performance (`droiddeck://settings/performance`) | gamescope |
| Hold the GPU at its top clock | Settings › Performance (`droiddeck://settings/performance`) | gpu, clock, max |
| RAM cap | Settings › Performance (`droiddeck://settings/performance`) | ram, memory |
| VRAM cap | Settings › Performance (`droiddeck://settings/performance`) | vram, memory |
| Compress idle game memory | Settings › Performance (`droiddeck://settings/performance`) | zram, swap, memory |
| Compress Steam while a game runs | Settings › Performance (`droiddeck://settings/performance`) | zram, swap, memory |
| Clear cached apps before a session | Settings › Performance (`droiddeck://settings/performance`) | memory, ram, crash, sleep, killed |
| Background apps during a session | Settings › Performance (`droiddeck://settings/performance`) | memory, ram, background apps |
| Memory readout | Settings › Performance (`droiddeck://settings/performance`) | memory, ram, overlay |
| Turnip: sysmem rendering | Settings › Performance (`droiddeck://settings/performance`) | |
| Skip Steam's xalia helper | Settings › Performance (`droiddeck://settings/performance`) | |
| droiddeck-esync | Settings › Performance (`droiddeck://settings/performance`) | esync, sync, wine |
| droiddeck-fsync first | Settings › Performance (`droiddeck://settings/performance`) | fsync, sync, wine |
| droiddeck-ntsync | Settings › Performance (`droiddeck://settings/performance`) | ntsync, sync, wine |
| Run proot without seccomp | Settings › Performance (`droiddeck://settings/performance`) | proot |
| proot fast path | Settings › Performance (`droiddeck://settings/performance`) | proot |
| Run without proot (experimental) | Settings › Performance (`droiddeck://settings/performance`) | proot |
| Draw the cursor inside gamescope | Settings › Performance (`droiddeck://settings/performance`) | mouse, cursor |
| Host name | Settings › Performance (`droiddeck://settings/performance`) | name |
| Controller | Settings › Controller (`droiddeck://settings/controller`) | gamepad, buttons, mapping, profile, remap |
| Smart glasses | Settings › Smart glasses (`droiddeck://settings/glasses`) | xreal, viture, vr, ar |
| Theme | Settings › Launcher (`droiddeck://settings/launcher`) | color, dark |
| App scale | Settings › Launcher (`droiddeck://settings/launcher`) | size, zoom |
| App icon | Settings › Launcher (`droiddeck://settings/launcher`) | |
| Animations | Settings › Launcher (`droiddeck://settings/launcher`) | |
| Sidebar labels | Settings › Launcher (`droiddeck://settings/launcher`) | sidebar |
| Language | Settings › Launcher (`droiddeck://settings/launcher`) | translate |
| Use as Home screen | Settings › Launcher (`droiddeck://settings/launcher`) | home screen, launcher |
| Launcher orientation | Settings › Launcher (`droiddeck://settings/launcher`) | rotate, portrait |
| Session orientation | Settings › Launcher (`droiddeck://settings/launcher`) | rotate, portrait |
| Fullscreen | Settings › Launcher (`droiddeck://settings/launcher`) | |
| Dual screen launcher | Settings › Launcher (`droiddeck://settings/launcher`) | thor, second screen, bottom screen |
| Warn when storage is low | Settings › Launcher (`droiddeck://settings/launcher`) | |
| SteamGridDB API key | Settings › Launcher (`droiddeck://settings/launcher`) | artwork, steamgriddb |
| Source | Settings › Launcher (`droiddeck://settings/launcher`) | mirror, china |
| HTTP proxy | Settings › Launcher (`droiddeck://settings/launcher`) | |
| Latest session logs | Settings › Developer (`droiddeck://settings/developer`) | logs, log, bug, report, crash, zip |
| Session logs | Settings › Developer (`droiddeck://settings/developer`) | logs |
| Game debug logs | Settings › Developer (`droiddeck://settings/developer`) | logs, wine, proton |
| Enhanced diagnostics for next session | Settings › Developer (`droiddeck://settings/developer`) | logs |
| Reset all settings | Settings › Developer (`droiddeck://settings/developer`) | default |
| Developer tools | Settings › Developer (`droiddeck://settings/developer`) | agent, ai, claude, codex |
| Detailed graphics logs | Settings › Developer (`droiddeck://settings/developer`) | logs, gpu |
## Tabs
| Setting | Where | Also matches |
| --- | --- | --- |
| Storage | Tabs › Storage | sd card, space, uninstall, disk |
| Syncthing | Tabs › Syncthing | syncthing, saves |
| Download speed tier | Tabs › Downloads | download, speed, bandwidth, slow |
| Downloads at a time | Tabs › Downloads | download, parallel, queue, at once |
| Tabs | Tabs › More | tabs, hide, reorder, agent, stores, edit tabs |
## In-game menu
| Setting | Where | Also matches |
| --- | --- | --- |
| Frame limit | In-game menu › Display | fps, cap, limit, non-steam, desktop |
| Frame generation | In-game menu › Display | lsfg, lossless, fps |
| Scaling filter | In-game menu › Display | upscale, fsr, sharpness |
| Performance HUD | In-game menu › Performance HUD | fps, counter, overlay, performance |
| Touchscreen | In-game menu › Controller | touch, mouse, direct, touchpad, click |
| On-screen controls | In-game menu › Controller | on-screen, controls, touch controls, buttons |
| Steam touch layout | In-game menu › Controller | touch layout, edit layout, on-screen |
| PC keyboard | In-game menu › Controller | keyboard, typing |
| Report a problem | In-game menu › Session | logs, log, bug, crash, share, zip |
| Background behavior | In-game menu › Session | sleep, background, native, resume |
## Steam quick menu (•••)
| Setting | Where | Also matches |
| --- | --- | --- |
| Frame limit | Steam quick menu (•••) › Performance | fps, cap, limit, steam games |
| Performance | Steam quick menu (•••) | performance overlay, fps, counter, tdp |
## Steam or Desktop options (swipe up)
| Setting | Where | Also matches |
| --- | --- | --- |
| Session display | Steam or Desktop options (swipe up) › Display | resolution, scaling, hdr, refresh |
| Graphics drivers | Steam or Desktop options (swipe up) › Display | turnip, driver, gpu, adreno, mali |
| Offline mode | Steam or Desktop options (swipe up) › Steam | offline, steam |
| Microphone | Steam or Desktop options (swipe up) › Audio | microphone, voice |
| Background behavior | Steam or Desktop options (swipe up) › Session | sleep, background |
| Library | Steam or Desktop options (swipe up) › Library | second library, sd card, steam library |