Expose Back actions in app settings

This commit is contained in:
xXJsonDeruloXx committed 2026-09-23 17:26:27 -04:00
1 parent 7fa71dc5c5
commit c013252a59
4 files changed
+19 -4

No files matched your search

@@ -211,6 +211,7 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
theme = SessionPrefs.theme(this) theme = SessionPrefs.theme(this)
backActionsInverted = SessionPrefs.backActionsInverted(this)
setContent { setContent {
SteamDeckTheme(theme) { SteamDeckTheme(theme) {
val sm = settingsMode val sm = settingsMode
@@ -241,6 +242,7 @@ class MainActivity : ComponentActivity() {
packageStage = pkgStage, packageStage = pkgStage,
packagePercent = pkgPercent, packagePercent = pkgPercent,
sessionRunning = SessionState.running, sessionRunning = SessionState.running,
backActionsInverted = backActionsInverted,
), ),
FrontEndActions( FrontEndActions(
onPlay = { startSession(Intent(this, SessionActivity::class.java)) }, onPlay = { startSession(Intent(this, SessionActivity::class.java)) },
@@ -301,6 +303,10 @@ class MainActivity : ComponentActivity() {
onTheme = { id -> SessionPrefs.setTheme(this, id); theme = id }, onTheme = { id -> SessionPrefs.setTheme(this, id); theme = id },
onHomeApp = { manageHomeApp() }, onHomeApp = { manageHomeApp() },
onAndroidApp = { app -> launchAndroidApp(app) }, onAndroidApp = { app -> launchAndroidApp(app) },
onBackActionsInverted = { inverted ->
SessionPrefs.setBackActionsInverted(this, inverted)
backActionsInverted = inverted
},
), ),
page = page, page = page,
) )
@@ -284,7 +284,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
performBackAction(double = false) performBackAction(double = false)
} }
pendingBackAction = pending pendingBackAction = pending
uiHandler.postDelayed(pending, android.view.ViewConfiguration.getDoubleTapTimeout().toLong()) uiHandler.postDelayed(pending, BACK_DOUBLE_PRESS_TIMEOUT_MS)
} }
private fun performBackAction(double: Boolean) { private fun performBackAction(double: Boolean) {
@@ -1005,6 +1005,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
companion object { companion object {
private const val TAG = "SessionActivity" private const val TAG = "SessionActivity"
private const val BACK_DOUBLE_PRESS_TIMEOUT_MS = 500L
/** Compositor scale modes (Container.FULLSCREEN_* values): 1 = fit with bars, centred. */ /** Compositor scale modes (Container.FULLSCREEN_* values): 1 = fit with bars, centred. */
private const val SCALE_FIT = 1 private const val SCALE_FIT = 1
private const val ALIGN_CENTER = 0 private const val ALIGN_CENTER = 0
@@ -141,6 +141,7 @@ class FrontEndState(
val packageStage: String? = null, val packageStage: String? = null,
val packagePercent: Int = -1, val packagePercent: Int = -1,
val sessionRunning: Boolean = false, val sessionRunning: Boolean = false,
val backActionsInverted: Boolean = false,
) )
class FrontEndActions( class FrontEndActions(
@@ -169,6 +170,7 @@ class FrontEndActions(
val onTheme: (String) -> Unit = {}, val onTheme: (String) -> Unit = {},
val onHomeApp: () -> Unit = {}, val onHomeApp: () -> Unit = {},
val onAndroidApp: (com.steamdeck.launcher.HomeApp.LaunchableApp) -> Unit = {}, val onAndroidApp: (com.steamdeck.launcher.HomeApp.LaunchableApp) -> Unit = {},
val onBackActionsInverted: (Boolean) -> Unit = {},
) )
@@ -692,6 +694,12 @@ private fun SetupPanel(s: FrontEndState, a: FrontEndActions) {
ActionRow("ROMs folder", s.romsDir ?: "Choose where emulator games are stored", "Choose", a.onRoms) ActionRow("ROMs folder", s.romsDir ?: "Choose where emulator games are stored", "Choose", a.onRoms)
} }
SettingsGroup("Session") { SettingsGroup("Session") {
ToggleRow(
host, "back-actions", "Invert Back actions",
if (s.backActionsInverted) "Back once opens Steam QAM; twice opens the in-session menu."
else "Back once opens the in-session menu; twice opens Steam QAM.",
s.backActionsInverted, onChange = a.onBackActionsInverted,
)
SettingsRow("Frame generation", "Select the frame generation mode") { SettingsRow("Frame generation", "Select the frame generation mode") {
Box { Box {
ValueChip(s.frameGenLabel, host.open == "fg") { host.open = if (host.open == "fg") null else "fg" } ValueChip(s.frameGenLabel, host.open == "fg") { host.open = if (host.open == "fg") null else "fg" }
+3 -3
View File
@@ -188,9 +188,9 @@ State: **main = `90c7574`** (PR #14 merge), main build run 35895701784. No tag,
- Thor Pro: trackpad tap; the 1–2 min in-game crash once a `crash.log` arrives. - Thor Pro: trackpad tap; the 1–2 min in-game crash once a `crash.log` arrives.
- Xfce as a second desktop shell (Max's branch runs XFCE 4.20 on labwc) - a catalog package + a - Xfce as a second desktop shell (Max's branch runs XFCE 4.20 on labwc) - a catalog package + a
shell choice in the Desktop cog; comfort, not performance. shell choice in the Desktop cog; comfort, not performance.
- Quick Access Menu for non-Deck pads - Back double-press now routes to the existing Guide+A chord; - Quick Access Menu for non-Deck pads - Back double-press (500 ms) now routes to the existing Guide+A
the in-session and Steam settings can swap the single- and double-Back actions. Device confirmation chord; the in-session menu, Steam settings, and Setup › Session can swap the single- and double-Back
is still needed. actions. Device confirmation is still needed.
- FlatOut shrink: try `vk_wsi_force_swapchain_to_current_extent=false` via `steamdeck-env`. - FlatOut shrink: try `vk_wsi_force_swapchain_to_current_extent=false` via `steamdeck-env`.
- Max's stricter `winnative-directaudio` guards; `winnative-epic-launch` (a feature). - Max's stricter `winnative-directaudio` guards; `winnative-epic-launch` (a feature).
- Rename before anything truly public: "SteamDeck" is Valve's mark. - Rename before anything truly public: "SteamDeck" is Valve's mark.