Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth scrolling #790

Open
Shamaoke opened this issue May 27, 2019 · 10 comments
Open

Smooth scrolling #790

Shamaoke opened this issue May 27, 2019 · 10 comments

Comments

@Shamaoke
Copy link

Is there any way to enable smooth scrolling in Luakit?

@c0dev0id
Copy link
Member

In :settings, there is a setting webview.enable_smooth_scrolling you can enable.

@Shamaoke
Copy link
Author

I enabled it, but nothing happened. Scrolling is still discrete.

Linux (Arch); Luakit 2.1

@aidanholm
Copy link
Member

That setting doesn't do what I'd guess @Shamaoke is probably asking about, which is smooth scrolling when you scroll with j/k. I'm actually not sure what that setting does: it's just a wrapper for the webkit setting, and i've never noticed it making any difference.

Scrolling with j/k uses webkit_dom_dom_window_scroll_to() to scroll, which is effectively a window.scrollTo() call in javascript. It's not something that can support smooth scrolling. It'd need a rewrite.

That API is actually deprecated in favour of the JavascriptCore API. Unfortunately webkit does not currently support the smooth scrolling option for window.scrollTo() (webkit bug https://bugs.webkit.org/show_bug.cgi?id=188043), and it would be a lot of work to switch to those new APIs anyway.

TL;DR: No, unfortunately :(

@Shamaoke
Copy link
Author

@aidanholm Thank you for the explanation.

@c0dev0id
Copy link
Member

c0dev0id commented Jun 4, 2019

The smooth scrolling setting does something. It enables smooth scrolling for the mouse wheel. So it's not entirely useless.

@Shamaoke
Copy link
Author

Shamaoke commented Jun 5, 2019

@c0dev0id For me it does nothing. Scrolling is still discrete neither by keys nor by mouse.

Here's my configuration file:

-- ~/.config/luakit/userconf.lua
local webview = require "webview"

webview.enable_smooth_scrolling = true

@aidanholm
Copy link
Member

Hrm, well as a workaround you might be able to hack things so that j/k/etc keys sent scrollwheel events to the webview instead. Of course, this would break the scrollstep setting, and wouldn't work for page-based or absolute scrolls, so it'd never be mergable, but if you really want your j/k keys to smoothscroll, you could do that.

@aidanholm
Copy link
Member

@Shamaoke Ah, that's because that's not set correctly. You'd need to do this:

local settings = require "settings"
settings.webview.enable_smooth_scrolling = true

This can be pretty confusing, admittedly, but module properties and settings are explicitly separate.

You can check (and change) your settings here: luakit://settings/

@Shamaoke
Copy link
Author

Shamaoke commented Jun 5, 2019

@aidanholm Thank you for the correction. This way it works. I still prefer using a configuration file in order to version control it.

@aidanholm
Copy link
Member

You're welcome!

To be clear, the lack of support and API issues and all that stuff is something that we'd very much like to have fixed. Ideally, smooth scrolling would piggyback on the webview.enable_smooth_scrolling setting, with a new setting for scroll speed. I'll leave this open as a feature request for now. Unfortunately my time for luakit development is pretty limited, so an ETA is not really possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants