FallingSnow / lightdm-webkit2-material2

A material design LightDM Webkit2 greeter theme
Do What The F*ck You Want To Public License
112 stars 16 forks source link

Lockscreen/Switch User Screen Problem #2

Open cperalt06 opened 7 years ago

cperalt06 commented 7 years ago

Lockscreen/Switch User Screen is redirecting to a sample/template Users with some template desktop environments. Which is to say not the ones that are on my system.

To reproduce, just type this in a terminal dm-tool lock

or just switch users.

Edit: Just in case you might need this since I noticed someone else had this issue:

>sudo pacman -Qi lightdm-webkit2-greeter

Name            : lightdm-webkit2-greeter
Version         : 2.2.2-1
Description     : A webkit2 greeter for LightDM
Architecture    : x86_64
URL             : https://github.com/antergos/lightdm-webkit2-greeter
Licenses        : GPL3
Groups          : system
Provides        : lightdm-webkit2-greeter  lightdm-webkit-greeter
Depends On      : lightdm  webkit2gtk  antergos-wallpapers  accountsservice
Optional Deps   : None
Required By     : lightdm-webkit-theme-material-git  lightdm-webkit2-theme-material2-git
Optional For    : None
Conflicts With  : lightdm-webkit2-greeter  lightdm-webkit-theme-antergos
Replaces        : lightdm-webkit-theme-antergos
Installed Size  : 2.75 MiB
Packager        : Antergos Build Server <dev@antergos.com>
Build Date      : Wed 18 Jan 2017 10:08:55 PM EST
Install Date    : Sat 21 Jan 2017 07:30:03 PM EST
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature
FallingSnow commented 7 years ago

Lol, idk why I wasn't watching my own repo. Sorry for the slow response.

I think this is an upstream issue since the mock only gets loaded if the greeter is not found. It's hard for me to debug due to a recent issue with development tools breaking (https://github.com/Antergos/lightdm-webkit2-greeter/issues/109). We'll need to wait until I can get devtools working again unless @lots0logs has the time and is willing to look into this.

internauta2000 commented 7 years ago

+1 in Manjaro (Lockscreen/Switch User Screen is redirecting to a sample/template Users with some template desktop environments. Which is to say not the ones that are on my system)

captura de pantalla de 2017-02-15 10-57-13

cytodev commented 7 years ago

@internauta2000, that would be the lightdm mock I wrote. @FallingSnow, did you include the check if lightdm is already defined before assigning the mock to the variable? - Also, version 1.1.0 is up.

FallingSnow commented 7 years ago

Yes sir.

https://github.com/FallingSnow/lightdm-webkit2-material2/blob/master/src/index.js couple of lines down.

cytodev commented 7 years ago

That would imply that lightdm has not been initialized when the greeter loads in wake-up or switch-user mode. Maybe this is an issue with the newly created python code on the lightdm-webkit2-greeter repository? I can assume @cperalt06 is using that version, but I'm not sure about the version @internauta2000 uses. All I can say is that the mockup I created was back when antergos' repository was in plain C.

I'd love to debug this further, but I'm going to need some more information from internauta2000. What release is he/she on with the webkit2-greeter, and what python version. It might be that the python code written by the antergos developer(s) has not accounted for deprecation and/or skips over some lines that result in the lightdm object not being created.

This is all speculation at this point. You could try to wrap the LightDMMock initialization into a timeout, or listen for a specific set of keypresses instead to see if it's a timing issue.

Also, might I suggest using a git-flow which replaces the mockup with an error message and fallback text-login in live code? It seems that this issue which internauta2000 is also experiencing in a way has been going on for some time now. -- I'm actually quite impressed that this mockup keeps the actual greeter framework from panicking so well.

FallingSnow commented 7 years ago

Maybe this is an issue with the newly created python code on the lightdm-webkit2-greeter repository?

This issue predates the move to python and I can only assume it is one of the reasons the greeter is being moved to python. Webkit2gtk had many issues which is why I assume the move to python was made.

I can assume @cperalt06 is using that version

I don't believe anyone is running the prerelease of web-greeter other than the Antergos devs seeing as its not even on the AUR... you would need to manually install it if you wanted to use it.

cytodev commented 7 years ago

The issues within the antergos repository are all attributed to bad/outdated documentation and maybe even sparse testing last time I checked. (my issue for reference) I don't think that moving to python will fix any of that. But, that's just a thought.

