diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-04-24 12:36:33 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-04-24 12:36:33 +0530 |
| commit | bf11d5967fd52453292e8a5a0d9a0c618a03c4ad (patch) | |
| tree | d6825a2a2ed0a87ae5c9810c219966ac743102aa /src/handler.rs | |
| parent | b93eae44822168c0dab821a12fa3ecd62ee4a875 (diff) | |
hmm stuff
Diffstat (limited to 'src/handler.rs')
| -rwxr-xr-x | src/handler.rs | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/handler.rs b/src/handler.rs index 91b5f86..efb8d7f 100755 --- a/src/handler.rs +++ b/src/handler.rs @@ -19,7 +19,9 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { } KeyCode::Enter | KeyCode::Char('l') => { - let song = app.conn.get_song_with_only_filename(app.conn.songs_filenames.get(app.song_list.index).unwrap()); + let song = app.conn.get_song_with_only_filename( + app.conn.songs_filenames.get(app.song_list.index).unwrap(), + ); app.conn.push(&song)?; // app.update_queue(); } @@ -35,7 +37,6 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { app.conn.pause(); } - // Clearn Queue KeyCode::Char('x') => { app.conn.conn.clear()?; @@ -46,31 +47,39 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { app.conn.play_dmenu()?; } - KeyCode::Down=> { - app.pl_list.next(); + KeyCode::Down => { + if key_event.modifiers == KeyModifiers::SHIFT { + app.queue_list.next(); + } else { + app.pl_list.next(); + } } - KeyCode::Up=> { - app.pl_list.prev(); + KeyCode::Up => { + if key_event.modifiers == KeyModifiers::SHIFT { + app.queue_list.prev(); + } else { + app.pl_list.prev(); + } } - KeyCode::Right => { - app.conn.push_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?; + app.conn + .push_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?; } - KeyCode::Char('f')=> { + KeyCode::Char('f') => { // let place = app.conn.conn.status().unwrap().duration; let (pos, _) = app.conn.conn.status().unwrap().time.unwrap(); let pos: i64 = (pos.as_secs() + 2).try_into().unwrap(); - app.conn.conn.seek(2, pos )?; + app.conn.conn.seek(2, pos)?; } - KeyCode::Char('b')=> { + KeyCode::Char('b') => { // let place = app.conn.conn.status().unwrap().duration; let (pos, _) = app.conn.conn.status().unwrap().time.unwrap(); let pos: i64 = (pos.as_secs() - 2).try_into().unwrap(); - app.conn.conn.seek(2, pos )?; + app.conn.conn.seek(2, pos)?; } _ => {} } |
