rmptui66a1cfc
have queue list as primary widget
+15 −19
3 files changed
- M README.md +7 −7
- M src/app.rs +4 −4
- M src/handler.rs +4 −8
| @@ -10,15 +10,15 @@ A MPD client in Rust | |||
| 10 | 10 | - `+` to increase volume | |
| 11 | 11 | - `-` to decrease volume | |
| 12 | 12 | - `D` to get dmenu prompt | |
| 13 | − | - `j` to scroll down | |
| 14 | − | - `k` to scroll up | |
| 15 | − | - `l` add song to playlist or go inside the directory | |
| 16 | − | - `h` to go back to previous directory | |
| 13 | + | - `j` OR `Down` to scroll down | |
| 14 | + | - `k` OR `Up` to scroll up | |
| 15 | + | - `l` OR `Right` add song to playlist or go inside the directory | |
| 16 | + | - `h` OR `Left` to go back to previous directory | |
| 17 | 17 | - `Tab` to cycle through tabs | |
| 18 | − | - `1` to go to directory tree | |
| 19 | − | - `2` to go to current playing queue | |
| 18 | + | - `1` to go to queue | |
| 19 | + | - `2` to go to directory browser | |
| 20 | 20 | - `3` to go to playlists view | |
| 21 | − | - `Enter` to add song/playlist to current playlist | |
| 21 | + | - `Enter` OR `l` OR `Right` to add song/playlist to current playlist | |
| 22 | 22 | - `a` to append the song to current playing queue | |
| 23 | 23 | - `Space`/`BackSpace` to delete the highlighted song from queue | |
| 24 | 24 | - `f` to go forwards | |
| @@ -52,7 +52,7 @@ impl App { | |||
| 52 | 52 | conn, | |
| 53 | 53 | queue_list, | |
| 54 | 54 | pl_list, | |
| 55 | − | selected_tab: SelectedTab::DirectoryBrowser, | |
| 55 | + | selected_tab: SelectedTab::Queue, | |
| 56 | 56 | browser, | |
| 57 | 57 | inputmode: InputMode::Normal, | |
| 58 | 58 | search_input: String::new(), | |
| @@ -158,9 +158,9 @@ impl App { | |||
| 158 | 158 | ||
| 159 | 159 | pub fn cycle_tabls(&mut self) { | |
| 160 | 160 | self.selected_tab = match self.selected_tab { | |
| 161 | − | SelectedTab::DirectoryBrowser => SelectedTab::Queue, | |
| 162 | − | SelectedTab::Queue => SelectedTab::Playlists, | |
| 163 | − | SelectedTab::Playlists => SelectedTab::DirectoryBrowser, | |
| 161 | + | SelectedTab::Queue => SelectedTab::DirectoryBrowser, | |
| 162 | + | SelectedTab::DirectoryBrowser => SelectedTab::Playlists, | |
| 163 | + | SelectedTab::Playlists => SelectedTab::Queue, | |
| 164 | 164 | }; | |
| 165 | 165 | } | |
| 166 | 166 | ||
| @@ -183,7 +183,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { | |||
| 183 | 183 | }, | |
| 184 | 184 | ||
| 185 | 185 | // Next directory | |
| 186 | − | KeyCode::Enter | KeyCode::Char('l') => { | |
| 186 | + | KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => { | |
| 187 | 187 | // app.update_queue(); | |
| 188 | 188 | ||
| 189 | 189 | match app.selected_tab { | |
| @@ -204,7 +204,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { | |||
| 204 | 204 | } | |
| 205 | 205 | ||
| 206 | 206 | // head back to previous directory | |
| 207 | − | KeyCode::Char('h') => match app.selected_tab { | |
| 207 | + | KeyCode::Char('h') | KeyCode::Left => match app.selected_tab { | |
| 208 | 208 | SelectedTab::DirectoryBrowser => { | |
| 209 | 209 | app.browser.handle_go_back(&mut app.conn)?; | |
| 210 | 210 | } | |
| @@ -237,10 +237,6 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { | |||
| 237 | 237 | // add to queue | |
| 238 | 238 | KeyCode::Char('a') => app.playlist_popup = true, | |
| 239 | 239 | ||
| 240 | − | KeyCode::Right => { | |
| 241 | − | app.conn | |
| 242 | − | .load_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?; | |
| 243 | − | } | |
| 244 | 240 | ||
| 245 | 241 | // Fast forward | |
| 246 | 242 | KeyCode::Char('f') => { | |
| @@ -265,12 +261,12 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { | |||
| 265 | 261 | ||
| 266 | 262 | // Directory browser tab | |
| 267 | 263 | KeyCode::Char('1') => { | |
| 268 | − | app.selected_tab = SelectedTab::DirectoryBrowser; | |
| 264 | + | app.selected_tab = SelectedTab::Queue; | |
| 269 | 265 | } | |
| 270 | 266 | ||
| 271 | 267 | // Playing queue tab | |
| 272 | 268 | KeyCode::Char('2') => { | |
| 273 | − | app.selected_tab = SelectedTab::Queue; | |
| 269 | + | app.selected_tab = SelectedTab::DirectoryBrowser; | |
| 274 | 270 | } | |
| 275 | 271 | ||
| 276 | 272 | // Playlists tab | |