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.
This commit is contained in:
Ansho Rei
2026-11-05 19:22:54 +01:00
parent 0200e73ba3
commit 26d8bc417c
2 changed files with 33 additions and 6 deletions
+12
View File
@@ -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);
+21 -6
View File
@@ -1023,6 +1023,8 @@ component NowPlayingView inherits Rectangle {
in property <[Item]> queue;
in property <int> queue-count;
in property <int> queue-selected;
// How the queue is shuffled, empty when it plays in order.
in property <string> 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 <string> np-position;
in property <string> np-duration;
in property <bool> np-paused;
in property <string> np-shuffle;
in property <bool> np-flip-out;
in property <float> np-backdrop-opacity: 0.16;
in property <float> 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); }
}