mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
Desktop: an lxqt session mode, the hosted-package catalog and the Desktop & apps screen
A second thing to launch beside Steam: the LXQt/labwc desktop, a hosted package the app installs into the runtime like the runtime itself, with the emulators and apps as further packages from the same catalog (desktop.json in winlator-contents). A tar package extracts over the rootfs with the runtime's own extractor; an AppImage lands in /opt/appimages with a .desktop entry and runs extracted, since proot has no FUSE. The session script's lxqt mode runs the desktop's labwc in place of gamescope.
This commit is contained in:
1 parent
7f154b933d
commit
2e3196788e
9 files changed
+289
-6
No files matched your search
@@ -0,0 +1,90 @@
|
||||
package com.steamdeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/** One hosted package as the dialog shows it. */
|
||||
class PackageRow(
|
||||
val id: String, val name: String, val tier: Int, val version: String, val size: String,
|
||||
val notes: String, val installed: String?,
|
||||
)
|
||||
|
||||
/**
|
||||
* The desktop and everything that goes on it, installed into the runtime on request. Tier 1 is
|
||||
* packaged natively for this hardware; tier 2 is an upstream ARM64 build we mirror and expect
|
||||
* little of on a phone; tier 3 is built by us from source.
|
||||
*/
|
||||
@Composable
|
||||
fun DesktopAppsDialog(
|
||||
rows: List<PackageRow>?,
|
||||
busyStage: String?,
|
||||
busyPercent: Int,
|
||||
onInstall: (String) -> Unit,
|
||||
onRemove: (String) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { if (busyStage == null) onDismiss() },
|
||||
title = { Text("Desktop & apps") },
|
||||
text = {
|
||||
Column(modifier = Modifier.heightIn(max = 420.dp).verticalScroll(rememberScrollState())) {
|
||||
if (busyStage != null) {
|
||||
Text(if (busyPercent >= 0) "$busyStage $busyPercent%" else busyStage, style = MaterialTheme.typography.bodySmall)
|
||||
if (busyPercent >= 0) LinearProgressIndicator(progress = { busyPercent / 100f }, modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp))
|
||||
else LinearProgressIndicator(modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp))
|
||||
Spacer(Modifier.height(8.dp))
|
||||
}
|
||||
when {
|
||||
rows == null -> Text("Could not reach the package catalog", color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
rows.isEmpty() -> Text("Loading the catalog…", color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
var lastTier = 0
|
||||
for (row in rows ?: emptyList()) {
|
||||
if (row.tier != lastTier) {
|
||||
lastTier = row.tier
|
||||
Text(
|
||||
when (row.tier) {
|
||||
1 -> "Native for this hardware"
|
||||
2 -> "Upstream ARM64 builds — experimental on a phone"
|
||||
else -> "Built from source — experimental"
|
||||
},
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.padding(top = 8.dp, bottom = 2.dp),
|
||||
)
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 3.dp)) {
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(row.name, style = MaterialTheme.typography.bodyMedium)
|
||||
Text(
|
||||
(if (row.installed != null) "installed ${row.installed}" else "${row.version} · ${row.size}") +
|
||||
(if (row.notes.isNotEmpty()) " — ${row.notes}" else ""),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
if (row.installed != null) TextButton(enabled = busyStage == null, onClick = { onRemove(row.id) }) { Text("Remove") }
|
||||
else TextButton(enabled = busyStage == null, onClick = { onInstall(row.id) }) { Text("Install") }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
confirmButton = { TextButton(enabled = busyStage == null, onClick = onDismiss) { Text("Close") } },
|
||||
)
|
||||
}
|
||||
@@ -42,6 +42,7 @@ class MainUiState(
|
||||
val percent: Int,
|
||||
val failed: Boolean,
|
||||
val frameGenLabel: String,
|
||||
val desktopInstalled: Boolean,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -57,6 +58,8 @@ class MainUiState(
|
||||
fun MainScreen(
|
||||
state: MainUiState,
|
||||
onPlay: () -> Unit,
|
||||
onDesktop: () -> Unit,
|
||||
onApps: () -> Unit,
|
||||
onRuntime: () -> Unit,
|
||||
onFrameGen: () -> Unit,
|
||||
onProtons: () -> Unit,
|
||||
@@ -129,6 +132,10 @@ fun MainScreen(
|
||||
onClick = onPlay, enabled = state.ready && !state.busy,
|
||||
modifier = Modifier.fillMaxWidth().height(buttonHeight),
|
||||
) { Text("Play", fontSize = 14.sp * k) }
|
||||
OutlinedButton(
|
||||
onClick = onDesktop, enabled = state.ready && !state.busy && state.desktopInstalled,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
|
||||
) { Text(if (state.desktopInstalled) "Desktop" else "Desktop — install it under Desktop & apps", fontSize = 13.sp * k) }
|
||||
val runtimeLabel = when {
|
||||
state.busy -> "Working…"
|
||||
!state.ready -> "Install Linux runtime"
|
||||
@@ -143,6 +150,10 @@ fun MainScreen(
|
||||
onClick = onFrameGen,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
|
||||
) { Text("Frame generation: ${state.frameGenLabel}", fontSize = 13.sp * k) }
|
||||
OutlinedButton(
|
||||
onClick = onApps, enabled = state.ready && !state.busy,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
|
||||
) { Text("Desktop & apps", fontSize = 13.sp * k) }
|
||||
OutlinedButton(
|
||||
onClick = onProtons,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
|
||||
|
||||
Reference in new issue
Block a user