Dynamically assign/change bindings. #2006
-
I was looking into the possibility of swapping out bindings dynamically. I had found this issue (#1302) but it has been closed and didn't address my use case. I have two cases where I think where I would like to change bindings. Like the previously mentioned issue brought up, it would be nice if there were different modes that a user could swap between like in vim. One way I can think of to get around this is to make several child widget (or maybe screen?) classes with their own bindings that inherit from a parent widget class with the main logic in it. Depending on which mode the user goes into the appropriate widget will render (even if it looks identical to the previous widget). This seems doable but not ideal. The second use case would be to allow a user to set their own keybindings via a config file and hot reload the config. Thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I found the |
Beta Was this translation helpful? Give feedback.
-
I did find that I needed the same bind method on the |
Beta Was this translation helpful? Give feedback.
-
There is an ongoing issue: #1057 (I'm linking to point out that this is another use case) |
Beta Was this translation helpful? Give feedback.
I found the
bind
method on theApp
class which does seem to allow me to remap key binds on the fly.