feat(dual-screen): single-screen mode on the Retroid Pocket Duo and AYN Thor while another window holds the bottom screen (#1979)

* feat(dual-screen): step aside on the Retroid Pocket Duo's bottom screen while another window holds it

When the Duo's double-Home performance panel or another app (Chrome, YouTube) is on the bottom screen, DroidDeck switches to single-screen mode: the launcher's bottom panel and the in-game bottom controls close and the top screen takes its single-screen layout. When the bottom screen is back on its home screen, dual-screen mode returns, with the in-game controls reopening in the mode they had.

The DroidDeck shortcuts accessibility service watches the bottom screen's windows on the Duo only. An app opened under DroidDeck's panel is caught by its window opening on that display; the Retroid panel and any app on top are read from the window list.

* fix(dual-screen): log the bottom screen's holders only when they change

* fix(dual-screen): the topmost window other than DroidDeck's decides who holds the bottom screen

Apps opened under DroidDeck's bottom panel are still listed beneath it, so DroidDeck's own windows are skipped and the next full-size window decides. Fallback home screens such as Settings' boot-time one no longer count as a home screen.

* fix(dual-screen): catch apps opened under the in-game bottom controls

The in-game bottom controls hide the windows beneath them from the window list, so an app opening a window on the bottom screen while only DroidDeck is listed now holds the screen until the list can see it.

* fix(dual-screen): keyboards never hold the bottom screen; watch the built-in panel only

Keyboard windows opening on the bottom screen no longer count as an app arriving, so typing with the in-game bottom keyboard keeps the controls up. Only the built-in bottom panel is watched, so an external display can't close the controls. An arrival recorded while a check runs is kept for the next check, and stopping the watcher clears the held state after any running check.

* feat(dual-screen): step aside on the AYN Thor's bottom screen too

The bottom-screen watch now runs on every handheld in DualScreen's known dual-screen models, the Retroid Pocket Duo and the AYN Thor, including model names that extend them such as AYN Thor Max.

* fix(dual-screen): only the current bottom-screen watch publishes; Thor variants match when the display type is hidden

* fix: session drawer top row scrolls and Stop stays an icon-only button

* fix: docked drawer drops the second-screen page; tapping the active mode returns to none

* fix: docked drawer drops the bottom-screen mode icons; the Mode page keeps them

* fix: restore the second-screen drawer page when docked

* feat: dual screen launcher and dual screen sessions are separate Automatic/On/Off settings

* fix: session drawer top row keeps its right alignment

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
This commit is contained in:
MaxsTechReviewandKurt Himebauch authored and GitHub committed 2026-11-01 23:14:18 -05:00
1 parent 92ec0929ae
commit 313b6a59d2
47 files changed
+358 -235

No files matched your search

@@ -133,7 +133,7 @@ class FrontEndState(
val dualScreen: Boolean = false,
val dualScreenDevice: Boolean = false,
val dualScreenMode: String = com.droiddeck.launcher.input.DualScreen.MODE_AUTO,
val dualScreenLauncher: Boolean = true,
val dualScreenSessions: String = com.droiddeck.launcher.input.DualScreen.MODE_AUTO,
val dualScreenControls: Boolean = true,
val packages: List<PackageRow>? = null,
val packageCatalogLoading: Boolean = false,
@@ -238,7 +238,7 @@ class FrontEndActions(
val onLauncherFullscreen: (Boolean) -> Unit = {},
val onAnimationsEnabled: (Boolean) -> Unit = {},
val onDualScreenMode: (String) -> Unit = {},
val onDualScreenLauncher: (Boolean) -> Unit = {},
val onDualScreenSessions: (String) -> Unit = {},
val onDualScreenControls: (Boolean) -> Unit = {},
val onDownloadSource: (String) -> Unit = {},
val onDownloadMirror: (String) -> Unit = {},
@@ -435,21 +435,23 @@ internal fun SetupPanel(
s.launcherFullscreen,
) { a.onLauncherFullscreen(it) }
if (s.dualScreenDevice) {
ChoiceRow(
host, "dual-screen", stringResource(R.string.setup_dual_screen), stringResource(R.string.setup_dual_screen_hint),
listOf(
com.droiddeck.launcher.input.DualScreen.MODE_AUTO to stringResource(R.string.setup_dual_screen_auto),
com.droiddeck.launcher.input.DualScreen.MODE_ON to stringResource(R.string.setup_dual_screen_on),
com.droiddeck.launcher.input.DualScreen.MODE_OFF to stringResource(R.string.setup_dual_screen_off),
),
s.dualScreenMode, onPick = a.onDualScreenMode,
val dualModes = listOf(
com.droiddeck.launcher.input.DualScreen.MODE_AUTO to stringResource(R.string.setup_dual_screen_auto),
com.droiddeck.launcher.input.DualScreen.MODE_ON to stringResource(R.string.setup_dual_screen_on),
com.droiddeck.launcher.input.DualScreen.MODE_OFF to stringResource(R.string.setup_dual_screen_off),
)
}
if (s.dualScreenDevice && s.dualScreenMode != com.droiddeck.launcher.input.DualScreen.MODE_OFF) {
ToggleRow(host, "dual-screen-menu", stringResource(R.string.setup_dual_screen_menu),
stringResource(R.string.setup_dual_screen_menu_hint), s.dualScreenLauncher) { a.onDualScreenLauncher(it) }
ToggleRow(host, "dual-screen-controls", stringResource(R.string.setup_dual_screen_controls),
stringResource(R.string.setup_dual_screen_controls_hint), s.dualScreenControls) { a.onDualScreenControls(it) }
ChoiceRow(
host, "dual-screen", stringResource(R.string.setup_dual_screen_launcher), stringResource(R.string.setup_dual_screen_launcher_hint),
dualModes, s.dualScreenMode, onPick = a.onDualScreenMode,
)
ChoiceRow(
host, "dual-screen-sessions", stringResource(R.string.setup_dual_screen_sessions), stringResource(R.string.setup_dual_screen_sessions_hint),
dualModes, s.dualScreenSessions, onPick = a.onDualScreenSessions,
)
if (s.dualScreenSessions != com.droiddeck.launcher.input.DualScreen.MODE_OFF) {
ToggleRow(host, "dual-screen-controls", stringResource(R.string.setup_dual_screen_controls),
stringResource(R.string.setup_dual_screen_controls_hint), s.dualScreenControls) { a.onDualScreenControls(it) }
}
}
}
}
@@ -29,6 +29,7 @@ import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.foundation.layout.offset
import androidx.compose.material.icons.Icons
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.widthIn
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.Terminal
import androidx.compose.material.icons.outlined.Dashboard
@@ -475,8 +476,6 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
SteamActionPill(
stringResource(R.string.common_close), Icons.Outlined.Close, focus.track(page, "close"),
) { host.open = null; a.onClose() }
Spacer(Modifier.width(4.dp))
BottomScreenModes(a, focus.track(page, "bottom-modes")) { host.open = null }
}
Spacer(Modifier.weight(1f))
SteamActionPill(
@@ -876,69 +875,15 @@ private fun StopSessionButton(modifier: Modifier = Modifier, onClick: () -> Unit
val fill by animateColorAsState(if (hot) colors.error.copy(alpha = 0.18f) else Color.Transparent, Motion.tw(220), label = "dangerFill")
val shape = RoundedCornerShape(20.dp)
val stopDescription = stringResource(R.string.stop_session)
val stopLabel = stringResource(R.string.drawer_stop)
var iconOnly by remember(stopLabel, androidx.compose.ui.platform.LocalConfiguration.current.screenWidthDp) { mutableStateOf(false) }
Row(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
modifier = modifier.heightIn(min = 44.dp).semantics { contentDescription = stopDescription }.testTag("drawer-stop")
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center,
modifier = modifier.heightIn(min = 44.dp).widthIn(min = 44.dp).semantics { contentDescription = stopDescription }.testTag("drawer-stop")
.clip(shape).background(fill).glideBorder(hot, shape, colors.error.copy(alpha = 0.9f), colors.error.copy(alpha = 0.55f))
.hoverable(src).clickable(role = androidx.compose.ui.semantics.Role.Button, interactionSource = src, indication = LocalIndication.current, onClick = onClick)
.controllerConfirm(onClick = onClick)
.padding(start = 12.dp, end = 14.dp),
.padding(horizontal = 12.dp),
) {
Icon(Icons.Outlined.PowerSettingsNew, contentDescription = null, tint = colors.error, modifier = Modifier.size(18.dp))
if (!iconOnly) Text(
stopLabel, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.error,
maxLines = 1, softWrap = false, onTextLayout = { if (it.hasVisualOverflow) iconOnly = true },
)
}
}
@Composable
private fun BottomScreenModes(a: DrawerActions, modifier: Modifier, onPick: () -> Unit) {
val pal = LocalPalette.current
val colors = MaterialTheme.colorScheme
val modes = buildList {
if (com.droiddeck.launcher.session.SessionState.deckPad) add(SecondScreenMode.DECK_CONTROLS to Icons.Outlined.SportsEsports)
add(SecondScreenMode.KEYBOARD_TRACKPAD to Icons.Outlined.Keyboard)
add(SecondScreenMode.TERMINAL to Icons.Outlined.Terminal)
if (a.dashboardAvailable) add(SecondScreenMode.DASHBOARD to Icons.Outlined.Dashboard)
if (a.desktopAvailable) add(SecondScreenMode.DESKTOP to Icons.Outlined.DesktopWindows)
}
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
modifier = modifier.focusGroup().clip(RoundedCornerShape(26.dp)).border(1.dp, pal.line, RoundedCornerShape(26.dp)).padding(4.dp),
) {
modes.forEach { (mode, icon) ->
val selected = a.secondScreenMode == mode
val source = remember { MutableInteractionSource() }
val hot = source.collectIsFocusedAsState().value || source.collectIsHoveredAsState().value
val shape = RoundedCornerShape(20.dp)
val pick = { onPick(); a.onSecondScreenMode(mode) }
val label = stringResource(mode.label)
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.size(width = 52.dp, height = 40.dp).semantics { contentDescription = label }
.clip(shape)
.background(when {
selected -> pal.signal
hot -> pal.signal.copy(alpha = 0.14f)
else -> Color.Transparent
})
.glideBorder(hot, shape, pal.signal)
.hoverable(source)
.selectable(selected, interactionSource = source, indication = LocalIndication.current, role = Role.Tab, onClick = pick)
.controllerConfirm(onClick = pick),
) {
Icon(icon, contentDescription = null, modifier = Modifier.size(22.dp),
tint = when {
selected -> colors.background
hot -> pal.signal
else -> colors.onBackground
})
}
}
}
}