johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
6.25k stars 289 forks source link

Option to toggle Vim Hotkeys Navigation #1279

Closed leongjs98 closed 6 months ago

leongjs98 commented 6 months ago

I am a web dev and I am interested in opening a pull request to help request with this. Please let me know if you are interested in adding this to Foliate

Is your feature request related to a problem? Please describe. Many people uses Vim and many prefer softwares that allow vim keybindings. One very good example is Vimium browser extension to provide vim-like experience in the browser. Here's a video demo showing the vim hotkeys in browser

With Vimium, it's possible to navigate websites and websites history without leaving the home row (the asdf row). I hope to bring the Vim-like hotkeys to foliate too but (not as complicated as Vimium first).

In the Obsidian editor, there's an option to toggle on the Vim mode. After turning it on, it allows user to navigate using Vim hotkeys.

Describe the solution you'd like I suggest putting an option called "Vim-like Hotkeys". Disabled by default. Toggling it would change all the hotkeys to Vim motion keys.

E.g. left button -> h right button -> l down button -> j up button -> k Page Down -> ctrl + d Page Up -> ctrl + u

Describe alternatives you've considered There's another suggestion of customizable hotkeys in https://github.com/johnfactotum/foliate/issues/773 But it will be a hassle to implement and a bit of an overkill for just vim-like hotkeys.

Additional context Some vim keybinds may collide with other existing keybinds. I have to spend more time with Foliate to find out how to resolve this. Again, please let me know if you are interested in adding this to Foliate as I am interested in opening a PR for this.

johnfactotum commented 6 months ago

It does have hjkl shortcuts. Or at least it used to. This seem to be a bug that happens when running under GNOME 46. None of the non-global shortcuts work when the WebView is focused. Though I'm not sure whether it's due to changes in GTK or WebKitGTK.

johnfactotum commented 6 months ago

Should be fixed with 3a747653945316be69daf4ca492773097fa7e5a7