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

Need help: lightdm and lightdm-gtk-greeter in guix system do not show session menu. #333

Closed
tumashu opened this issue Dec 26, 2023 · 10 comments

Comments

@tumashu
Copy link

tumashu commented Dec 26, 2023

Hello, I have try to fix a issue of lightdm and lightdm-gtk-greeter in guix system, the problem is session menu in lightdm-gtk-greeter is show nothing.

lightdm_get_sessions of lightdm-gtk-greeter seem to return no sessions, for I tested the below
code, "XXXX: items3" is not show.

    items = lightdm_get_sessions ();
    g_debug ("XXXX: items1");
    if (gtk_widget_get_visible (session_menuitem))
    {
        GSList *sessions = NULL;

        if (gtk_icon_theme_has_icon (icon_theme, "document-properties-symbolic"))
            session_badge = gtk_image_new_from_icon_name ("document-properties-symbolic", GTK_ICON_SIZE_MENU);
        else
            session_badge = gtk_image_new_from_icon_name ("document-properties", GTK_ICON_SIZE_MENU);
        gtk_widget_show (session_badge);
        gtk_container_add (GTK_CONTAINER (session_menuitem), session_badge);

        items = lightdm_get_sessions ();
        g_debug ("XXXX: items2");
        for (item = items; item; item = item->next)
        {
            LightDMSession *session = item->data;
            GtkWidget *radiomenuitem;

            g_debug ("XXXX: items3");
            g_debug ("XXXX: items3", lightdm_session_get_name (session));

            radiomenuitem = gtk_radio_menu_item_new_with_label (sessions, lightdm_session_get_name (session));
            g_object_set_data (G_OBJECT (radiomenuitem), SESSION_DATA_KEY, (gpointer) lightdm_session_get_key (session));
            sessions = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (radiomenuitem));
            g_signal_connect (G_OBJECT (radiomenuitem), "activate", G_CALLBACK (session_selected_cb), NULL);
            gtk_menu_shell_append (GTK_MENU_SHELL (session_menu), radiomenuitem);
            gtk_widget_show (GTK_WIDGET (radiomenuitem));
        }

What makes me feel strange is that , ligthdm_get_sessions of lightdm seem to not be called,
for I use the below code to test, and /tmp/test0.txt file is not generated.

GList *
lightdm_get_sessions (void)
{
    FILE *fp3 = NULL;
    fp3 = fopen("/tmp/test0.txt", "w+");
    fprintf(fp3, "This is testing for fprintf...\n");
    fputs("xxxxx", fp3);
    fclose(fp3);

    update_sessions ();
    return local_sessions;
}

@tumashu tumashu changed the title lightdm and lightdm-gtk-greeter in guix system do not show session menu. need help: lightdm and lightdm-gtk-greeter in guix system do not show session menu. Dec 26, 2023
@tumashu tumashu changed the title need help: lightdm and lightdm-gtk-greeter in guix system do not show session menu. Need help: lightdm and lightdm-gtk-greeter in guix system do not show session menu. Dec 26, 2023
@tumashu
Copy link
Author

tumashu commented Dec 27, 2023

It seem that liblightdm-gobject-1.so.0 is loaded, but is lightdm_get_sessions is not called, I do not know why.

https://issues.guix.gnu.org/68055

@Ashvith10
Copy link

@tumashu have you found any solution for this?

@tumashu
Copy link
Author

tumashu commented Sep 10, 2024

@Ashvith10 no

@tumashu
Copy link
Author

tumashu commented Sep 10, 2024

can not show wm list, at the moment, we need to special wm manual like below:

(service lightdm-service-type
               (lightdm-configuration
                (seats
                 (list (lightdm-seat-configuration
                        (name "*")
                        (user-session "icewm"))))))

@Apteryks
Copy link
Contributor

The problem has been worked around on the Guix System side, the same way it's been worked around on NixOS; refer to Guix commits https://git.savannah.gnu.org/cgit/guix.git/commit/?id=b9d7e15f9f7138d64fc933edcc63d5ccfd403795 and https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3a8e19a61d785ba651c63a3a5991a6e6dcfba9cb.

Apparently, starting the service with a config file (-c /some/path/to/lightdm.conf), was not enough; lightdm appears hard-coded to look under its configured sysconfdir for some things needed to show the desktop sessions (I'm not clear exactly as to what it needed to look there).

@Dariqq
Copy link

Dariqq commented Dec 16, 2024

Hello,

I think the issue is that lightdm_get_sessions resp. update_sessions from lightdm-gobject (used by the gtk-greeter) don't know of the custom configfile passed to lightdm and always use the sessions-directory value from the default configfile.

update_sessions uses NULL for the config path so the call to config_load_from_standard_locations falls back to reading the default config file in CONFIG_DIR i.e. $syscondir/lightdm/lightdm.conf which in our case was just the sample config. In absence of sessions-directory key then the default value SESSIONS_DIR i.e.$pkdatadir/sessions:$pkgdatadir/xessions:$pkgdatadir/wayland-sessions is used to search for session files which in our case did not exist so the empty list was returned confusing the greeter.

The "fix" is to set sysconfdir to /etc and put our generated config file with the correct sessions-dir there which is not at all obvious.

@Ashvith10
Copy link

@tumashu since this issue has been resolved, would you mark this issue as solved by closing it?

@tumashu
Copy link
Author

tumashu commented Dec 19, 2024

ok

@tumashu tumashu closed this as completed Dec 19, 2024
@Apteryks
Copy link
Contributor

Apteryks commented Dec 19, 2024

@Ashvith10 the issue detailed in #333 (comment) still holds though; should a new issue be reopened for it? What's been done on Guix/Nix side is a workaround, not a definitive solution.

@Dariqq
Copy link

Dariqq commented Dec 19, 2024

@Ashvith10 the issue detailed in #333 (comment) still holds though; should a new issue be reopened for it? What's been done on Guix/Nix side is a workaround, not a definitive solution.

I just created a seperate issue.

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

No branches or pull requests

4 participants