hrkfdn / ncspot

Cross-platform ncurses Spotify client written in Rust, inspired by ncmpc and the likes.
BSD 2-Clause "Simplified" License
4.96k stars 206 forks source link

ESC key to exit search or other "modals" #1391

Open fulldecent opened 8 months ago

fulldecent commented 8 months ago

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

When the search interface is live, requesting that the ESC key will be able to return to the main interface.

Describe alternatives you've considered

Read source code to figure out what other key is needed to exit search and go back to the main page.

Additional context

Entered search using F2.

hrkfdn commented 8 months ago

Hey there! Could you clarify what you mean by main interface? :)

The way it's currently designed is that there are multiple screens (queue, search, library) and those are the top-level views.

fulldecent commented 8 months ago

When you start the program, you get Tracks/Albums/Artists/Playlists/Podcasts/Browse. So effectively this is the main screen.

Then if you do help (?) or search (I forget the key command) it brings you do a different screen.

So it would be nice if pressing escape from either of those would go back to the main screen.

For example, currently if you open help then (I guess) the only way to get out of help is to CTRL-C or q to quit the program and then restart it. Maybe there are other ways, but they were not immediately obvious.

Bettehem commented 8 months ago

You can press Backspace to go back See here: https://github.com/hrkfdn/ncspot/blob/main/doc/users.md#context-menus

scrotty commented 3 months ago

You can have escape perform the same action as backspace by create/adding the following in your nsspot config.toml (for me on mac, that file is in ~/.config/ncspot).

[keybindings]
"Esc" = "back"

Note that this will only result in the escape key backing out of whatever "modal" path you're in. But it will not address your issue where you entered the Search and want to "get back" to the Queue or the Library (whatever "main page" means to you). This is because Queue, Search, and Library are all top-level. You're supposed to switch between them with F1, F2, and F3.

But if you really want to make escape always jump to a top-level section, you can do this in your config:

[keybindings]
"Esc" = "focus queue"
# "Esc" = "focus library"
# "Esc" = "focus search"

A little hacky IMHO, but it mostly works.

(I say mostly because you still have to back out of the Help menu if it's active. Help is a "modal" atop whatever top-level section you're in. So the command above will always move you to whatever top-level you've mapped it to, but that top-level might have the Help menu active.)