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:
lightdm.authenticate("user")
lightdm.authentication_user property is updated to "user"
greeter_comm.broadcast("changeUserBackground")
GreeterBroadcastEvent is fired
lightdm.authentication_user returns "user", as expected
web-greeter:
lightdm.authenticate("user")
lightdm.authentication_user property is being updated to "user" after 50ms, for now is "" (null)
greeter_comm.broadcast("changeUserBackground")
GreeterBroadcastEvent is fired
lightdm.authentication_user returns "", not as expected
50ms later, lightdm.authentication_user is now "user"
This is also the reason why web-greeter signals are slow, which makes the whole experience slower.
Steps to reproduce
Use gruvbox theme.
Set background option as "User Background".
Change user.
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.
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.
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 likelightdm.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 oflightdm.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:
lightdm.authenticate("user")
lightdm.authentication_user
property is updated to "user"greeter_comm.broadcast("changeUserBackground")
GreeterBroadcastEvent
is firedlightdm.authentication_user
returns "user", as expectedweb-greeter:
lightdm.authenticate("user")
lightdm.authentication_user
property is being updated to "user" after 50ms, for now is "" (null)greeter_comm.broadcast("changeUserBackground")
GreeterBroadcastEvent
is firedlightdm.authentication_user
returns "", not as expectedlightdm.authentication_user
is now "user"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 arunJavaScript
method which actually blocks both the main and web processes, so a synchronous communication could be added (Finally, atheme_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 customqwebchannel.js
should be added, as well.This seems very promising, but I'll need to look further into this.