linuxmint / lightdm-settings

A configuration tool for the LightDM display manager
GNU General Public License v3.0
108 stars 24 forks source link

GNOME environment and pkexec support #9

Closed fossfreedom closed 7 years ago

fossfreedom commented 7 years ago

ok,

I thought it was rather odd that pkexec was not being used to execute lightdm-settings. We have to ensure the locale environment variables are set when running as root. Its been long rumoured that gksu is to be removed from distros - so we shouldnt depend on gksu to execute stuff as root.

Thus the first change is to pass the current locale to lightdm-settings.

Secondly, the window is styled for Cinnamon and MATE. Under GNOME based desktop environments (e.g. Budgie Desktop and GNOME-Shell) headerbars is the expected window style.

So, the second part of this pull request is to check XDG_CURRENT_DESKTOP (passed as a parameter) to see if lightdm-settings is running in a GNOME based environment. If it is, the GTK Headerbar is added otherwise the standard GTK Window for all other DE's is used as extant.

clefebvre commented 7 years ago

Thanks @fossfreedom,

Please make separate PRs for each work package. I can see three here... the headerbars, the locale/environment, and the use of Gtk.Application.

I'm not convinced the locale is the best way to go, but we could look at this in isolation and without holding the other two PRs from getting merged.

PS: We use 120 chars per line as a rough line width limit. It's not strict but you're quite far from it.

clefebvre commented 7 years ago

In regards to locale, I believe it should work out of the work with pkexec. There's a pending PR on cinnamon-session (and one merged in mate-session-manager) which sets the proper environment variables via dbus. Though even with that we still don't get the right locale in xenial, so there's probably an issue with polkit itself as well.

pyxapp checks for the presence of gksu/kdesu before using them, and defaults to pkexec if these aren't found so it works in distros without gksu, such as Fedora.

fossfreedom commented 7 years ago

I'm using gnome-session (budgie-desktop) - it doesnt appear to set (define?) any environment vars when stuff is running as root. Nor does polkit appear to pass this.

k - I'll split the PR into two bits - headerbars go with the use of Gtk.Application window stuff and separately the locale stuff.

However without the environment variable stuff (XDG_CURRENT_DESKTOP) I don't think there is a way to determine this when running with pkexec - so the headerbars won't work itself.

There is various PEP8 issues with the current source - saw that when running "check-all-the-things" - might do a separate PR with that if I find the time.