JezerM / web-greeter

A modern, visually appealing greeter for LightDM.
https://jezerm.github.io/web-greeter-page/
GNU General Public License v3.0
203 stars 10 forks source link

Properties and signal updates are too slow #48

Closed JezerM closed 1 year ago

JezerM commented 1 year ago

Environment

Bug description

Gruvbox theme provides an option to use user's background that auto-updates when the selected user is changed. This works very well in nody-greeter and even the unready sea-greeter, but it does not in web-greeter. Why? Due to its asynchronous update of properties and signals.

When we execute something like lightdm.authenticate(null) that should change properties like lightdm.authentication_user, this change is not immediate in web-greeter as wee need to update all properties through a web channel, asynchronously, after 50ms (see here).

At gruvbox source code, to avoid providing the current user through greeter_comm, we make use of lightdm.authentication_user to get the current user in other monitors. However, as said before, web-greeter has to wait 50ms to update all properties, which is a lot.

This happens in nody-greeter and sea-greeter:

web-greeter:

This is also the reason why web-greeter signals are slow, which makes the whole experience slower.

Steps to reproduce

Expected behavior

Change the background immediately after selecting another user.

How to solve it

I've been researching through the Qt5 documentation and source code to find a solution to this. What came to me is that QWebEnginePage provides a runJavaScript method which actually blocks both the main and web processes, so a synchronous communication could be added (Finally, a theme_utils.dirlist_sync?!!). Also, as this would be synchronous, properties could be updated immediately while blocking everything else (which solves the gruvbox issue), and signals could be fired just after the properties (so no delay on signals!). A custom qwebchannel.js should be added, as well.

This seems very promising, but I'll need to look further into this.

JezerM commented 1 year ago

Nah, a synchronous solution seems impossible with Qt5 WebEngine... However, this should be partially fixed at 56e0d8700902dddaf3e3492a; GreeterBroadcastEvent is now delayed 60ms to allow properties to be updated.