From 3fa05f6c180fe5b1b11721de5c9afc85d8eee8f6 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 17:16:02 -0400 Subject: [PATCH 1/5] Add Back shortcuts for session menu and Steam QAM --- .../com/steamdeck/launcher/MainActivity.kt | 7 +++ .../com/steamdeck/launcher/SessionActivity.kt | 48 +++++++++++++++---- .../launcher/session/SessionPrefs.kt | 7 +++ .../launcher/ui/ModeSettingsDialog.kt | 9 ++++ .../steamdeck/launcher/ui/SessionOverlay.kt | 8 ++++ docs/progress-log.md | 4 +- 6 files changed, 74 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt index 1fc000a148..01db50bd76 100644 --- a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt @@ -169,6 +169,7 @@ class MainActivity : ComponentActivity() { private var touchMode by mutableStateOf(SessionPrefs.TOUCH_AUTO) private var suspendPolicy by mutableStateOf(SessionPrefs.SUSPEND_MANUAL) private var oscMode by mutableStateOf(SessionPrefs.OSC_AUTO) + private var backActionsInverted by mutableStateOf(false) private var renderer by mutableStateOf("pixman") private var gameStorage by mutableStateOf("") private var storageOptions by mutableStateOf>>(emptyList()) @@ -515,6 +516,7 @@ class MainActivity : ComponentActivity() { touchMode = touchMode, suspendPolicy = suspendPolicy, oscMode = if (mode == SessionService.MODE_STEAM) oscMode else null, + backActionsInverted = backActionsInverted, directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null, clientDirectAudio = clientDirectAudio, mic = if (mode == SessionService.MODE_STEAM) mic else null, @@ -546,6 +548,10 @@ class MainActivity : ComponentActivity() { onTouch = { t -> SessionPrefs.setTouchMode(this, t); touchMode = t }, onSuspendPolicy = { policy -> SessionPrefs.setSuspendPolicy(this, mode, policy); suspendPolicy = policy }, onOsc = { o -> SessionPrefs.setOscMode(this, o); oscMode = o }, + onBackActionsInverted = { inverted -> + SessionPrefs.setBackActionsInverted(this, inverted) + backActionsInverted = inverted + }, onDirectAudio = { on -> SessionPrefs.setDirectAudio(this, on); directAudio = on }, onClientDirectAudio = { on -> SessionPrefs.setClientDirectAudio(this, on); clientDirectAudio = on }, onMic = { on -> @@ -641,6 +647,7 @@ class MainActivity : ComponentActivity() { touchMode = SessionPrefs.touchMode(this) suspendPolicy = SessionPrefs.suspendPolicy(this, mode) oscMode = SessionPrefs.oscMode(this) + backActionsInverted = SessionPrefs.backActionsInverted(this) directAudio = SessionPrefs.directAudio(this) clientDirectAudio = SessionPrefs.clientDirectAudio(this) mic = SessionPrefs.micEnabled(this) diff --git a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt index 72cc3e36fc..608f3652f3 100644 --- a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt @@ -85,9 +85,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private var cursorVisible by mutableStateOf(false) private val cursorHide = Runnable { cursorVisible = false } private val uiHandler = Handler(Looper.getMainLooper()) + private var pendingBackAction: Runnable? = null // Compose reads these; the activity writes them. private var drawerOpen by mutableStateOf(false) + private var backActionsInverted by mutableStateOf(false) private var hudOn by mutableStateOf(true) private var frameGenLabel by mutableStateOf("Off") private var frameGenEngine by mutableStateOf(FrameGen.ENGINE_OFF) @@ -200,10 +202,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { }, onKeyboard = { drawerOpen = false; keyboard?.toggle() }, onSteamMenu = if (SessionState.mode == SessionService.MODE_STEAM) ({ sendSteamGuide() }) else null, - onQam = if (SessionState.mode == SessionService.MODE_STEAM) ({ - drawerOpen = false - padBridge?.triggerQam() - }) else null, + onQam = if (SessionState.mode == SessionService.MODE_STEAM) ({ triggerSteamQam() }) else null, + backActionsInverted = backActionsInverted, + onBackActionsInverted = { inverted -> + SessionPrefs.setBackActionsInverted(this@SessionActivity, inverted) + backActionsInverted = inverted + }, onOsc = { v -> SessionPrefs.setOscMode(this@SessionActivity, v); readPrefs(); updateOnScreenControls() }, onTouch = { v -> SessionPrefs.setTouchMode(this@SessionActivity, v); readPrefs() }, onShape = { v -> SessionPrefs.setShapeMode(this@SessionActivity, v); readPrefs() }, @@ -240,12 +244,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { } } SessionState.endListener = endListener - // Back opens the drawer (and closes it again). Leaving the session running in the - // background and ending it are both actions in there, so neither can happen by accident - // from a button a game might also be reading. + // A single Back opens the session menu; two quick presses/swipes send the Steam QAM chord. + // The single action waits out the double-press window so the two actions stay distinct. onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { - drawerOpen = !drawerOpen + routeBackAction() } }) watchSession() @@ -264,6 +267,32 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { }, 90) } + private fun triggerSteamQam() { + drawerOpen = false + padBridge?.triggerQam() + } + + private fun routeBackAction() { + pendingBackAction?.let { pending -> + uiHandler.removeCallbacks(pending) + pendingBackAction = null + performBackAction(double = true) + return + } + val pending = Runnable { + pendingBackAction = null + performBackAction(double = false) + } + pendingBackAction = pending + uiHandler.postDelayed(pending, android.view.ViewConfiguration.getDoubleTapTimeout().toLong()) + } + + private fun performBackAction(double: Boolean) { + val isSteam = SessionState.mode == SessionService.MODE_STEAM + val opensQam = isSteam && (double xor backActionsInverted) + if (opensQam) triggerSteamQam() else drawerOpen = !drawerOpen + } + private fun handleHomeGuideIntent(incoming: Intent?) { if (incoming?.action != SessionService.ACTION_HOME_GUIDE) return incoming.action = null @@ -280,6 +309,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { fexPreset = SessionPrefs.fexPreset(this) oscMode = SessionPrefs.oscMode(this) shapeMode = SessionPrefs.shapeMode(this) + backActionsInverted = SessionPrefs.backActionsInverted(this) } // ── Compositor ────────────────────────────────────────────────────────────────────────── @@ -957,6 +987,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { // Deliberately does NOT end the session: this activity can be destroyed while the user is // in another app, and the whole point of the service is that Steam survives that. watching = false + pendingBackAction?.let(uiHandler::removeCallbacks) + pendingBackAction = null closeSecondScreen(reset = true) if (::hud.isInitialized) hud.stop() padBridge?.stop() diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt index 17a399e93d..4b4637c847 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt @@ -21,6 +21,13 @@ object SessionPrefs { prefs(context).edit().putBoolean("hud", on).apply() } + /** When enabled, a single Back opens Steam QAM and a double Back opens the session menu. */ + fun backActionsInverted(context: Context): Boolean = prefs(context).getBoolean("backActionsInverted", false) + + fun setBackActionsInverted(context: Context, inverted: Boolean) { + prefs(context).edit().putBoolean("backActionsInverted", inverted).apply() + } + const val TOUCH_AUTO = "auto" const val TOUCH_PAD = "touchpad" const val TOUCH_DIRECT = "direct" diff --git a/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt b/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt index c2f2bccbb9..0956068777 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt @@ -46,6 +46,8 @@ class ModeSettings( val suspendPolicy: String, /** Steam only. */ val oscMode: String?, + /** Steam only: whether single and double Back actions are swapped. */ + val backActionsInverted: Boolean = false, val directAudio: Boolean?, val clientDirectAudio: Boolean = false, val mic: Boolean?, @@ -91,6 +93,7 @@ class ModeSettingsActions( val onTouch: (String) -> Unit, val onSuspendPolicy: (String) -> Unit, val onOsc: (String) -> Unit, + val onBackActionsInverted: (Boolean) -> Unit = {}, val onDirectAudio: (Boolean) -> Unit, val onClientDirectAudio: (Boolean) -> Unit = {}, val onMic: (Boolean) -> Unit, @@ -226,6 +229,12 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) { ), s.oscMode, note = "Auto shows all controls without a controller. Steam + QAM shows only those buttons.", onPick = a.onOsc, ) + if (steam) ToggleRow( + host, "back-actions", "Invert Back actions", + if (s.backActionsInverted) "Back once opens Steam QAM; twice opens the session menu." + else "Back once opens the session menu; twice opens Steam QAM.", + s.backActionsInverted, onChange = a.onBackActionsInverted, + ) } SettingsGroup("Session") { ChoiceRow( diff --git a/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt index cad64176b5..da52109c7e 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt @@ -146,6 +146,7 @@ class DrawerActions( val frameGenMultiplier: Int, val lsfgReady: Boolean, val oscMode: String, + val backActionsInverted: Boolean, val touchMode: String, val touchAuto: String, val shapeMode: String, @@ -159,6 +160,7 @@ class DrawerActions( val onSteamMenu: (() -> Unit)?, val onQam: (() -> Unit)?, val onOsc: (String) -> Unit, + val onBackActionsInverted: (Boolean) -> Unit, val onTouch: (String) -> Unit, val onShape: (String) -> Unit, val onFexPreset: (String) -> Unit, @@ -296,6 +298,12 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { listOf(SessionPrefs.OSC_AUTO to "Auto", SessionPrefs.OSC_ALWAYS to "Always", SessionPrefs.OSC_STEAM_QAM to "Steam + QAM", SessionPrefs.OSC_NEVER to "Never"), a.oscMode, onPick = a.onOsc, ) + if (a.steam) ToggleRow( + host, "back-actions", "Invert Back actions", + if (a.backActionsInverted) "Back once opens Steam QAM; twice opens the session menu." + else "Back once opens the session menu; twice opens Steam QAM.", + a.backActionsInverted, onChange = a.onBackActionsInverted, + ) ActionRow("Keyboard", null, "Show") { host.open = null; a.onKeyboard() } } diff --git a/docs/progress-log.md b/docs/progress-log.md index ac6c752667..254fe6f62c 100644 --- a/docs/progress-log.md +++ b/docs/progress-log.md @@ -188,7 +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. - 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. -- Quick Access Menu for non-Deck pads - no confirmed chord; needs research, not a guess. +- Quick Access Menu for non-Deck pads - Back double-press now routes to the existing Guide+A chord; + the in-session and Steam settings can swap the single- and double-Back actions. Device confirmation + is still needed. - 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). - Rename before anything truly public: "SteamDeck" is Valve's mark. From e40b5ced7d349cbf24d5226c217593fb048a6c53 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 17:26:27 -0400 Subject: [PATCH 2/5] Expose Back actions in app settings --- app/src/main/java/com/steamdeck/launcher/MainActivity.kt | 6 ++++++ .../main/java/com/steamdeck/launcher/SessionActivity.kt | 3 ++- .../main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt | 8 ++++++++ docs/progress-log.md | 6 +++--- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt index 01db50bd76..021019d3ea 100644 --- a/app/src/main/java/com/steamdeck/launcher/MainActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/MainActivity.kt @@ -211,6 +211,7 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) theme = SessionPrefs.theme(this) + backActionsInverted = SessionPrefs.backActionsInverted(this) setContent { SteamDeckTheme(theme) { val sm = settingsMode @@ -241,6 +242,7 @@ class MainActivity : ComponentActivity() { packageStage = pkgStage, packagePercent = pkgPercent, sessionRunning = SessionState.running, + backActionsInverted = backActionsInverted, ), FrontEndActions( onPlay = { startSession(Intent(this, SessionActivity::class.java)) }, @@ -301,6 +303,10 @@ class MainActivity : ComponentActivity() { onTheme = { id -> SessionPrefs.setTheme(this, id); theme = id }, onHomeApp = { manageHomeApp() }, onAndroidApp = { app -> launchAndroidApp(app) }, + onBackActionsInverted = { inverted -> + SessionPrefs.setBackActionsInverted(this, inverted) + backActionsInverted = inverted + }, ), page = page, ) diff --git a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt index 608f3652f3..181684e2b5 100644 --- a/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/steamdeck/launcher/SessionActivity.kt @@ -284,7 +284,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { performBackAction(double = false) } pendingBackAction = pending - uiHandler.postDelayed(pending, android.view.ViewConfiguration.getDoubleTapTimeout().toLong()) + uiHandler.postDelayed(pending, BACK_DOUBLE_PRESS_TIMEOUT_MS) } private fun performBackAction(double: Boolean) { @@ -1005,6 +1005,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { companion object { 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. */ private const val SCALE_FIT = 1 private const val ALIGN_CENTER = 0 diff --git a/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt index fb374b5a51..cff70d69cc 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt @@ -141,6 +141,7 @@ class FrontEndState( val packageStage: String? = null, val packagePercent: Int = -1, val sessionRunning: Boolean = false, + val backActionsInverted: Boolean = false, ) class FrontEndActions( @@ -169,6 +170,7 @@ class FrontEndActions( val onTheme: (String) -> Unit = {}, val onHomeApp: () -> 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) } 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") { Box { ValueChip(s.frameGenLabel, host.open == "fg") { host.open = if (host.open == "fg") null else "fg" } diff --git a/docs/progress-log.md b/docs/progress-log.md index 254fe6f62c..6d3c9282df 100644 --- a/docs/progress-log.md +++ b/docs/progress-log.md @@ -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. - 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. -- Quick Access Menu for non-Deck pads - Back double-press now routes to the existing Guide+A chord; - the in-session and Steam settings can swap the single- and double-Back actions. Device confirmation - is still needed. +- Quick Access Menu for non-Deck pads - Back double-press (500 ms) now routes to the existing Guide+A + chord; the in-session menu, Steam settings, and Setup › Session can swap the single- and double-Back + actions. Device confirmation is still needed. - 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). - Rename before anything truly public: "SteamDeck" is Valve's mark. From 06d9b7b1ccc32db3191544b568d49727a363965c Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Wed, 23 Sep 2026 23:05:12 -0400 Subject: [PATCH 3/5] Replace Back inversion toggle with order menu --- .../com/steamdeck/launcher/session/SessionPrefs.kt | 6 ++++++ .../java/com/steamdeck/launcher/ui/FrontEndScreen.kt | 12 +++++++----- .../com/steamdeck/launcher/ui/ModeSettingsDialog.kt | 11 ++++++----- .../java/com/steamdeck/launcher/ui/SessionOverlay.kt | 11 ++++++----- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt index 4b4637c847..b8cd68dde9 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionPrefs.kt @@ -13,6 +13,12 @@ object SessionPrefs { const val OSC_STEAM_QAM = "steam-qam" const val OSC_NEVER = "never" + const val BACK_MENU_THEN_QAM = "1: menu 2: QAM" + const val BACK_QAM_THEN_MENU = "1: QAM 2: menu" + + fun backActionsOrder(inverted: Boolean): String = + if (inverted) BACK_QAM_THEN_MENU else BACK_MENU_THEN_QAM + private fun prefs(context: Context) = context.getSharedPreferences("session", Context.MODE_PRIVATE) fun hudEnabled(context: Context): Boolean = prefs(context).getBoolean("hud", true) diff --git a/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt index cff70d69cc..f01a9dac04 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/FrontEndScreen.kt @@ -108,6 +108,7 @@ import coil.compose.AsyncImage import com.steamdeck.launcher.R import com.steamdeck.launcher.frontend.Library import com.steamdeck.launcher.gpu.FrameGen +import com.steamdeck.launcher.session.SessionPrefs import java.io.File import kotlin.math.roundToInt @@ -694,11 +695,12 @@ private fun SetupPanel(s: FrontEndState, a: FrontEndActions) { ActionRow("ROMs folder", s.romsDir ?: "Choose where emulator games are stored", "Choose", a.onRoms) } 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, + ChoiceRow( + host, "back-actions", "Back", SessionPrefs.backActionsOrder(s.backActionsInverted), + listOf( + false to SessionPrefs.BACK_MENU_THEN_QAM, + true to SessionPrefs.BACK_QAM_THEN_MENU, + ), s.backActionsInverted, onPick = a.onBackActionsInverted, ) SettingsRow("Frame generation", "Select the frame generation mode") { Box { diff --git a/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt b/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt index 0956068777..9dcf583720 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/ModeSettingsDialog.kt @@ -229,11 +229,12 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) { ), s.oscMode, note = "Auto shows all controls without a controller. Steam + QAM shows only those buttons.", onPick = a.onOsc, ) - if (steam) ToggleRow( - host, "back-actions", "Invert Back actions", - if (s.backActionsInverted) "Back once opens Steam QAM; twice opens the session menu." - else "Back once opens the session menu; twice opens Steam QAM.", - s.backActionsInverted, onChange = a.onBackActionsInverted, + if (steam) ChoiceRow( + host, "back-actions", "Back", SessionPrefs.backActionsOrder(s.backActionsInverted), + listOf( + false to SessionPrefs.BACK_MENU_THEN_QAM, + true to SessionPrefs.BACK_QAM_THEN_MENU, + ), s.backActionsInverted, onPick = a.onBackActionsInverted, ) } SettingsGroup("Session") { diff --git a/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt b/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt index da52109c7e..8556e546fc 100644 --- a/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt +++ b/app/src/main/java/com/steamdeck/launcher/ui/SessionOverlay.kt @@ -298,11 +298,12 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) { listOf(SessionPrefs.OSC_AUTO to "Auto", SessionPrefs.OSC_ALWAYS to "Always", SessionPrefs.OSC_STEAM_QAM to "Steam + QAM", SessionPrefs.OSC_NEVER to "Never"), a.oscMode, onPick = a.onOsc, ) - if (a.steam) ToggleRow( - host, "back-actions", "Invert Back actions", - if (a.backActionsInverted) "Back once opens Steam QAM; twice opens the session menu." - else "Back once opens the session menu; twice opens Steam QAM.", - a.backActionsInverted, onChange = a.onBackActionsInverted, + if (a.steam) ChoiceRow( + host, "back-actions", "Back", SessionPrefs.backActionsOrder(a.backActionsInverted), + listOf( + false to SessionPrefs.BACK_MENU_THEN_QAM, + true to SessionPrefs.BACK_QAM_THEN_MENU, + ), a.backActionsInverted, onPick = a.onBackActionsInverted, ) ActionRow("Keyboard", null, "Show") { host.open = null; a.onKeyboard() } } From 9222f2e8e993f0953ec84d5919c4a85355aafc1e Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 01:04:29 -0400 Subject: [PATCH 4/5] Improve accelerated drawer stick navigation --- .../com/droiddeck/launcher/SessionActivity.kt | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 11dd8b8f8f..805bc075f1 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -93,6 +93,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private var drawerDirectionKey = KeyEvent.KEYCODE_UNKNOWN private var drawerDirectionDownTime = 0L private var drawerDirectionLastRepeat = 0L + private var drawerDirectionRepeatCount = 0 private var drawerDirectionDeviceId = -1 // Compose reads these; the activity writes them. @@ -742,8 +743,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { val hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y) val x = if (abs(hatX) > 0.4f) hatX else event.getAxisValue(MotionEvent.AXIS_X) val y = if (abs(hatY) > 0.4f) hatY else event.getAxisValue(MotionEvent.AXIS_Y) + val heldDirection = drawerDirectionKey.takeIf { + when (it) { + KeyEvent.KEYCODE_DPAD_LEFT -> -x >= DRAWER_DIRECTION_RELEASE_THRESHOLD + KeyEvent.KEYCODE_DPAD_RIGHT -> x >= DRAWER_DIRECTION_RELEASE_THRESHOLD + KeyEvent.KEYCODE_DPAD_UP -> -y >= DRAWER_DIRECTION_RELEASE_THRESHOLD + KeyEvent.KEYCODE_DPAD_DOWN -> y >= DRAWER_DIRECTION_RELEASE_THRESHOLD + else -> false + } + } val keyCode = when { - maxOf(abs(x), abs(y)) < 0.45f -> KeyEvent.KEYCODE_UNKNOWN + heldDirection != null -> heldDirection + maxOf(abs(x), abs(y)) < DRAWER_DIRECTION_ENGAGE_THRESHOLD -> KeyEvent.KEYCODE_UNKNOWN abs(x) > abs(y) && x < 0f -> KeyEvent.KEYCODE_DPAD_LEFT abs(x) > abs(y) -> KeyEvent.KEYCODE_DPAD_RIGHT y < 0f -> KeyEvent.KEYCODE_DPAD_UP @@ -757,17 +768,29 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { drawerDirectionDeviceId = event.deviceId drawerDirectionDownTime = now drawerDirectionLastRepeat = now + drawerDirectionRepeatCount = 0 dispatchDrawerKey(KeyEvent.ACTION_DOWN, 0, now) - } else if (keyCode != KeyEvent.KEYCODE_UNKNOWN && now - drawerDirectionLastRepeat >= 240L) { + } else if (keyCode != KeyEvent.KEYCODE_UNKNOWN && + now - drawerDirectionLastRepeat >= drawerDirectionRepeatIntervalMs()) { drawerDirectionLastRepeat = now - dispatchDrawerKey(KeyEvent.ACTION_DOWN, 1, now) + drawerDirectionRepeatCount++ + dispatchDrawerKey(KeyEvent.ACTION_DOWN, drawerDirectionRepeatCount, now) } } + private fun drawerDirectionRepeatIntervalMs(): Long = when (drawerDirectionRepeatCount) { + 0 -> DRAWER_DIRECTION_INITIAL_REPEAT_MS + 1 -> 250L + 2 -> 180L + 3 -> 135L + else -> 105L + } + private fun releaseDrawerDirection() { if (drawerDirectionKey == KeyEvent.KEYCODE_UNKNOWN) return dispatchDrawerKey(KeyEvent.ACTION_UP, 0, SystemClock.uptimeMillis()) drawerDirectionKey = KeyEvent.KEYCODE_UNKNOWN + drawerDirectionRepeatCount = 0 drawerDirectionDeviceId = -1 } @@ -1102,6 +1125,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { companion object { private const val TAG = "SessionActivity" private const val BACK_DOUBLE_PRESS_TIMEOUT_MS = 500L + private const val DRAWER_DIRECTION_ENGAGE_THRESHOLD = 0.55f + private const val DRAWER_DIRECTION_RELEASE_THRESHOLD = 0.30f + private const val DRAWER_DIRECTION_INITIAL_REPEAT_MS = 420L /** Compositor scale modes (Container.FULLSCREEN_* values): 1 = fit with bars, centred. */ private const val SCALE_FIT = 1 private const val ALIGN_CENTER = 0 From 582e4675835c2bb855f6b9da56823fa12569cbfb Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Thu, 24 Sep 2026 01:07:34 -0400 Subject: [PATCH 5/5] Revert "Improve accelerated drawer stick navigation" This reverts commit 10f55068296834b0e5b1963abad03c3aa825a2fe. --- .../com/droiddeck/launcher/SessionActivity.kt | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 805bc075f1..11dd8b8f8f 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -93,7 +93,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { private var drawerDirectionKey = KeyEvent.KEYCODE_UNKNOWN private var drawerDirectionDownTime = 0L private var drawerDirectionLastRepeat = 0L - private var drawerDirectionRepeatCount = 0 private var drawerDirectionDeviceId = -1 // Compose reads these; the activity writes them. @@ -743,18 +742,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { val hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y) val x = if (abs(hatX) > 0.4f) hatX else event.getAxisValue(MotionEvent.AXIS_X) val y = if (abs(hatY) > 0.4f) hatY else event.getAxisValue(MotionEvent.AXIS_Y) - val heldDirection = drawerDirectionKey.takeIf { - when (it) { - KeyEvent.KEYCODE_DPAD_LEFT -> -x >= DRAWER_DIRECTION_RELEASE_THRESHOLD - KeyEvent.KEYCODE_DPAD_RIGHT -> x >= DRAWER_DIRECTION_RELEASE_THRESHOLD - KeyEvent.KEYCODE_DPAD_UP -> -y >= DRAWER_DIRECTION_RELEASE_THRESHOLD - KeyEvent.KEYCODE_DPAD_DOWN -> y >= DRAWER_DIRECTION_RELEASE_THRESHOLD - else -> false - } - } val keyCode = when { - heldDirection != null -> heldDirection - maxOf(abs(x), abs(y)) < DRAWER_DIRECTION_ENGAGE_THRESHOLD -> KeyEvent.KEYCODE_UNKNOWN + maxOf(abs(x), abs(y)) < 0.45f -> KeyEvent.KEYCODE_UNKNOWN abs(x) > abs(y) && x < 0f -> KeyEvent.KEYCODE_DPAD_LEFT abs(x) > abs(y) -> KeyEvent.KEYCODE_DPAD_RIGHT y < 0f -> KeyEvent.KEYCODE_DPAD_UP @@ -768,29 +757,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { drawerDirectionDeviceId = event.deviceId drawerDirectionDownTime = now drawerDirectionLastRepeat = now - drawerDirectionRepeatCount = 0 dispatchDrawerKey(KeyEvent.ACTION_DOWN, 0, now) - } else if (keyCode != KeyEvent.KEYCODE_UNKNOWN && - now - drawerDirectionLastRepeat >= drawerDirectionRepeatIntervalMs()) { + } else if (keyCode != KeyEvent.KEYCODE_UNKNOWN && now - drawerDirectionLastRepeat >= 240L) { drawerDirectionLastRepeat = now - drawerDirectionRepeatCount++ - dispatchDrawerKey(KeyEvent.ACTION_DOWN, drawerDirectionRepeatCount, now) + dispatchDrawerKey(KeyEvent.ACTION_DOWN, 1, now) } } - private fun drawerDirectionRepeatIntervalMs(): Long = when (drawerDirectionRepeatCount) { - 0 -> DRAWER_DIRECTION_INITIAL_REPEAT_MS - 1 -> 250L - 2 -> 180L - 3 -> 135L - else -> 105L - } - private fun releaseDrawerDirection() { if (drawerDirectionKey == KeyEvent.KEYCODE_UNKNOWN) return dispatchDrawerKey(KeyEvent.ACTION_UP, 0, SystemClock.uptimeMillis()) drawerDirectionKey = KeyEvent.KEYCODE_UNKNOWN - drawerDirectionRepeatCount = 0 drawerDirectionDeviceId = -1 } @@ -1125,9 +1102,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { companion object { private const val TAG = "SessionActivity" private const val BACK_DOUBLE_PRESS_TIMEOUT_MS = 500L - private const val DRAWER_DIRECTION_ENGAGE_THRESHOLD = 0.55f - private const val DRAWER_DIRECTION_RELEASE_THRESHOLD = 0.30f - private const val DRAWER_DIRECTION_INITIAL_REPEAT_MS = 420L /** Compositor scale modes (Container.FULLSCREEN_* values): 1 = fit with bars, centred. */ private const val SCALE_FIT = 1 private const val ALIGN_CENTER = 0