What we can do in the meantime is verify if it is a timing issue on said configurations, and if so try to solve that. -- If not, we can both write issues on their repository's chalking board.

lots0logs commented 7 years ago

The issues within the antergos repository are all attributed to bad/outdated documentation and maybe even sparse testing last time I checked.

That is completely false. I'd love to know what facts you have used to draw such conclusions. The documentation is 100% up-to-date on the stable branch. You can see it here. It has been up-to-date since the release of version 2.0 last year, btw.

In any case, this issue is most likely one of timing. Using setTimeout() should solve it for now. When version 3.0 of the greeter is released, it will include a GreeterReady event that themes can attach a callback to in order to initialize themselves.

cytodev commented 7 years ago

That is completely false. I'd love to know what facts you have used to draw such conclusions.

I must admit, I haven't looked at the documentation since last time I wrote the mock. I based this entirely on the old manual which doesn't even exist anymore.

Using setTimeout() should solve it for now. When version 3.0 of the greeter is released, it will include a GreeterReady event that themes can attach a callback to in order to initialize themselves.

But how would a GreeterReady event help in determining if the lightdm object is available? You would either be calling GreeterReady on null, or call it on the object and always receive true.

Perhaps listening for keypress to initialize the mockup if the lightdm object is not present is the best way to go, let's say \<super>+\<m>

let sequenced = 0;

document.addEventListener("keydown", function(event) {
    sequenced = sequenced === 0 ? event.keyCode : sequenced + event.keyCode;

    switch(sequenced) {
        case 168: // super+m
            // initialize mockup if(!("lightdm" in window))
            break;
        case 184: // super+shift+m
            // initialize mockup and override lightdm if it exists
            break;
    }
});

document.addEventListener("keyup", function() {
    sequenced = 0;
});
lots0logs commented 7 years ago

But how would a GreeterReady event help in determining if the lightdm object is available? You would either be calling GreeterReady on null, or call it on the object and always receive true.

The event will be attached to the global window object. When the event fires, the lightdm object is guaranteed to be available.

TBH, I do not think its a good practice for themes to load any mock scripts in production environments. Mock scripts are a development tool. They have absolutely no use in production. An end-user should never see the login screen running a mock script. Period.

cytodev commented 7 years ago

Also, might I suggest using a git-flow which replaces the mockup with an error message and fallback text-login in live code?

My point exactly.

FallingSnow commented 7 years ago

This should address your guys' concerns: https://github.com/FallingSnow/lightdm-webkit2-material2/commit/e906b512aa404403e86d0703d30a4b21d94352b5

crdil commented 7 years ago

I just fetched that commit and rebuilt, it didn't work, lightdm didnt start at all with the newly built theme.

FallingSnow commented 7 years ago

You got the big red error message on your screen?

crdil commented 7 years ago

No, just black screen and then I just got an option to use the default theme or the fallback theme :/

FallingSnow commented 7 years ago

What do the error logs say, usually found in /var/log/lightdm.

crdil commented 7 years ago

file:///usr/share/lightdm-webkit/themes/material3/bundle.js:59:5862: CONSOLE DEBUG Loading Theme file:///usr/share/lightdm-webkit/themes/material3/bundle.js:68:27976: CONSOLE ERROR TypeError: undefined is not an object (evaluating 'lightdm.languages')

FallingSnow commented 7 years ago

Honestly, I have no idea why this is happening. The theme checks if lightdm exists at startup, if it doesn't, it either throws an error that should stop execution or load the mock. The error above suggests neither is happening.

Can you give me some insight into what your doing to reproduce this issue? For example, does this happen only when you lock your session?

cytodev commented 7 years ago

The languages aren't loaded when they are accessed? Languages should be an array containing the language objects. -- That's all I can make of the error.

crdil commented 7 years ago

@FallingSnow it happens when I try to use the theme, so for me it doesn't work at all. I'm using lightdm 1:1.20.0-2 and lightdm-webkit2-greeter 2.2.3-1 for arch/antergos repos if that matters.

FallingSnow commented 7 years ago

Can you compile the latest commit and try again please. If this doesn't work it has to be upstream and we are better off just waiting for web-greeter.

crdil commented 7 years ago

I couldn't build it, I got an error with uglifyjs

ERROR in bundle.js from UglifyJs
TypeError: Cannot read property 'file' of undefined

