feat(shell): app-wide dynamic album-art background ("modo Cider")
Opt-in album-art background composited behind the whole shell, wgpu-tier
only. Appearance mode picker: Off | Ambient (GPU shader) | Blurred art.
- ambient.wgsl: new calm, low-energy album-colored scene (mode 7), drifting
mesh-gradient of the primary/secondary/accent triad, no beat/transient.
Registered in shader_underlay SHADER_SOURCES[5] + render_frame idx math.
- state.slint: AppearanceState app-background {modes,mode-index,available,
dim,surface-alpha}; ImmersiveState.app-shader-mode (derived 1->7);
ShellState.app-background-active (mode>0 && wgpu && has-track).
- visualizer.rs: drain renders shader-mode when immersive OPEN, else
app-shader-mode (7=ambient) into the same shader-texture sink.
- AppShell: background layer at root z-bottom (Ambient=shader texture,
Blurred=ImmersiveAtmosphere) + tunable dark scrim; shell chrome surfaces
go translucent when active; viz-should-run extended to drive the drain.
- Whole-shell translucency: Sidebar/HeaderBar/PlayerBar(Small)/QueueSidebar/
LyricsSidebar/SidebarNowPlayingDock + AppShell content well/frame/column.
- ui_prefs: persisted `app_background` (off|ambient|blurred), String-key
pattern; appearance-select("app-background") write-back.
- Live-tunable knobs QBZ_BG_DIM / QBZ_BG_SURFACE_ALPHA (seeded at startup)
so the look is dialed in one smoke session without a rebuild.
- i18n: 8 locales for the picker + warning; reduce-motion / D4 (no-track ->
opaque theme) handled via derived active flag.
Design + signed decisions: qbz-nix-docs/specs/2026-07-16-app-wide-dynamic-background.md
cc
This commit is contained in:
23 files changed
+483
-21
No files matched your search
@@ -4581,3 +4581,16 @@ msgstr "Link kopiert"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "Link konnte nicht kopiert werden"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Ambient"
|
||||
msgstr "Ambient"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "Unscharfes Cover"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "Dynamischer Hintergrund"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "Animierter Album-Cover-Hintergrund hinter der gesamten App. Hoher Ressourcenverbrauch — GPU-beschleunigt."
|
||||
@@ -356,3 +356,19 @@ msgstr "Link copied"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "Failed to copy link"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Off"
|
||||
msgstr "Off"
|
||||
|
||||
msgid "Ambient"
|
||||
msgstr "Ambient"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "Blurred art"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "Dynamic background"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
@@ -4611,3 +4611,16 @@ msgstr "Enlace copiado"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "No se pudo copiar el enlace"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Ambient"
|
||||
msgstr "Ambiente"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "Portada difuminada"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "Fondo dinámico"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "Fondo animado con la portada del álbum detrás de toda la app. Alto uso de recursos — acelerado por GPU."
|
||||
@@ -4581,3 +4581,16 @@ msgstr "Lien copié"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "Échec de la copie du lien"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Ambient"
|
||||
msgstr "Ambiant"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "Pochette floutée"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "Arrière-plan dynamique"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "Arrière-plan animé à partir de la pochette derrière toute l'application. Consommation de ressources élevée — accéléré par le GPU."
|
||||
@@ -4569,3 +4569,16 @@ msgstr "リンクをコピーしました"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "リンクをコピーできませんでした"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Ambient"
|
||||
msgstr "アンビエント"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "ぼかしアートワーク"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "ダイナミック背景"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "アプリ全体の背後にアルバムアートワークのアニメーション背景を表示します。リソース使用量が高く、GPUアクセラレーションを使用します。"
|
||||
@@ -4593,3 +4593,16 @@ msgstr "Link gekopieerd"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "Kopiëren van link mislukt"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Ambient"
|
||||
msgstr "Ambient"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "Vervaagde albumhoes"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "Dynamische achtergrond"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "Geanimeerde albumhoes-achtergrond achter de hele app. Hoog verbruik van systeembronnen — GPU-versneld."
|
||||
@@ -4581,3 +4581,16 @@ msgstr "Link copiado"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "Falha ao copiar o link"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Ambient"
|
||||
msgstr "Ambiente"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "Capa desfocada"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "Fundo dinâmico"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "Fundo animado com a capa do álbum atrás de toda a aplicação. Uso elevado de recursos — acelerado por GPU."
|
||||
@@ -4595,3 +4595,16 @@ msgstr "Ссылка скопирована"
|
||||
|
||||
msgid "Failed to copy link"
|
||||
msgstr "Не удалось скопировать ссылку"
|
||||
|
||||
# Dynamic app background (Appearance settings)
|
||||
msgid "Ambient"
|
||||
msgstr "Атмосферный"
|
||||
|
||||
msgid "Blurred art"
|
||||
msgstr "Размытая обложка"
|
||||
|
||||
msgid "Dynamic background"
|
||||
msgstr "Динамический фон"
|
||||
|
||||
msgid "Animated album-art background behind the whole app. High resource use — GPU accelerated."
|
||||
msgstr "Анимированный фон из обложки альбома за всем приложением. Высокое потребление ресурсов — аппаратное ускорение GPU."
|
||||
@@ -240,6 +240,20 @@ export component AppearanceSettings inherits VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
if AppearanceState.app-background-available: SettingRow {
|
||||
label: @tr("Dynamic background");
|
||||
description: @tr("Animated album-art background behind the whole app. High resource use — GPU accelerated.");
|
||||
QbzSelect {
|
||||
menu-width: 200px;
|
||||
options: AppearanceState.app-background-modes;
|
||||
current-index: AppearanceState.app-background-mode-index;
|
||||
selected(i) => {
|
||||
AppearanceState.app-background-mode-index = i;
|
||||
AppearanceState.appearance-select("app-background", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingRow {
|
||||
label: @tr("Intelligent Search");
|
||||
description: @tr("Smart search cache, ranking, and the search preview dropdown. On by default.");
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
// Ambient — the calm, low-energy album-colored scene for the APP-WIDE dynamic
|
||||
// background ("modo Cider"). Unlike plasma/tunnel/aurora this is deliberately
|
||||
// NOT audio-reactive on the fast drivers (no `beat`/`transient`): it is a slow
|
||||
// mesh-gradient of the album triad (primary/secondary/accent) drifting on
|
||||
// long-period sinusoids, with only a gentle breathe from `level_smooth`. It is
|
||||
// meant to sit behind the entire shell for minutes at a time without ever
|
||||
// pulling the eye, so text over the translucent surfaces stays readable (the
|
||||
// Slint layer adds the dark scrim; this scene stays mid-to-low brightness).
|
||||
//
|
||||
// Uses ONLY binding 0 (uniforms) — a scene that declares a SUBSET of the shared
|
||||
// bind-group layout is valid (see shader_underlay.rs build_shared). Registered
|
||||
// as mode 7, index [5] in SHADER_SOURCES.
|
||||
|
||||
struct Uniforms {
|
||||
time: f32,
|
||||
phase: f32,
|
||||
beat: f32,
|
||||
level: f32,
|
||||
resolution: vec2<f32>,
|
||||
level_smooth: f32,
|
||||
transient: f32,
|
||||
energy_lo: vec4<f32>,
|
||||
energy_hi: vec4<f32>,
|
||||
bands_lo: vec4<f32>,
|
||||
bands_hi: vec4<f32>,
|
||||
primary: vec4<f32>,
|
||||
secondary: vec4<f32>,
|
||||
accent: vec4<f32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0) var<uniform> u: Uniforms;
|
||||
|
||||
struct VsOut {
|
||||
@builtin(position) clip: vec4<f32>,
|
||||
@location(0) uv: vec2<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn vs_main(@builtin(vertex_index) vid: u32) -> VsOut {
|
||||
var verts = array<vec2<f32>, 3>(
|
||||
vec2<f32>(-1.0, -1.0),
|
||||
vec2<f32>( 3.0, -1.0),
|
||||
vec2<f32>(-1.0, 3.0),
|
||||
);
|
||||
let p = verts[vid];
|
||||
var out: VsOut;
|
||||
out.clip = vec4<f32>(p, 0.0, 1.0);
|
||||
out.uv = p * 0.5 + vec2<f32>(0.5, 0.5);
|
||||
return out;
|
||||
}
|
||||
|
||||
// Cheap smooth value noise (hash + bilinear), a couple of octaves. No loops over
|
||||
// large ranges — this is a background that must stay near-free on an integrated
|
||||
// GPU.
|
||||
fn hash2(p: vec2<f32>) -> f32 {
|
||||
let h = dot(p, vec2<f32>(127.1, 311.7));
|
||||
return fract(sin(h) * 43758.5453123);
|
||||
}
|
||||
|
||||
fn vnoise(p: vec2<f32>) -> f32 {
|
||||
let i = floor(p);
|
||||
let f = fract(p);
|
||||
let a = hash2(i);
|
||||
let b = hash2(i + vec2<f32>(1.0, 0.0));
|
||||
let c = hash2(i + vec2<f32>(0.0, 1.0));
|
||||
let d = hash2(i + vec2<f32>(1.0, 1.0));
|
||||
let w = f * f * (3.0 - 2.0 * f);
|
||||
return mix(mix(a, b, w.x), mix(c, d, w.x), w.y);
|
||||
}
|
||||
|
||||
fn fbm(p: vec2<f32>) -> f32 {
|
||||
var v = 0.0;
|
||||
var amp = 0.55;
|
||||
var q = p;
|
||||
v = v + amp * vnoise(q); q = q * 2.02; amp = amp * 0.5;
|
||||
v = v + amp * vnoise(q); q = q * 2.03; amp = amp * 0.5;
|
||||
v = v + amp * vnoise(q);
|
||||
return v;
|
||||
}
|
||||
|
||||
// Soft radial weight for a color blob centered at `c`.
|
||||
fn blob(uv: vec2<f32>, c: vec2<f32>, r: f32) -> f32 {
|
||||
let d = distance(uv, c);
|
||||
return exp(-(d * d) / (r * r));
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fs_main(in: VsOut) -> @location(0) vec4<f32> {
|
||||
// Aspect-correct so the drift looks even on wide windows.
|
||||
let aspect = u.resolution.x / max(u.resolution.y, 1.0);
|
||||
var uv = in.uv;
|
||||
uv.x = uv.x * aspect;
|
||||
|
||||
// Slow clock. Long periods → a background that morphs over ~20-40s, never
|
||||
// strobes. `level_smooth` adds a barely-there breathe (kept small on purpose).
|
||||
let t = u.time * 0.04;
|
||||
let breathe = 1.0 + 0.06 * u.level_smooth;
|
||||
|
||||
// Gentle domain warp so the blobs don't move on rigid circles.
|
||||
let warp = vec2<f32>(
|
||||
fbm(uv * 1.6 + vec2<f32>(t, 0.0)),
|
||||
fbm(uv * 1.6 + vec2<f32>(0.0, t * 0.9)),
|
||||
);
|
||||
let p = uv + (warp - 0.5) * 0.35;
|
||||
|
||||
// Three album-colored blobs drifting on long-period sinusoids.
|
||||
let cA = vec2<f32>(0.30 * aspect + 0.22 * aspect * sin(t * 0.7),
|
||||
0.35 + 0.20 * cos(t * 0.53));
|
||||
let cB = vec2<f32>(0.72 * aspect + 0.20 * aspect * sin(t * 0.6 + 2.1),
|
||||
0.62 + 0.22 * cos(t * 0.47 + 1.3));
|
||||
let cC = vec2<f32>(0.52 * aspect + 0.24 * aspect * cos(t * 0.5 + 4.0),
|
||||
0.28 + 0.18 * sin(t * 0.63 + 3.2));
|
||||
|
||||
let r = 0.55 * breathe;
|
||||
let wA = blob(p, cA, r);
|
||||
let wB = blob(p, cB, r * 0.92);
|
||||
let wC = blob(p, cC, r * 0.85);
|
||||
let wSum = wA + wB + wC + 0.0001;
|
||||
|
||||
var col = (u.primary.rgb * wA + u.secondary.rgb * wB + u.accent.rgb * wC) / wSum;
|
||||
|
||||
// Vertical falloff → a touch darker at the very top/bottom edges, so chrome
|
||||
// (titlebar, player bar) sits on calmer color. Kept subtle.
|
||||
let vshade = 1.0 - 0.18 * pow(abs(in.uv.y - 0.5) * 2.0, 2.0);
|
||||
col = col * vshade;
|
||||
|
||||
// Overall brightness pull-down: this is a BACKGROUND. The Slint scrim adds
|
||||
// the real legibility dim; this just keeps the base from ever glaring on a
|
||||
// white-heavy album palette.
|
||||
col = col * 0.62;
|
||||
|
||||
// A whisper of grain to avoid banding on the smooth gradient.
|
||||
let grain = (vnoise(in.uv * u.resolution * 0.5) - 0.5) * 0.015;
|
||||
col = col + vec3<f32>(grain);
|
||||
|
||||
return vec4<f32>(clamp(col, vec3<f32>(0.0), vec3<f32>(1.0)), 1.0);
|
||||
}
|
||||
@@ -8,7 +8,8 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Layout } from "../foundation/layout.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { NavState, ContentView, ShellState, OfflineState, PlaylistState, ImmersiveState, SearchActions, VisualizerState, PurchaseDetailState, NowPlayingState } from "../state.slint";
|
||||
import { NavState, ContentView, ShellState, OfflineState, PlaylistState, ImmersiveState, SearchActions, VisualizerState, PurchaseDetailState, NowPlayingState, AppearanceState } from "../state.slint";
|
||||
import { ImmersiveAtmosphere } from "../immersive/ImmersiveAtmosphere.slint";
|
||||
import { Sidebar } from "Sidebar.slint";
|
||||
import { SidebarNowPlayingDock } from "SidebarNowPlayingDock.slint";
|
||||
import { HeaderBar } from "HeaderBar.slint";
|
||||
@@ -161,7 +162,14 @@ export component AppShell inherits Rectangle {
|
||||
// value (changed only fires on transitions). Immersive's own close handlers
|
||||
// defer to `large-active` so closing it never kills an active Large dock.
|
||||
property <bool> viz-should-run: ImmersiveState.open
|
||||
|| (ShellState.large-active && ShellState.large-visualizer-on);
|
||||
|| (ShellState.large-active && ShellState.large-visualizer-on)
|
||||
// App-wide Ambient background (mode 1) needs the 30fps shader drain
|
||||
// running even with the immersive overlay closed. Blurred art (mode 2)
|
||||
// is Slint-animated and needs no drain. has-track gates it so nothing
|
||||
// playing → drain idle (the FFT tap self-freezes on !playing anyway).
|
||||
|| (AppearanceState.app-background-mode-index == 1
|
||||
&& AppearanceState.app-background-available
|
||||
&& NowPlayingState.has-track);
|
||||
changed viz-should-run => {
|
||||
VisualizerState.set-enabled(self.viz-should-run);
|
||||
}
|
||||
@@ -187,6 +195,44 @@ export component AppShell inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// APP-WIDE DYNAMIC BACKGROUND ("modo Cider") — the bottom-most visual layer,
|
||||
// behind every shell surface (which goes translucent via
|
||||
// ShellState.app-background-active). Only mounts when a mode is picked, the
|
||||
// wgpu tier allows it, AND a track is loaded (D4: nothing playing → opaque
|
||||
// theme restored). Ambient (mode 1) shows the GPU shader texture the drain
|
||||
// renders into ImmersiveState.shader-texture; Blurred art (mode 2) reuses the
|
||||
// ImmersiveAtmosphere blurred-cover. Edge-pinned to root (absolute layout).
|
||||
if ShellState.app-background-active && AppearanceState.app-background-mode-index == 1: Image {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: root.width;
|
||||
height: root.height;
|
||||
image-fit: fill;
|
||||
source: ImmersiveState.shader-texture;
|
||||
}
|
||||
if ShellState.app-background-active && AppearanceState.app-background-mode-index == 2: ImmersiveAtmosphere {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: root.width;
|
||||
height: root.height;
|
||||
source-image: ImmersiveState.bg-image;
|
||||
fallback-image: NowPlayingState.artwork-large.width > 0
|
||||
? NowPlayingState.artwork-large
|
||||
: NowPlayingState.artwork;
|
||||
animated: NowPlayingState.playing;
|
||||
dim: AppearanceState.app-background-dim;
|
||||
}
|
||||
// Extra tunable dark scrim over the Ambient shader (the atmosphere applies
|
||||
// its own `dim`). Keeps chrome text legible over a bright album palette;
|
||||
// QBZ_BG_DIM tunes it live at startup.
|
||||
if ShellState.app-background-active && AppearanceState.app-background-mode-index == 1: Rectangle {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: root.width;
|
||||
height: root.height;
|
||||
background: #000000.with-alpha(AppearanceState.app-background-dim);
|
||||
}
|
||||
|
||||
// Bottom layer: catches the mouse back / forward buttons for history
|
||||
// navigation. Declared first so the real UI sits on top of it.
|
||||
TouchArea {
|
||||
@@ -239,7 +285,9 @@ export component AppShell inherits Rectangle {
|
||||
// content panel (Slack-style bezel on all four corners).
|
||||
Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
VerticalLayout {
|
||||
vertical-stretch: 1;
|
||||
padding-left: 8px;
|
||||
@@ -277,7 +325,9 @@ export component AppShell inherits Rectangle {
|
||||
- (ShellState.npb-mode == 2 ? Layout.header-height : Layout.player-bar-height)
|
||||
- 8px;
|
||||
vertical-stretch: 1;
|
||||
background: Theme.surface-main;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-main.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-main;
|
||||
border-radius: Radius.md;
|
||||
clip: true;
|
||||
|
||||
@@ -550,7 +600,12 @@ export component AppShell inherits Rectangle {
|
||||
width: (ShellState.queue-open || ShellState.lyrics-open) ? 300px : 0px;
|
||||
clip: true;
|
||||
animate width { duration: 160ms; easing: ease-in-out; }
|
||||
background: Theme.surface-card;
|
||||
// Transparent when the app-background is active so the inner
|
||||
// QueueSidebar / LyricsSidebar (already translucent) carry the
|
||||
// tint once, not twice (no double-darkening of this column).
|
||||
background: ShellState.app-background-active
|
||||
? transparent
|
||||
: Theme.surface-card;
|
||||
VerticalLayout {
|
||||
spacing: 0px;
|
||||
if ShellState.queue-open: QueueSidebar {
|
||||
|
||||
@@ -549,7 +549,9 @@ export component HeaderBar inherits Rectangle {
|
||||
callback navigate(string /* route */);
|
||||
|
||||
height: Layout.header-height;
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
|
||||
// Responsive breakpoints.
|
||||
property <bool> show-tab-icons: root.width >= 1140px;
|
||||
|
||||
@@ -23,7 +23,7 @@ import { IconButton } from "../primitives/BarControls.slint";
|
||||
import { LoadingSpinner } from "../primitives/LoadingSpinner.slint";
|
||||
import { LyricsLinesView } from "LyricsLinesView.slint";
|
||||
import { LyricsControlsPanel } from "LyricsControlsFlyout.slint";
|
||||
import { ShellState, LyricsState, ArtworkActions } from "../state.slint";
|
||||
import { ShellState, LyricsState, ArtworkActions, AppearanceState } from "../state.slint";
|
||||
|
||||
component CloseButton inherits Rectangle {
|
||||
callback clicked();
|
||||
@@ -53,7 +53,9 @@ export component LyricsSidebar inherits Rectangle {
|
||||
// Width is owned by the right-panel column in AppShell; this fills it and
|
||||
// vertical-stretches to its share of the height (stacked under the queue).
|
||||
clip: true;
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
|
||||
// Conditionally mounted (`if lyrics-open` at the AppShell mount site,
|
||||
// ADR-010) — re-request lyrics for the current track on every open.
|
||||
|
||||
@@ -127,7 +127,9 @@ export component PlayerBar inherits Rectangle {
|
||||
// stateful ShellState — avoiding an import direction that would couple
|
||||
// foundation to state.
|
||||
height: ShellState.npb-mode == 2 ? Layout.header-height : Layout.player-bar-height;
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
|
||||
// Responsive column zones. The song-card (left) and the buttons (right)
|
||||
// share the SAME fraction so they are symmetric — which makes the centre
|
||||
|
||||
@@ -127,7 +127,9 @@ export component PlayerBarSmall inherits Rectangle {
|
||||
// One bar, header-height tall: a 3px top seekbar strip + the controls row
|
||||
// that fills the rest (no band bump — the large album art defines the height).
|
||||
height: Layout.header-height;
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
|
||||
// Responsive side fraction — IDENTICAL to PlayerBar's New mechanism
|
||||
// (PlayerBar.slint:138-140). LEFT and RIGHT columns share this fraction so
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Radius } from "../foundation/radius.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { ContextMenu } from "../primitives/ContextMenu.slint";
|
||||
import { ContextMenuItem } from "../primitives/ContextMenuItem.slint";
|
||||
import { ShellState, QueueState, QueueItem, NowPlayingState, UiFocusState, SleepTimerState, SleepTimerActions } from "../state.slint";
|
||||
import { ShellState, QueueState, QueueItem, NowPlayingState, UiFocusState, SleepTimerState, SleepTimerActions, AppearanceState } from "../state.slint";
|
||||
|
||||
// Close button — mirrors the X control used by LyricsSidebar.
|
||||
component CloseButton inherits Rectangle {
|
||||
@@ -360,7 +360,9 @@ export component QueueSidebar inherits Rectangle {
|
||||
// Width is owned by the right-panel column in AppShell (which animates it);
|
||||
// this fills that column and vertical-stretches to its share of the height.
|
||||
clip: true;
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
|
||||
// True when the Queue tab has nothing to show at all.
|
||||
property <bool> queue-empty:
|
||||
|
||||
@@ -685,7 +685,9 @@ export component Sidebar inherits Rectangle {
|
||||
callback navigate(string /* route */);
|
||||
// Three-state rendered width: 0 (closed) / 64 (mini) / 240 (open).
|
||||
width: ShellState.sidebar-rendered-width;
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
// Square edges — the bezel lives on the inset content panel, not here.
|
||||
// Clip keeps content from spilling while the width animates.
|
||||
clip: true;
|
||||
@@ -899,7 +901,9 @@ export component Sidebar inherits Rectangle {
|
||||
y: 26px;
|
||||
width: 200px;
|
||||
Rectangle {
|
||||
background: Theme.surface-card;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-card.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-card;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border-subtle;
|
||||
border-radius: 8px;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { NowPlayingState, VisualizerState, ImmersiveState, ShellState } from "../state.slint";
|
||||
import { NowPlayingState, VisualizerState, ImmersiveState, ShellState, AppearanceState } from "../state.slint";
|
||||
|
||||
// One spectrum bar that grows UP from the bottom edge. Amplitude (0..1) is
|
||||
// already smoothed + clamped in Rust; only a short ease settles the step.
|
||||
@@ -190,7 +190,9 @@ export component SidebarNowPlayingDock inherits Rectangle {
|
||||
drop-shadow-blur: 24px;
|
||||
drop-shadow-color: #00000080;
|
||||
drop-shadow-offset-y: 4px;
|
||||
background: Theme.surface-main;
|
||||
background: ShellState.app-background-active
|
||||
? Theme.surface-main.with-alpha(AppearanceState.app-background-surface-alpha)
|
||||
: Theme.surface-main;
|
||||
|
||||
if NowPlayingState.has-track
|
||||
&& (NowPlayingState.artwork-large.width > 0 || NowPlayingState.artwork.width > 0): Image {
|
||||
|
||||
@@ -3236,6 +3236,25 @@ export global AppearanceState {
|
||||
in-out property <bool> immersive-panels-collapsed: true;
|
||||
in-out property <bool> immersive-fps-collapsed: true;
|
||||
|
||||
// --- APP-WIDE DYNAMIC BACKGROUND ("modo Cider") ------------------------
|
||||
// Album-art background composited behind the WHOLE shell. Opt-in, wgpu-tier
|
||||
// only. 0 = Off, 1 = Ambient (GPU shader scene 7), 2 = Blurred art (the
|
||||
// ImmersiveAtmosphere blurred-cover look). Persisted in ui_prefs
|
||||
// (`app_background`) via appearance-select("app-background", i).
|
||||
in-out property <[string]> app-background-modes: [@tr("Off"), @tr("Ambient"), @tr("Blurred art")];
|
||||
in-out property <int> app-background-mode-index: 0;
|
||||
// False on the femtovg-GL / software tiers (no wgpu underlay, and
|
||||
// reduce-motion is forced ON there → the effect would freeze). Seeded from
|
||||
// Rust (= use_gpu_renderer); gates the whole picker row.
|
||||
in-out property <bool> app-background-available: false;
|
||||
// Live-tunable look knobs, seeded from Rust env at startup (QBZ_BG_DIM /
|
||||
// QBZ_BG_SURFACE_ALPHA) so the appearance can be dialed in a single smoke
|
||||
// session without recompiling, then baked to constants. `dim` = extra dark
|
||||
// scrim over the background for legibility; `surface-alpha` = translucency
|
||||
// of the shell chrome when the background is active.
|
||||
in-out property <float> app-background-dim: 0.28;
|
||||
in-out property <float> app-background-surface-alpha: 0.55;
|
||||
|
||||
// Callbacks. Unwired in this replica — the Rust side may bind them
|
||||
// later. Kept generic (key + value) so the controller can dispatch.
|
||||
callback appearance-bool(string /* key */, bool /* value */);
|
||||
@@ -3965,6 +3984,16 @@ export global ShellState {
|
||||
// "viz-toggle"). When off, the spectrum band collapses and the sidebar
|
||||
// content reclaims the space; the FFT tap idles (AppShell viz-should-run).
|
||||
in-out property <bool> large-visualizer-on: true;
|
||||
|
||||
// --- APP-WIDE DYNAMIC BACKGROUND (derived) -----------------------------
|
||||
// Active only when a mode is picked, the wgpu tier allows it, AND a track is
|
||||
// loaded — so with nothing playing the shell restores its opaque theme
|
||||
// surfaces (D4). Shell chrome reads this to go translucent; AppShell reads
|
||||
// it to mount the background layer.
|
||||
out property <bool> app-background-active:
|
||||
AppearanceState.app-background-mode-index > 0
|
||||
&& AppearanceState.app-background-available
|
||||
&& NowPlayingState.has-track;
|
||||
}
|
||||
|
||||
// Authenticated user, for the header user element.
|
||||
@@ -4054,6 +4083,14 @@ export global ImmersiveState {
|
||||
// 0->1->2->3->0 with the 'g' key.
|
||||
in property <image> shader-texture;
|
||||
in-out property <int> shader-mode: 0;
|
||||
// App-wide dynamic-background scene selector, kept SEPARATE from
|
||||
// `shader-mode` so opening the immersive overlay (which force-resets
|
||||
// shader-mode to 0 in main.rs) does NOT clobber the app-wide background.
|
||||
// 0 = none, 7 = Ambient (ui/shaders/ambient.wgsl). The drain renders this
|
||||
// scene into `shader-texture` when the immersive overlay is CLOSED (see
|
||||
// visualizer.rs); the AppShell root Image binds the same `shader-texture`.
|
||||
// Derived: Ambient (mode 1) → 7, everything else → 0. No Rust setter needed.
|
||||
out property <int> app-shader-mode: AppearanceState.app-background-mode-index == 1 ? 7 : 0;
|
||||
// False on the femtovg-GL / software renderer tiers (no wgpu underlay →
|
||||
// shader scenes would render black). Seeded from Rust at startup; gates
|
||||
// the picker rows and the `g` cycle in ImmersiveView.
|
||||
|
||||
@@ -4124,6 +4124,11 @@ fn reseed_i18n_labels(window: &AppWindow) {
|
||||
t("Lyrics"),
|
||||
t("Queue"),
|
||||
])));
|
||||
state.set_app_background_modes(ModelRc::new(VecModel::from(vec![
|
||||
t("Off"),
|
||||
t("Ambient"),
|
||||
t("Blurred art"),
|
||||
])));
|
||||
state.set_wc_positions(ModelRc::new(VecModel::from(vec![t("Left"), t("Right")])));
|
||||
state.set_wc_styles(ModelRc::new(VecModel::from(vec![
|
||||
t("Rectangular"),
|
||||
@@ -7170,6 +7175,28 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
window
|
||||
.global::<ImmersiveState>()
|
||||
.set_shader_scenes_available(use_gpu_renderer);
|
||||
// App-wide dynamic background ("modo Cider"): available only on the wgpu
|
||||
// tier (same reason as the shader scenes — it would render black on
|
||||
// GL/software where reduce-motion is forced on). Gates the whole picker row.
|
||||
{
|
||||
let ap = window.global::<AppearanceState>();
|
||||
ap.set_app_background_available(use_gpu_renderer);
|
||||
// Live-tunable look knobs (QBZ_BG_DIM / QBZ_BG_SURFACE_ALPHA in [0,1])
|
||||
// so the appearance can be dialed in ONE smoke session without a rebuild,
|
||||
// then baked to the defaults in state.slint.
|
||||
if let Some(f) = std::env::var("QBZ_BG_DIM")
|
||||
.ok()
|
||||
.and_then(|v| v.trim().parse::<f32>().ok())
|
||||
{
|
||||
ap.set_app_background_dim(f.clamp(0.0, 1.0));
|
||||
}
|
||||
if let Some(f) = std::env::var("QBZ_BG_SURFACE_ALPHA")
|
||||
.ok()
|
||||
.and_then(|v| v.trim().parse::<f32>().ok())
|
||||
{
|
||||
ap.set_app_background_surface_alpha(f.clamp(0.0, 1.0));
|
||||
}
|
||||
}
|
||||
// Kiosk profile (2.0.2 frente #3, axis A): QBZ_PROFILE=kiosk (env wins,
|
||||
// else the persisted ui_prefs.profile key). The small-panel touch appliance
|
||||
// boots the main window fullscreen and forces reduce-motion; the kiosk image
|
||||
@@ -7389,6 +7416,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
&crate::ui_prefs::load().immersive_default_view,
|
||||
),
|
||||
);
|
||||
// App-wide dynamic background mode (0 = off, 1 = ambient, 2 = blurred).
|
||||
window.global::<AppearanceState>().set_app_background_mode_index(
|
||||
crate::ui_prefs::app_background_index(&crate::ui_prefs::load().app_background),
|
||||
);
|
||||
// System Notifications toggle: seed the UI + the poll-thread atomic gate.
|
||||
{
|
||||
let sys_notif = crate::ui_prefs::load().system_notifications;
|
||||
@@ -9802,6 +9833,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
crate::ui_prefs::immersive_default_view_for_index(index).to_string();
|
||||
crate::ui_prefs::save(&prefs);
|
||||
}
|
||||
"app-background" => {
|
||||
// 0 = Off, 1 = Ambient (GPU shader), 2 = Blurred art. The Slint
|
||||
// side already flipped app-background-mode-index; app-shader-mode
|
||||
// and app-background-active derive from it, and the AppShell
|
||||
// viz-should-run recompute starts/stops the drain reactively.
|
||||
let mut prefs = crate::ui_prefs::load();
|
||||
prefs.app_background =
|
||||
crate::ui_prefs::app_background_for_index(index).to_string();
|
||||
crate::ui_prefs::save(&prefs);
|
||||
}
|
||||
"miniplayer-view" => {
|
||||
// 0 = Remember last, 1-5 = micro / compact / artwork / queue /
|
||||
// lyrics. The miniplayer reads this key on open (miniplayer.rs).
|
||||
|
||||
@@ -333,6 +333,7 @@ const SHADER_SOURCES: &[&str] = &[
|
||||
include_str!("../../qbz-ui/ui/shaders/aurora.wgsl"), // [2] mode 3
|
||||
include_str!("../../qbz-ui/ui/shaders/spectral_ribbon.wgsl"), // [3] mode 4
|
||||
include_str!("../../qbz-ui/ui/shaders/liquid_spectrum.wgsl"), // [4] mode 6
|
||||
include_str!("../../qbz-ui/ui/shaders/ambient.wgsl"), // [5] mode 7 (app-wide)
|
||||
];
|
||||
|
||||
thread_local! {
|
||||
@@ -812,9 +813,16 @@ pub fn render_frame(mode: i32, a: &FrameAudio, win_w: u32, win_h: u32) -> Option
|
||||
}
|
||||
res.linebed_pipeline.as_ref()?
|
||||
} else {
|
||||
// modes 1-4 → pipelines[0..3]; mode 6 (liquid spectrum) → pipelines[4].
|
||||
// mode 5 is line_bed's own pipeline above, so the index skips it.
|
||||
let idx = if mode == 6 { 4 } else { (mode - 1) as usize };
|
||||
// modes 1-4 → pipelines[0..3]; mode 6 (liquid spectrum) → pipelines[4];
|
||||
// mode 7 (ambient, app-wide) → pipelines[5]. mode 5 is line_bed's own
|
||||
// pipeline above, so the index skips it.
|
||||
let idx = if mode == 6 {
|
||||
4
|
||||
} else if mode == 7 {
|
||||
5
|
||||
} else {
|
||||
(mode - 1) as usize
|
||||
};
|
||||
let idx = if idx < SHADER_SOURCES.len() { idx } else { 0 };
|
||||
if res.pipelines[idx].is_none() {
|
||||
res.pipelines[idx] =
|
||||
|
||||
@@ -144,6 +144,10 @@ pub fn immersive_search_action_index(key: &str) -> i32 {
|
||||
/// was open last time; the other keys PIN a fixed FOCUS-mode foreground.
|
||||
pub const DEFAULT_IMMERSIVE_DEFAULT_VIEW: &str = "remember";
|
||||
|
||||
/// Default app-wide dynamic background: "off". Other keys: "ambient" (GPU
|
||||
/// shader scene, wgpu tier only) | "blurred" (blurred-artwork atmosphere).
|
||||
pub const DEFAULT_APP_BACKGROUND: &str = "off";
|
||||
|
||||
/// Map an immersive-default-view select index to its persisted key. The
|
||||
/// on-screen order is Remember last / Album Reactive / Static / Coverflow /
|
||||
/// Spectrum / Lyrics / Queue (0-6); any unknown index falls back to the
|
||||
@@ -299,6 +303,29 @@ pub fn immersive_default_view_index(key: &str) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
/// Map an app-background select index to its persisted key. On-screen order is
|
||||
/// Off / Ambient / Blurred (0-2); any unknown index falls back to the default
|
||||
/// (`"off"`).
|
||||
pub fn app_background_for_index(index: i32) -> &'static str {
|
||||
match index {
|
||||
0 => "off",
|
||||
1 => "ambient",
|
||||
2 => "blurred",
|
||||
_ => DEFAULT_APP_BACKGROUND,
|
||||
}
|
||||
}
|
||||
|
||||
/// Inverse of [`app_background_for_index`]: the select index for a persisted
|
||||
/// key, falling back to the default's index (0 = "off").
|
||||
pub fn app_background_index(key: &str) -> i32 {
|
||||
match key {
|
||||
"off" => 0,
|
||||
"ambient" => 1,
|
||||
"blurred" => 2,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
||||
/// Persisted UI preferences. New fields must default sanely so an older
|
||||
/// file (missing the field) still deserializes.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -449,6 +476,11 @@ pub struct UiPrefs {
|
||||
/// `"queue"` pins a fixed FOCUS view. See [`DEFAULT_IMMERSIVE_DEFAULT_VIEW`].
|
||||
#[serde(default = "default_immersive_default_view")]
|
||||
pub immersive_default_view: String,
|
||||
/// App-wide dynamic background key: `"off"` (none) | `"ambient"` (GPU shader
|
||||
/// scene, wgpu tier only) | `"blurred"` (blurred-artwork atmosphere). See
|
||||
/// [`DEFAULT_APP_BACKGROUND`].
|
||||
#[serde(default = "default_app_background")]
|
||||
pub app_background: String,
|
||||
/// Last immersive view-mode (0 FOCUS / 1 SPLIT), persisted only while the
|
||||
/// default is `"remember"`; restored on the next overlay open.
|
||||
#[serde(default)]
|
||||
@@ -674,6 +706,10 @@ fn default_immersive_default_view() -> String {
|
||||
DEFAULT_IMMERSIVE_DEFAULT_VIEW.to_string()
|
||||
}
|
||||
|
||||
fn default_app_background() -> String {
|
||||
DEFAULT_APP_BACKGROUND.to_string()
|
||||
}
|
||||
|
||||
/// Default theme slug. Owner decision 2026-06-20: OLED Dark is the default for
|
||||
/// fresh installs and any profile without a persisted theme. Sourced from the
|
||||
/// `qbz-theme` registry so the default stays single-sourced.
|
||||
@@ -723,6 +759,7 @@ impl Default for UiPrefs {
|
||||
last_nav: None,
|
||||
immersive_search_action: default_immersive_search_action(),
|
||||
immersive_default_view: default_immersive_default_view(),
|
||||
app_background: default_app_background(),
|
||||
immersive_last_view_mode: 0,
|
||||
immersive_last_mode: 0,
|
||||
immersive_last_split_panel: 0,
|
||||
|
||||
@@ -189,8 +189,18 @@ pub fn install(window: &AppWindow, runtime: &Arc<AppRuntime<SlintAdapter>>) {
|
||||
last_beat *= 0.88;
|
||||
if let Some(w) = weak.upgrade() {
|
||||
let imm = w.global::<ImmersiveState>();
|
||||
let m = imm.get_shader_mode();
|
||||
if m > 0 && imm.get_open() {
|
||||
// When the immersive overlay is OPEN, its picked `shader-mode`
|
||||
// drives the scene; when CLOSED, the app-wide dynamic background's
|
||||
// `app-shader-mode` does (7 = ambient) — kept separate so opening
|
||||
// immersive (which force-resets shader-mode to 0) never clobbers
|
||||
// the app-wide background. Both render into the same texture sink.
|
||||
let open = imm.get_open();
|
||||
let m = if open {
|
||||
imm.get_shader_mode()
|
||||
} else {
|
||||
imm.get_app_shader_mode()
|
||||
};
|
||||
if m > 0 {
|
||||
// Derive the enriched audio pack from the latched cells.
|
||||
let mut bands8 = [0.0f32; 8];
|
||||
for i in 0..8 {
|
||||
|
||||
Reference in new issue
Block a user