[GH-ISSUE #129] Option to remove keybinding from keymap.toml #59

Closed
opened 2026-03-02 23:44:09 +03:00 by kerem · 2 comments
Owner

Originally created by @klotzambein on GitHub (Feb 12, 2023).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/129

Problem Statement

My muscle memory often serves me wrong, and I press 'q' to exit a sub-menu. This is not a huge problem as I can just restart the application, but it is a bit frustrating. Just now I decided to look into the configuration, but it seams that it is not possible to remove/reassign a keybinding. They can only be added.

Possible Solutions

  1. Add some option in the keymap.toml to remove a keybinding. This is probably the most backwards compatible solution, but it would require that the keymap.toml is parsed differently.
  2. Simply remove existing keybindings when they are overridden in the config. Personally, I prefer this as it should be simple to implement. However, there might be some concerns about backwards compatibility with current user's keymaps.

Additional Context

I would be willing to create a PR once this is approved. Overall, I am incredibly happy about having found this spotify player. It fills an old gap in my terminal application ensemble.

Originally created by @klotzambein on GitHub (Feb 12, 2023). Original GitHub issue: https://github.com/aome510/spotify-player/issues/129 ## Problem Statement My muscle memory often serves me wrong, and I press 'q' to exit a sub-menu. This is not a huge problem as I can just restart the application, but it is a bit frustrating. Just now I decided to look into the configuration, but it seams that it is not possible to remove/reassign a keybinding. They can only be [added](https://github.com/aome510/spotify-player/blob/52b1349d4750d7e9671d80456df22948e5a90cfb/spotify_player/src/config/keymap.rs#L264-L270). ## Possible Solutions 1. Add some option in the `keymap.toml` to remove a keybinding. This is probably the most backwards compatible solution, but it would require that the `keymap.toml` is parsed differently. 2. Simply remove existing keybindings when they are overridden in the config. Personally, I prefer this as it should be simple to implement. However, there might be some concerns about backwards compatibility with current user's keymaps. ## Additional Context I would be willing to create a PR once this is approved. Overall, I am incredibly happy about having found this spotify player. It fills an old gap in my terminal application ensemble.
kerem 2026-03-02 23:44:09 +03:00
Author
Owner

@aome510 commented on GitHub (Feb 12, 2023):

Hi @klotzambein, great to hear that you like this project!

They can only be added.

Simply remove existing keybindings when they are overridden in the config. Personally, I prefer this as it should be simple to implement. However, there might be some concerns about backwards compatibility with current user's keymaps.

Actually, I've already implemented the second approach. Prior to the codes that you linked, I did this github.com/aome510/spotify-player@52b1349d47/spotify_player/src/config/keymap.rs (L259)

So, if you add these lines to keymap.toml

[[keymaps]]
command = "ClosePopup"
key_sequence = "q"

"q" should be bind to close popup command. Lmk if you have other questions.

<!-- gh-comment-id:1427089112 --> @aome510 commented on GitHub (Feb 12, 2023): Hi @klotzambein, great to hear that you like this project! > They can only be [added](https://github.com/aome510/spotify-player/blob/52b1349d4750d7e9671d80456df22948e5a90cfb/spotify_player/src/config/keymap.rs#L264-L270). > Simply remove existing keybindings when they are overridden in the config. Personally, I prefer this as it should be simple to implement. However, there might be some concerns about backwards compatibility with current user's keymaps. Actually, I've already implemented the second approach. Prior to the codes that you linked, I did this https://github.com/aome510/spotify-player/blob/52b1349d4750d7e9671d80456df22948e5a90cfb/spotify_player/src/config/keymap.rs#L259 So, if you add these lines to `keymap.toml` ``` [[keymaps]] command = "ClosePopup" key_sequence = "q" ``` "q" should be bind to close popup command. Lmk if you have other questions.
Author
Owner

@klotzambein commented on GitHub (Feb 12, 2023):

Perfect, I missed the swap when looking at the code. Works like a charm now.

<!-- gh-comment-id:1427098726 --> @klotzambein commented on GitHub (Feb 12, 2023): Perfect, I missed the swap when looking at the code. Works like a charm now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#59
No description provided.