darrenburns/posting

Support for navigating by direction and custom keybindings

albinjon opened this issue · 0 comments

Hello!
First off, I love the look and feel of the interface. I'm using the galaxy theme and it's just so beautiful it almost makes me cry.

Just one thing about the navigation, I'm personally very fond of having ctrl+hjkl for moving between splits/panes etc. This interface would be complete for me if there was a possibility to set directional navigation.

I looked into the codebase, to start with just for setting some keybinds since I couldn't find a way to set it in config, but I also wanted to see how the directional nav could be done, and I'm a little puzzled (disclaimer, I'm not very experienced with Python or Textual). It seems to be quite hard with the structure of the screen -> widgets, to get which widget exists in a certain direction, instead of next/prev.

I wanted to just do a hacky solution with get_widget_by_id (and finding the ids by self.walk_children(Widget)), but it turns out that the get_widget_by_id only goes downward in the tree.

Do you have any pointers regarding how such an implementation might be done? I could probably spend some time trying to implement it, not guaranteeing that it will be a great implementation though. Perhaps just point me to relevant documentation, and maybe where you'd see such an addition belonging. And if you don't feel like having such an option, then I'd appreciate if you could help me find a hacky solution that could work so that I can have a local fork and use that. Like just having a fixed layout and focusing by ID:s based on where I am located.

Another thing, I really think it would be nice to have keymaps as an option in the config file. It'd have to be something like:

keymaps:
  main_screen: 
    send_request: ctrl+enter
  url_bar:
    focus_next: down

But I see that it would require quite a bit of work. Same goes there though, I could try implementing that. But a few pointers would probably help, if you've thought about it perhaps.

Thanks for creating a fantastic program!