From 26d8bc417c4e2bb00a941eb292bbd6d70423547d Mon Sep 17 00:00:00 2001 From: Ansho Rei Date: Thu, 5 Nov 2026 19:22:54 +0100 Subject: [PATCH] feat: show the shuffle mode beside the queue on the now-playing screen The hint bar names the mode too, but it can be turned off. --- src/app.rs | 12 ++++++++++++ ui/app.slint | 27 +++++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/app.rs b/src/app.rs index 9376416..0896d75 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1782,7 +1782,18 @@ impl App { }) } + fn render_shuffle(&self) { + let label = match self.shuffle { + _ if self.library.is_some() => "Shuffling the whole library", + Mode::Off => "", + Mode::Tracks => "Shuffled by track", + Mode::Albums => "Shuffled by album", + }; + self.ui.set_np_shuffle(label.into()); + } + fn render_hints(&self) { + self.render_shuffle(); let mut hints = Vec::new(); let mut h = |c: Control, l: &str| { let icons = self.hint_icons(c); @@ -2504,6 +2515,7 @@ impl App { } fn render_player(&mut self) { + self.render_shuffle(); let song = self.current.and_then(|i| self.queue.get(i)).cloned(); self.ui.set_np_has_track(song.is_some()); self.ui.set_np_paused(self.paused); diff --git a/ui/app.slint b/ui/app.slint index 98f059b..f327d72 100644 --- a/ui/app.slint +++ b/ui/app.slint @@ -1023,6 +1023,8 @@ component NowPlayingView inherits Rectangle { in property <[Item]> queue; in property queue-count; in property queue-selected; + // How the queue is shuffled, empty when it plays in order. + in property shuffle; callback queue-clicked(int); callback queue-wheel(int); // From the scale, not our own size: a layout child sized from its parent loops. @@ -1134,12 +1136,23 @@ component NowPlayingView inherits Rectangle { VerticalLayout { spacing: 14px * Theme.s; horizontal-stretch: 1; - Text { - text: "Queue"; - font-size: 28px * Theme.s; - font-family: Theme.serif; - font-weight: 600; - color: Theme.text; + HorizontalLayout { + spacing: 16px * Theme.s; + Text { + text: "Queue"; + font-size: 28px * Theme.s; + font-family: Theme.serif; + font-weight: 600; + color: Theme.text; + } + Text { + horizontal-stretch: 1; + text: root.shuffle; + font-size: 16px * Theme.s; + color: Theme.muted; + vertical-alignment: center; + overflow: elide; + } } ItemView { vertical-stretch: 1; @@ -1232,6 +1245,7 @@ export component AppWindow inherits Window { in property np-position; in property np-duration; in property np-paused; + in property np-shuffle; in property np-flip-out; in property np-backdrop-opacity: 0.16; in property np-backdrop-left: 0.67; @@ -1419,6 +1433,7 @@ export component AppWindow inherits Window { queue: root.queue-items; queue-count: root.queue-count; queue-selected: root.queue-selected; + shuffle: root.np-shuffle; queue-clicked(i) => { root.queue-clicked(i); } queue-wheel(d) => { root.queue-wheel(d); } }