From 3d051f018ebdd0b068d600a0404e3a4879a60a7d Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 24 Sep 2026 09:19:10 -0400 Subject: [PATCH] Front end: leave touch mode on open so the rail item can take focus --- .../java/com/droiddeck/launcher/ui/FrontEndScreen.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt index 25853b1076..f562e19bd4 100644 --- a/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt +++ b/app/src/main/java/com/droiddeck/launcher/ui/FrontEndScreen.kt @@ -108,6 +108,8 @@ import androidx.compose.ui.layout.positionInRoot import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalWindowInfo +import androidx.compose.ui.platform.LocalInputModeManager +import androidx.compose.ui.input.InputMode import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow @@ -307,13 +309,17 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com modifier = if (wide) Modifier.width(236.dp).fillMaxHeight() else Modifier.fillMaxWidth().height(maxHeight * 0.42f), ) } - // The app opens with the selected rail item focused, so a controller sees where it is. A - // request before the window has focus is dropped, so wait for it and retry until it sticks. + // The app opens with the selected rail item focused, so a controller sees where it is. An + // app starts in touch mode, where clickables refuse focus, so leave it first (a touch goes + // straight back to it); a request before the window has focus is dropped, so wait for + // that and retry until it sticks. val window = LocalWindowInfo.current + val inputMode = LocalInputModeManager.current LaunchedEffect(Unit) { snapshotFlow { window.isWindowFocused }.first { it } repeat(20) { if (frontFocus.railFocused) return@LaunchedEffect + if (inputMode.inputMode != InputMode.Keyboard) inputMode.requestInputMode(InputMode.Keyboard) runCatching { frontFocus.railFor(railSelection).requestFocus() } kotlinx.coroutines.delay(100) }