feat(desktop): platform/appearance/accent overrides for local preview

Adds three override hooks so a single-OS developer can preview every
platform's theming without VMs:

  AMETHYST_PLATFORM=GNOME ./gradlew :desktopApp:run
  AMETHYST_APPEARANCE=light ./gradlew :desktopApp:run
  AMETHYST_ACCENT=#3584E4 ./gradlew :desktopApp:run

Each override accepts either an env var or a `-Damethyst.<key>=<value>`
JVM property (forwarded from the gradle invocation via build.gradle.kts).

- PlatformInfo: `amethyst.platform` accepts MACOS, WINDOWS, GNOME, KDE,
  LINUX_OTHER, UNKNOWN. Adds a `host` accessor for code that needs the
  real underlying OS (for a future fallback hook).
- PlatformAppearance: `amethyst.appearance` accepts light/dark.
- PlatformAccent: `amethyst.accent` accepts `#RRGGBB`, `RRGGBB`, or any
  libadwaita accent name (blue, teal, green, yellow, orange, red, pink,
  purple, slate).

Window chrome stays native to the host OS — overriding the platform
swaps in-app theming only, not the AWT title bar — so on a Mac you
still see traffic lights even when previewing the GNOME theme.

https://claude.ai/code/session_01NufduPfZvYQVYwLkbCjCUo
This commit is contained in:
Claude
2026-04-24 13:25:21 +00:00
parent a15c5d2692
commit 46864a07b8
4 changed files with 84 additions and 5 deletions
+7
View File
@@ -91,6 +91,13 @@ compose.desktop {
jvmArgs += "-Xmx2g"
// Forward platform-preview overrides from the gradle invocation to the
// launched app's JVM so `./gradlew :desktopApp:run -Damethyst.platform=GNOME`
// works in addition to the env-var form (`AMETHYST_PLATFORM=GNOME`).
listOf("amethyst.platform", "amethyst.appearance", "amethyst.accent").forEach { key ->
System.getProperty(key)?.let { jvmArgs += "-D$key=$it" }
}
nativeDistributions {
appResourcesRootDir.set(project.layout.projectDirectory.dir("src/jvmMain/appResources"))
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb, TargetFormat.Rpm)