diff --git a/psst-gui/src/controller/playback.rs b/psst-gui/src/controller/playback.rs index 38fe0846..a7bf4250 100644 --- a/psst-gui/src/controller/playback.rs +++ b/psst-gui/src/controller/playback.rs @@ -412,11 +412,30 @@ where ctx.set_handled(); } Event::KeyDown(key) if key.code == Code::ArrowRight => { - self.next(); + if key.mods.shift() { + self.next(); + } else { + if let Some(now_playing) = &data.playback.now_playing { + let current_position = now_playing.progress; + let max_position = now_playing.item.duration(); + let seek_position = + (current_position + Duration::from_secs(10)).min(max_position); + self.seek(seek_position); + } + } ctx.set_handled(); } Event::KeyDown(key) if key.code == Code::ArrowLeft => { - self.previous(); + if key.mods.shift() { + self.previous(); + } else { + if let Some(now_playing) = &data.playback.now_playing { + let current_position = now_playing.progress; + let seek_position = + current_position.saturating_sub(Duration::from_secs(10)); + self.seek(seek_position); + } + } ctx.set_handled(); } Event::KeyDown(key) if key.key == KbKey::Character("+".to_string()) => { diff --git a/psst-gui/src/ui/playback.rs b/psst-gui/src/ui/playback.rs index 22cadb36..b238e646 100644 --- a/psst-gui/src/ui/playback.rs +++ b/psst-gui/src/ui/playback.rs @@ -90,29 +90,27 @@ fn playing_item_widget() -> impl Widget { Flex::row() .with_child(cover_art) .with_flex_child( - Flex::row() - .with_spacer(theme::grid(2.0)) - .with_flex_child( - Flex::column() - .cross_axis_alignment(CrossAxisAlignment::Start) - .with_child(name) - .with_spacer(2.0) - .with_child(detail) - .with_spacer(2.0) - .with_child(origin) - .on_click(|ctx, now_playing, _| { - ctx.submit_command(cmd::NAVIGATE.with(now_playing.origin.to_nav())); - }) - .context_menu(|now_playing| match &now_playing.item { - Playable::Track(track) => { - track::track_menu(track, &now_playing.library, &now_playing.origin) - } - Playable::Episode(episode) => { - episode::episode_menu(episode, &now_playing.library) - } - }), - 1.0 - ), + Flex::row().with_spacer(theme::grid(2.0)).with_flex_child( + Flex::column() + .cross_axis_alignment(CrossAxisAlignment::Start) + .with_child(name) + .with_spacer(2.0) + .with_child(detail) + .with_spacer(2.0) + .with_child(origin) + .on_click(|ctx, now_playing, _| { + ctx.submit_command(cmd::NAVIGATE.with(now_playing.origin.to_nav())); + }) + .context_menu(|now_playing| match &now_playing.item { + Playable::Track(track) => { + track::track_menu(track, &now_playing.library, &now_playing.origin) + } + Playable::Episode(episode) => { + episode::episode_menu(episode, &now_playing.library) + } + }), + 1.0, + ), 1.0, ) .with_child(ViewSwitcher::new(