curseradio
curseradio copied to clipboard
Add Vim-like keybinds
This adds vim-like keybinds in addition to the arrow keys for moving throughout the interface. Since k is used for navigation, I am proposing to use s to stop the stream.
Thank you for contributing, and sorry about the delay - busy week.
This looks good, but I'm a bit wary about changing the meaning of an existing keybinding (and probably one of the more commonly used ones). The basic keymap might not be ideal, but unfortunately it exists now. Possibly this should live under a config option or command line switch, although I'm open to other suggestions.
No worries!
I think a config file would do the trick. It would allow the user to specify their own keybinds, not just vim-like ones.
What are your thoughts?
Yes, a config file would probably work. Doubtless there are other things it can be used for, like the hardcoded OPML root it currently uses.
The xdg
library (pyxdg
on pypi) should let you get the appropriate config dir (~/.config/curseradio
), and either python's configparser or something similar like toml
would work well for config.
Edit: let me have a look at adding a config mechanism myself for the next couple of days, since that's probably slightly out-of-scope of this PR.
Preliminary support for a config file has been added. If you create ~/.config/curseradio/curseradio.cfg
with contents:
[interface]
keymap=vim
[keymap.vim]
up=k
down=j
start=g
end=G
pageup=K
pagedown=J
stop=s
you should get some more vim-familiar behaviour. The config format should probably not be considered stable (input on a better design welcome).
Would be nice to have this merged.
The only changes in this branch seem to be changing the list of keybinding in README.md
, but no changes to code? Do you have something uncommitted or unpushed?
Adding a default set of vim-keybinding should presumably now consist of a mapping in curseradio/curseradio.py CONFIG_DEFAULT['keymap.vim']
(line 35 or so).
Edit: sorry, released that comment is not from the original author. If this pull gets updated to add a (optional) vim keymap, I'm happy to include it.
@chronitis what needs to be done, for this to get merged?