aome510 / spotify-player

A Spotify player in the terminal with full feature parity
MIT License
3.46k stars 149 forks source link

Remap key to key combination #428

Closed repparw closed 3 months ago

repparw commented 5 months ago

I'm thinking how to bind y to the equivalent of 'a 5'. So, current song, copy link. I think either having it so you can bind to a sequence of commands, or bind a key to a sequence of keys would be nice. Something like [[keymaps]] command = "ShowActionsOnCurrentTrack; CopyTrackLink" key_sequence = "y" or [[keymaps]] command = "a 5" // maybe a different name instead of command? idk key_sequence = "y"

aome510 commented 5 months ago

It's better to define a separate mapping for actions, for example

[[actions]]
action = "GoToTrackRadio"
key = "r"

[[actions]]
action = "AddToLikedTracks"
key = "y"
repparw commented 2 months ago

I just started to take a look at the actions! Nice one. Unfortunately it seems it still doesnt allow to implement the example I gave? I can only for example copy the link of the current selection. I can't do the equivalent of 'a 5' right now. I'd need to go to currently playing context and select the song I'm playing for example and then use the CopyLink action. Unless I'm getting something wrong?

aome510 commented 2 months ago

Unfortunately it seems it still doesnt allow to implement the example I gave? I can only for example copy the link of the current selection. I can't do the equivalent of 'a 5' right now. I'd need to go to currently playing context and select the song I'm playing for example and then use the CopyLink action. Unless I'm getting something wrong?

Yeah, you're right. The current action only works on currently selected item. We can update action keymap to also support currently playing track, which can be configured by a new field ActionType

enum ActionType {
   PlayingTrack
   SelectedItem
}

cc @juliamertz is this something you're interested in working on as a follow-up?

juliamertz commented 2 months ago

cc @juliamertz is this something you're interested in working on as a follow-up?

Doesn't look like this would be too much work, i'll take a look at it when i get some time

aome510 commented 2 months ago

cc @juliamertz is this something you're interested in working on as a follow-up?

Doesn't look like this would be too much work, i'll take a look at it when i get some time

Great, thank you!