diff --git a/src/handlers/album_list.rs b/src/handlers/album_list.rs index 5a00244d..f4923f18 100644 --- a/src/handlers/album_list.rs +++ b/src/handlers/album_list.rs @@ -51,8 +51,8 @@ pub fn handler(key: Key, app: &mut App) { }; } } - Key::Ctrl('d') => app.get_current_user_saved_albums_next(), - Key::Ctrl('u') => app.get_current_user_saved_albums_previous(), + k if k == app.user_config.keys.next_page => app.get_current_user_saved_albums_next(), + k if k == app.user_config.keys.previous_page => app.get_current_user_saved_albums_previous(), Key::Char('D') => app.current_user_saved_album_delete(ActiveBlock::AlbumList), _ => {} }; diff --git a/src/handlers/home.rs b/src/handlers/home.rs index 470b9c24..15546fac 100644 --- a/src/handlers/home.rs +++ b/src/handlers/home.rs @@ -15,10 +15,10 @@ pub fn handler(key: Key, app: &mut App) { app.home_scroll -= SMALL_SCROLL; } } - Key::Ctrl('d') => { + k if k == app.user_config.keys.next_page => { app.home_scroll += LARGE_SCROLL; } - Key::Ctrl('u') => { + k if k == app.user_config.keys.previous_page => { if app.home_scroll > LARGE_SCROLL { app.home_scroll -= LARGE_SCROLL; } else { diff --git a/src/handlers/track_table.rs b/src/handlers/track_table.rs index e86f4ca7..5cfb1b76 100644 --- a/src/handlers/track_table.rs +++ b/src/handlers/track_table.rs @@ -40,7 +40,7 @@ pub fn handler(key: Key, app: &mut App) { on_enter(app); } // Scroll down - Key::Ctrl('d') => { + k if k == app.user_config.keys.next_page => { match &app.track_table.context { Some(context) => match context { TrackTableContext::MyPlaylists => { @@ -93,7 +93,7 @@ pub fn handler(key: Key, app: &mut App) { }; } // Scroll up - Key::Ctrl('u') => { + k if k == app.user_config.keys.previous_page => { match &app.track_table.context { Some(context) => match context { TrackTableContext::MyPlaylists => { @@ -143,8 +143,8 @@ pub fn handler(key: Key, app: &mut App) { } Key::Char('s') => handle_save_track_event(app), Key::Char('S') => play_random_song(app), - Key::Ctrl('e') => jump_to_end(app), - Key::Ctrl('a') => jump_to_start(app), + k if k == app.user_config.keys.jump_to_end => jump_to_end(app), + k if k == app.user_config.keys.jump_to_start => jump_to_start(app), //recommended song radio Key::Char('r') => { handle_recommended_tracks(app); diff --git a/src/user_config.rs b/src/user_config.rs index 36b58484..a7301674 100644 --- a/src/user_config.rs +++ b/src/user_config.rs @@ -142,6 +142,10 @@ pub struct UserConfigPaths { #[derive(Default, Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct KeyBindingsString { back: Option, + next_page: Option, + previous_page: Option, + jump_to_start: Option, + jump_to_end: Option, jump_to_album: Option, jump_to_artist_album: Option, jump_to_context: Option, @@ -167,6 +171,10 @@ pub struct KeyBindingsString { #[derive(Clone)] pub struct KeyBindings { pub back: Key, + pub next_page: Key, + pub previous_page: Key, + pub jump_to_start: Key, + pub jump_to_end: Key, pub jump_to_album: Key, pub jump_to_artist_album: Key, pub jump_to_context: Key, @@ -226,6 +234,10 @@ impl UserConfig { theme: Default::default(), keys: KeyBindings { back: Key::Char('q'), + next_page: Key::Ctrl('d'), + previous_page: Key::Ctrl('u'), + jump_to_start: Key::Ctrl('a'), + jump_to_end: Key::Ctrl('e'), jump_to_album: Key::Char('a'), jump_to_artist_album: Key::Char('A'), jump_to_context: Key::Char('o'), @@ -295,6 +307,10 @@ impl UserConfig { }; to_keys!(back); + to_keys!(next_page); + to_keys!(previous_page); + to_keys!(jump_to_start); + to_keys!(jump_to_end); to_keys!(jump_to_album); to_keys!(jump_to_artist_album); to_keys!(jump_to_context);