Krolyxon
Commit 66a1cfc

rmptui66a1cfc

have queue list as primary widget

Author
krolxon
Date
2024-04-28 23:36 +0530
Parent
fb06907
Commit
66a1cfccf46acc505c04dc4048d1a0ef6f8cbeea

+15 −19

3 files changed

  1. M README.md +7 −7
  2. M src/app.rs +4 −4
  3. M src/handler.rs +4 −8
M README.md View
@@ -10,15 +10,15 @@ A MPD client in Rust
1010 - `+` to increase volume
1111 - `-` to decrease volume
1212 - `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
1717 - `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
2020 - `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
2222 - `a` to append the song to current playing queue
2323 - `Space`/`BackSpace` to delete the highlighted song from queue
2424 - `f` to go forwards
M src/app.rs View
@@ -52,7 +52,7 @@ impl App {
5252 conn,
5353 queue_list,
5454 pl_list,
55− selected_tab: SelectedTab::DirectoryBrowser,
55+ selected_tab: SelectedTab::Queue,
5656 browser,
5757 inputmode: InputMode::Normal,
5858 search_input: String::new(),
@@ -158,9 +158,9 @@ impl App {
158158
159159 pub fn cycle_tabls(&mut self) {
160160 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,
164164 };
165165 }
166166
M src/handler.rs View
@@ -183,7 +183,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
183183 },
184184
185185 // Next directory
186− KeyCode::Enter | KeyCode::Char('l') => {
186+ KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => {
187187 // app.update_queue();
188188
189189 match app.selected_tab {
@@ -204,7 +204,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
204204 }
205205
206206 // head back to previous directory
207− KeyCode::Char('h') => match app.selected_tab {
207+ KeyCode::Char('h') | KeyCode::Left => match app.selected_tab {
208208 SelectedTab::DirectoryBrowser => {
209209 app.browser.handle_go_back(&mut app.conn)?;
210210 }
@@ -237,10 +237,6 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
237237 // add to queue
238238 KeyCode::Char('a') => app.playlist_popup = true,
239239
240− KeyCode::Right => {
241− app.conn
242− .load_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?;
243− }
244240
245241 // Fast forward
246242 KeyCode::Char('f') => {
@@ -265,12 +261,12 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
265261
266262 // Directory browser tab
267263 KeyCode::Char('1') => {
268− app.selected_tab = SelectedTab::DirectoryBrowser;
264+ app.selected_tab = SelectedTab::Queue;
269265 }
270266
271267 // Playing queue tab
272268 KeyCode::Char('2') => {
273− app.selected_tab = SelectedTab::Queue;
269+ app.selected_tab = SelectedTab::DirectoryBrowser;
274270 }
275271
276272 // Playlists tab