Add display choice to Android app launches

This commit is contained in:
xXJsonDeruloXx committed 2026-09-24 09:30:34 -04:00
1 parent 87c44c3218
commit 4803c9d221
7 files changed
+167 -26

No files matched your search

@@ -1,5 +1,8 @@
package com.droiddeck.launcher.input
import android.hardware.display.DisplayManager
import android.view.Display
/** The control surface shown on a secondary Android display during a Linux session. */
enum class SecondScreenMode(val id: String, val label: String) {
NONE("none", "None"),
@@ -8,3 +11,19 @@ enum class SecondScreenMode(val id: String, val label: String) {
}
data class SecondScreenDisplay(val id: Int, val label: String)
/** The presentation-capable displays shared by the session controls and Android app launcher. */
object SecondScreenDisplays {
fun available(displayManager: DisplayManager, primaryDisplayId: Int = Display.DEFAULT_DISPLAY): List<SecondScreenDisplay> =
displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
.asSequence()
.filter { it.isValid && it.displayId != primaryDisplayId && (it.flags and Display.FLAG_PRESENTATION) != 0 }
.map { target ->
val mode = target.mode
SecondScreenDisplay(
target.displayId,
"${target.name} · ${mode.physicalWidth}×${mode.physicalHeight}",
)
}
.toList()
}