feat: cycle the queue through track shuffle, album shuffle and off

North on the now-playing screen, or s anywhere, shuffles what has not
played yet. Off goes back to the order the tracks were queued in and
carries on after the playing track. Tracks queued while shuffled go to
random positions, an album as one block under album shuffle.

The player reorders its own list under its lock and keeps a track it
already handed to playbin next, so playback stays gapless. Each reorder
bumps a queue generation that track and picture events carry, and the
app drops an event sent before the last reorder. The saved queue keeps
the original order and the mode; older files load unshuffled.
This commit is contained in:
Ansho Rei
2026-11-05 18:57:56 +01:00
parent 7b2fe7c84e
commit 3d91739447
8 changed files with 356 additions and 45 deletions
+10 -1
View File
@@ -35,6 +35,9 @@ pub enum Control {
Seek,
Volume,
Mute,
/// Cycles the shuffle mode on now playing: the queue button on a
/// controller, a key of its own on the keyboard.
Shuffle,
/// Steam + X brings up Steam's on-screen keyboard. Nothing to show for a
/// real keyboard.
OnScreenKeyboard,
@@ -42,7 +45,7 @@ pub enum Control {
#[cfg(test)]
impl Control {
pub const ALL: [Control; 12] = [
pub const ALL: [Control; 13] = [
Control::Activate,
Control::Back,
Control::PlayPause,
@@ -54,6 +57,7 @@ impl Control {
Control::Seek,
Control::Volume,
Control::Mute,
Control::Shuffle,
Control::OnScreenKeyboard,
];
}
@@ -81,6 +85,7 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Seek => &[icon!("keyboard", "keyboard_arrows_horizontal")],
Volume => &[icon!("keyboard", "keyboard_minus"), icon!("keyboard", "keyboard_plus")],
Mute => &[icon!("keyboard", "keyboard_m")],
Shuffle => &[icon!("keyboard", "keyboard_s")],
OnScreenKeyboard => &[],
},
Prompts::Pad(Family::Xbox) => match control {
@@ -88,6 +93,7 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Back => &[icon!("xbox", "xbox_button_color_b")],
PlayPause => &[icon!("xbox", "xbox_button_color_x")],
Queue => &[icon!("xbox", "xbox_button_color_y")],
Shuffle => &[icon!("xbox", "xbox_button_color_y")],
Skip => &[icon!("xbox", "xbox_lb"), icon!("xbox", "xbox_rb")],
Sections => &[icon!("xbox", "xbox_lt"), icon!("xbox", "xbox_rt")],
Search => &[icon!("xbox", "xbox_button_view")],
@@ -102,6 +108,7 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Back => &[icon!("playstation", "playstation_button_color_circle")],
PlayPause => &[icon!("playstation", "playstation_button_color_square")],
Queue => &[icon!("playstation", "playstation_button_color_triangle")],
Shuffle => &[icon!("playstation", "playstation_button_color_triangle")],
Skip => &[
icon!("playstation", "playstation_trigger_l1"),
icon!("playstation", "playstation_trigger_r1"),
@@ -127,6 +134,7 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Back => &[icon!("switch", "switch_button_a")],
PlayPause => &[icon!("switch", "switch_button_y")],
Queue => &[icon!("switch", "switch_button_x")],
Shuffle => &[icon!("switch", "switch_button_x")],
Skip => &[icon!("switch", "switch_button_l"), icon!("switch", "switch_button_r")],
Sections => &[icon!("switch", "switch_button_zl"), icon!("switch", "switch_button_zr")],
Search => &[icon!("switch", "switch_button_minus")],
@@ -144,6 +152,7 @@ pub fn icons(prompts: Prompts, control: Control) -> &'static [&'static [u8]] {
Back => &[icon!("steamdeck", "steamdeck_button_b")],
PlayPause => &[icon!("steamdeck", "steamdeck_button_x")],
Queue => &[icon!("steamdeck", "steamdeck_button_y")],
Shuffle => &[icon!("steamdeck", "steamdeck_button_y")],
Skip => &[
icon!("steamdeck", "steamdeck_button_l1"),
icon!("steamdeck", "steamdeck_button_r1"),