I removed the following in uglifyjs config in webpack file, then I could build it.

collapse_vars: true,
reduce_vars: true

When I restarted lightdm it worked at the first login, but after I locked the screen and tried to login again, lightdm used the fallback theme instead. Error from log file

file:///usr/share/lightdm-webkit/themes/material3/bundle.js:53622:14: CONSOLE DEBUG Loading Theme
file:///usr/share/lightdm-webkit/themes/material3/bundle.js:53632:13: CONSOLE ERROR ReferenceError: Can't find variable: lightdm

** (lightdm-webkit2-greeter:32435): WARNING **: [ERROR] :: A problem was detected with the current theme. Falling back to default theme...
cperalt06 commented 7 years ago

I reinstalled it via yaourt and looked at the log for lightdm and found this: CRITICAL: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

Edit: I should clarify one thing. Switching users and logging out no longer show a mock user list and instead I get the actual users in my system. The only time I get the error with a "load fallback theme or load default theme" is by typing this in the terminal: dm-tool lock

Otherwise, it's fine so far. Thanks for fixing part of the problem!

cytodev commented 7 years ago

file:///usr/share/lightdm-webkit/themes/material3/bundle.js:53632:13: CONSOLE ERROR ReferenceError: Can't find variable: lightdm

This could be the problem. lightdm is not defined at this point.

crdil commented 7 years ago

It works for me as well, the only problem I have is the same as @cperalt06 has, when locking screen manually it loads the fallback theme

FallingSnow commented 7 years ago

@crdil Can you try changing this number to something like 10000, recompile, and see if it solves the problem? If that doesn't work maybe try CytoDev's pull request modifications.

crdil commented 7 years ago

@FallingSnow I still get the same error, that lightdm variable can't be found. I tried both with increasing the setTimeout and pull request.

cytodev commented 7 years ago

@crdil That's odd... Might I suggest wrapping everything into a temporary try-catch block? I'm really interested in what line this error is spawned from actual non-compiled code. Maybe some file somewhere is still using the lightdm variable before it is defined?

Something like

try {
    // all code from index.js
} catch(excepton) {
    window.console.error("Error occured in index.js", exception);
}
crdil commented 7 years ago

I tried to use a try/catch block, but I still get the same error not the error from console.error

ByteOven commented 7 years ago

Can confirm this,

`$ sudo pacman -Qi lightdm-webkit2-greeter

Name : lightdm-webkit2-greeter Version : 2.2.5-1 Description : LightDM greeter that uses WebKit2 for theming via HTML/JavaScript. Architecture : x86_64 URL : https://github.com/antergos/lightdm-webkit2-greeter Licenses : GPL3 Groups : system Provides : lightdm-webkit-greeter Depends On : lightdm webkit2gtk accountsservice gnome-backgrounds Optional Deps : None Required By : None Optional For : None Conflicts With : lightdm-webkit-greeter lightdm-webkit-theme-antergos Replaces : lightdm-webkit-greeter lightdm-webkit-theme-antergos Installed Size : 2.03 MiB Packager : Unknown Packager Build Date : Tue 30 May 2017 07:16:51 PM CEST Install Date : Tue 30 May 2017 07:17:00 PM CEST Install Reason : Explicitly installed Install Script : No Validated By : None `

cytodev commented 7 years ago

@0xHM, @crdil, I'm unsure about how the webkit greeter handles "native" js logging, I probably should check that out before suggesting potential error-chasing options... Another option would be to literally write all of it to the screen. Just for debugging purpouses ofcourse! -- Then again, if this is an issue with the actual source package - like I suspect, there is little we can do to fix it...

bytheway, @crdil, apologies for the late reply!

ByteOven commented 7 years ago

@CytoDev Let me just give few notes,

I'm using https://github.com/FallingSnow/LightDMMock as mock, there is also a bug in there

file:///usr/share/lightdm-webkit/themes/arch/mock/LightDMMock.js:575:7: CONSOLE ERROR ReferenceError: Can't find variable: module

This can be solved by adding above the last var module = module || {}

cytodev commented 7 years ago

@0xHM That is an issue which can be easily resolved, the original branch already has an update compared to the branch @FallingSnow is using as mock.

You can see if replacing the mockup with the original fixes this error. - It probably will, but if it doesn't please don't hesitate to file a bug against my repo!