[GH-ISSUE #523] Remap / rebind keymap to action #1235

Closed
opened 2026-03-14 14:02:42 +03:00 by kerem · 7 comments
Owner

Originally created by @arouene on GitHub (Jul 29, 2024).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/523

Describe the bug
It does not seem possible to remap a kemap (like C-p which is bind to "SelectPreviousOrScrollUp") to an action (like "AddToPlaylist").

To Reproduce
I have this keymap.toml

[[keymaps]]
command = "SelectPreviousOrScrollUp"
key_sequence = "k"

[[actions]]
action = "AddToPlaylist"
key_sequence = "C-p"

Expected behaviour
SelectPreviousOrScrollUp is k
AddToPlaylist is C-p

Environment

  • OS: Linux Fedora 40
  • Application version: 0.19.1
Originally created by @arouene on GitHub (Jul 29, 2024). Original GitHub issue: https://github.com/aome510/spotify-player/issues/523 **Describe the bug** It does not seem possible to remap a kemap (like C-p which is bind to "SelectPreviousOrScrollUp") to an action (like "AddToPlaylist"). **To Reproduce** I have this **keymap.toml** ``` [[keymaps]] command = "SelectPreviousOrScrollUp" key_sequence = "k" [[actions]] action = "AddToPlaylist" key_sequence = "C-p" ``` **Expected behaviour** SelectPreviousOrScrollUp is k AddToPlaylist is C-p **Environment** - OS: Linux Fedora 40 - Application version: 0.19.1
kerem 2026-03-14 14:02:42 +03:00
Author
Owner

@arouene commented on GitHub (Jul 29, 2024):

Besides, why do we make a difference between a keymap and an action?

<!-- gh-comment-id:2257034088 --> @arouene commented on GitHub (Jul 29, 2024): Besides, why do we make a difference between a keymap and an action?
Author
Owner

@aome510 commented on GitHub (Jul 29, 2024):

Besides, why do we make a difference between a keymap and an action?

I think you mean command and action. The difference is that action performs on a specific item (input) while command is supposed to be a general operation w/o input.

<!-- gh-comment-id:2257046076 --> @aome510 commented on GitHub (Jul 29, 2024): > Besides, why do we make a difference between a keymap and an action? I think you mean `command` and `action`. The difference is that `action` performs on a specific item (input) while `command` is supposed to be a general operation w/o input.
Author
Owner

@arouene commented on GitHub (Jul 29, 2024):

Oh ok, I see, thank you !

<!-- gh-comment-id:2257049009 --> @arouene commented on GitHub (Jul 29, 2024): Oh ok, I see, thank you !
Author
Owner

@aome510 commented on GitHub (Jul 29, 2024):

You can bind C-p to an action by binding C-p to command = "None" to allow re-use the key.

<!-- gh-comment-id:2257049367 --> @aome510 commented on GitHub (Jul 29, 2024): You can bind `C-p` to an action by binding `C-p` to `command = "None"` to allow re-use the key.
Author
Owner

@arouene commented on GitHub (Jul 29, 2024):

I did try that, but then C-p is just not bind to anything

[[keymaps]]
command = "SelectPreviousOrScrollUp"
key_sequence = "k"

[[keymaps]]
command = "None"
key_sequence = "C-p"

[[actions]]
action = "AddToPlaylist"
key_sequence = "C-p"
<!-- gh-comment-id:2257051942 --> @arouene commented on GitHub (Jul 29, 2024): I did try that, but then C-p is just not bind to anything ``` [[keymaps]] command = "SelectPreviousOrScrollUp" key_sequence = "k" [[keymaps]] command = "None" key_sequence = "C-p" [[actions]] action = "AddToPlaylist" key_sequence = "C-p" ```
Author
Owner

@aome510 commented on GitHub (Jul 29, 2024):

I see, then it's bug that doesn't allow to re-use None command. It should be easy to update github.com/aome510/spotify-player@58a5ace777/spotify_player/src/config/keymap.rs (L416) to ignore None command.

<!-- gh-comment-id:2257056157 --> @aome510 commented on GitHub (Jul 29, 2024): I see, then it's bug that doesn't allow to re-use `None` command. It should be easy to update https://github.com/aome510/spotify-player/blob/58a5ace777293ed04fb0da44075a27d777822501/spotify_player/src/config/keymap.rs#L416 to ignore `None` command.
Author
Owner

@arouene commented on GitHub (Jul 29, 2024):

Fixed in PR

<!-- gh-comment-id:2257147142 --> @arouene commented on GitHub (Jul 29, 2024): Fixed in PR
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#1235
No description provided.