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 decrease volume
- `D` to get dmenu prompt
- `j` to scroll down
- `k` to scroll up
- `l` add song to playlist or go inside the directory
- `h` to go back to previous directory
- `j` OR `Down` to scroll down
- `k` OR `Up` to scroll up
- `l` OR `Right` add song to playlist or go inside the directory
- `h` OR `Left` to go back to previous directory
- `Tab` to cycle through tabs
- `1` to go to directory tree
- `2` to go to current playing queue
- `1` to go to queue
- `2` to go to directory browser
- `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
- `Space`/`BackSpace` to delete the highlighted song from queue
- `f` to go forwards

View File

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

View File

@ -183,7 +183,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
},
// Next directory
KeyCode::Enter | KeyCode::Char('l') => {
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => {
// app.update_queue();
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
KeyCode::Char('h') => match app.selected_tab {
KeyCode::Char('h') | KeyCode::Left => match app.selected_tab {
SelectedTab::DirectoryBrowser => {
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
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
KeyCode::Char('f') => {
@ -265,12 +261,12 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
// Directory browser tab
KeyCode::Char('1') => {
app.selected_tab = SelectedTab::DirectoryBrowser;
app.selected_tab = SelectedTab::Queue;
}
// Playing queue tab
KeyCode::Char('2') => {
app.selected_tab = SelectedTab::Queue;
app.selected_tab = SelectedTab::DirectoryBrowser;
}
// Playlists tab