have queue list as primary widget

This commit is contained in:
krolxon 2024-04-28 23:36:01 +05:30
parent fb06907cfe
commit 66a1cfccf4
3 changed files with 15 additions and 19 deletions

View File

@ -10,15 +10,15 @@ A MPD client in Rust
- `+` to increase volume - `+` to increase volume
- `-` to decrease volume - `-` to decrease volume
- `D` to get dmenu prompt - `D` to get dmenu prompt
- `j` to scroll down - `j` OR `Down` to scroll down
- `k` to scroll up - `k` OR `Up` to scroll up
- `l` add song to playlist or go inside the directory - `l` OR `Right` add song to playlist or go inside the directory
- `h` to go back to previous directory - `h` OR `Left` to go back to previous directory
- `Tab` to cycle through tabs - `Tab` to cycle through tabs
- `1` to go to directory tree - `1` to go to queue
- `2` to go to current playing queue - `2` to go to directory browser
- `3` to go to playlists view - `3` to go to playlists view
- `Enter` to add song/playlist to current playlist - `Enter` OR `l` OR `Right` to add song/playlist to current playlist
- `a` to append the song to current playing queue - `a` to append the song to current playing queue
- `Space`/`BackSpace` to delete the highlighted song from queue - `Space`/`BackSpace` to delete the highlighted song from queue
- `f` to go forwards - `f` to go forwards

View File

@ -52,7 +52,7 @@ impl App {
conn, conn,
queue_list, queue_list,
pl_list, pl_list,
selected_tab: SelectedTab::DirectoryBrowser, selected_tab: SelectedTab::Queue,
browser, browser,
inputmode: InputMode::Normal, inputmode: InputMode::Normal,
search_input: String::new(), search_input: String::new(),
@ -158,9 +158,9 @@ impl App {
pub fn cycle_tabls(&mut self) { pub fn cycle_tabls(&mut self) {
self.selected_tab = match self.selected_tab { self.selected_tab = match self.selected_tab {
SelectedTab::DirectoryBrowser => SelectedTab::Queue, SelectedTab::Queue => SelectedTab::DirectoryBrowser,
SelectedTab::Queue => SelectedTab::Playlists, SelectedTab::DirectoryBrowser => SelectedTab::Playlists,
SelectedTab::Playlists => SelectedTab::DirectoryBrowser, SelectedTab::Playlists => SelectedTab::Queue,
}; };
} }

View File

@ -183,7 +183,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
}, },
// Next directory // Next directory
KeyCode::Enter | KeyCode::Char('l') => { KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => {
// app.update_queue(); // app.update_queue();
match app.selected_tab { match app.selected_tab {
@ -204,7 +204,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
} }
// head back to previous directory // head back to previous directory
KeyCode::Char('h') => match app.selected_tab { KeyCode::Char('h') | KeyCode::Left => match app.selected_tab {
SelectedTab::DirectoryBrowser => { SelectedTab::DirectoryBrowser => {
app.browser.handle_go_back(&mut app.conn)?; app.browser.handle_go_back(&mut app.conn)?;
} }
@ -237,10 +237,6 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
// add to queue // add to queue
KeyCode::Char('a') => app.playlist_popup = true, KeyCode::Char('a') => app.playlist_popup = true,
KeyCode::Right => {
app.conn
.load_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?;
}
// Fast forward // Fast forward
KeyCode::Char('f') => { KeyCode::Char('f') => {
@ -265,12 +261,12 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
// Directory browser tab // Directory browser tab
KeyCode::Char('1') => { KeyCode::Char('1') => {
app.selected_tab = SelectedTab::DirectoryBrowser; app.selected_tab = SelectedTab::Queue;
} }
// Playing queue tab // Playing queue tab
KeyCode::Char('2') => { KeyCode::Char('2') => {
app.selected_tab = SelectedTab::Queue; app.selected_tab = SelectedTab::DirectoryBrowser;
} }
// Playlists tab // Playlists tab