Closed D3vil0p3r closed 5 months ago
I note that it can be satisfied by filling user-session
field in /etc/lightdm/lightdm.conf
. If you confirm this, I can close the issue.
Yes, it will select the default session that was configured in the lightdm config, if there isn't any, it should select the first session in the session list returned from the lightdm api... unless there's something wrong with this code. https://github.com/hertg/lightdm-neon/blob/6644299558197a2e3aaa115f0df5ec0bb2c34773/src/main.ts#L17-L24
Do you get any errors in the javascript console?
No, I dont get errors. It works well. I tested on a fresh machine. I close the ticket.
Hello @hertg Sorry if I reopen the issue. The user-session can work well, but in reality the code seems to not retrieve the first available session. I tested it again in a clean environment with MATE desktop env and the icon on bottom-left remains empty on first run. Maybe it does not take the first session in the session list...
If I run the piece of code above you posted in typescript, I get:
/usr/lib/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
lightdm.ts:1:32 - error TS2304: Cannot find name 'window'.
1 let default_session: string = window.lightdm.default_session;
~~~~~~
lightdm.ts:3:7 - error TS2304: Cannot find name 'window'.
3 if (window.lightdm.sessions.length > 0) {
~~~~~~
lightdm.ts:4:22 - error TS2304: Cannot find name 'window'.
4 default_session = window.lightdm.sessions[0].key;
~~~~~~
at createTSError (/usr/lib/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/usr/lib/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/usr/lib/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/usr/lib/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/usr/lib/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Object.require.extensions.<computed> [as .ts] (/usr/lib/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
diagnosticCodes: [ 2304, 2304, 2304 ]
}
I'm running it on my Linux terminal by NodeJS.
I don't fully understand what code you executed, and where.
Can you fully reproduce the issue on your machine? If so, could you enable debug mode in web-greeter by setting the following config:
# /etc/lightdm/web-greeter.yml
greeter:
debug_mode: True
After that, once you are back to the login screen (through log out, or reboot), press F12 and open the javascript console. Do you see any errors there?
I'm using it in a Virtual Machine (VMware Workstation), I enabled the debug mode and when I am at login page and I press F12, nothing happens, I cannot get the javascript console. Or maybe it is not clear for me how to run the debug of it.
UPDATE: I got it by right-click by mouse -> Inspect -> clicking on Console.
@hertg I run it, and in my console I see the following messages:
MATE session exists, indeed if I click on the bottom-left button, I get:
So, it is not able to set session as this existing MATE session.
UPDATE: going deep to the elements, I expanded lightdm QObject -> __propertyCache__ -> 28 -> 0
that is the one containing the session value and I see:
So it reports This session logs you into MATE
but, as you can see on bottom-left of the image, that icon is without MATE. If I try to login directly without manually selecting MATE, it does not login, and I get the popup window LightDM couldn't start session
.
I'm continuing further tests. I note this happens only for some desktop environments. For example, it occurs for MATE, KDE Plasma, Cinnamon and Bspwm. Now I tested XFCE, Hyprland and GNOME and it is able to recognize them at first boot. I will check more involved environments.
What's the content of your /etc/lightdm/lightdm.conf
? On my machine, I see that there is a line that's commented out:
#user-session=default
Your console output (default session is 'default'
) looks like your lightdm config might have this line in it. Now, I don't know what values are allowed for this setting, my understanding was that you'd set that value to something like xfce
or gnome
. But is the value default
actually a valid setting?
I'll ping @JezerM, maybe they have some insight on what is happening here.
If you cannot login, when the session is set to 'default'
, clearly it seems to be an issue to call
window.lightdm?.start_session('default');
which is what's effectively happening here: https://github.com/hertg/lightdm-neon/blob/13e7675089983e87514f9d418ccb9a1f0a931d0e/src/signals.ts#L33C22-L33C22
@JezerM, is that a problem? Should I convert a value of 'default'
to null
when calling window.lightdm?.start_session()
?
If I remember correctly, the "default" session in "lightdm.conf" should select the last session the user logged in with (or a session that is exactly called "default").
And yeah, you shouldn't use "default" in lightdm.start_session()
, it's better to set it as null
.
I tested several environments cited above and I see that the issue occurs for the following ones:
MATE, KDE Plasma, Cinnamon and Bspwm
@D3vil0p3r Could you build the theme yourself and test the following patch to see if it resolves your issue?
diff --git a/src/main.ts b/src/main.ts
index c391916..6204940 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -14,16 +14,37 @@ function initGreeter() {
target: document.body,
props: {}
});
- let default_session: string = window.lightdm.default_session;
- if (!default_session) {
- if (window.lightdm.sessions.length > 0) {
- default_session = window.lightdm.sessions[0].key;
- } else {
- console.warn("no session found to choose from?");
- }
- }
- console.debug(`default_session is '${default_session}'`);
+
+ let default_session: string = computeDefaultSession();
+ console.debug(`session being used is '${default_session}'`);
selectedSession.update(_ => default_session);
};
+
+function computeDefaultSession(): string {
+ let from_config = window.lightdm.default_session;
+
+ if (from_config) {
+ if (window.lightdm.sessions.find(k => k.key === from_config)) {
+ console.debug(`default session '${from_config}' configured, using it`);
+ return from_config;
+ } else {
+ if (window.lightdm.sessions.length > 0) {
+ console.warn(`default session '${from_config}' not found, using first session`);
+ return window.lightdm.sessions[0].key;
+ } else {
+ console.warn(`default session '${from_config}' not found, but also no sessions available to fallback to, attempting to use it anyway`)
+ return from_config;
+ }
+ }
+ }
+
+ if (window.lightdm.sessions.length > 0) {
+ console.debug("no default session configured, using first session");
+ return window.lightdm.sessions[0].key;
+ } else {
+ console.warn("no default session configured, and no sessions available to fallback to, using 'null'");
+ return null;
+ }
+}
-window.addEventListener("GreeterReady", initGreeter);
\ No newline at end of file
+window.addEventListener("GreeterReady", initGreeter);
I confirm that code fixed the issue. I tested MATE and Bspwm and now they are shown at first boot with this theme. Thank you so much!
will be closed once #20 is merged
closed via #20
Currently, when this theme is applied at the installation of a OS (so before the installation of previous Display Managers or themes), the theme does not recognize the desktop environment session and the "window" icon at bottom-left is without any string. I'm using GNOME, so I have the following possible sessions: gnome (that is wayland), gnome-wayland (same as before) and gnome-xorg (Xorg session, the one I use more):
A newbie that does not know the concept of "sessions", if try to insert a password, get a popup window saying:
So the user must be aware of the functionality of the "window" icon, clicking there and selecting the right session:
Is there a way for the theme to automatically set one of the available sessions and provide a config file to set it programmatically?
Usually the session files are stored in
/usr/share/xsessions
for Xorg and/usr/share/wayland-sessions
for Wayland.