If `org.freedesktop.login1.Manager.GetSessionByPID` is called after
cosmic-session puts it in a new systemd scope, it will no longer find
the login session as it would have been removed out of the login session
scope.
Most of the time, cosmic-greeter gets to that line before the scope is
changed, but sometimes (particularly on slower systems or virtual
machines) this race can be lost and lead to cosmic-greeter failing to
start and preventing lockscreen from working.
This commit solves that race condition by always checking the parent PID
instead (which would be cosmic-session which is always present in the
login session scope), and all POSIX-y systems should support using parent
PID.
Mostly closes: #103
Analogous to my other patches that localize date strings (e.g.
pop-os/cosmic-files#277).
The "password:" prompt is not localized in this patch because PAM should
yield translated strings on its own. This needs further investigation.
* Add greeter keyboard and user selection
Fixes#37Fixes#38
* Support switching users and add tooltips to icon buttons
* Implement switching users
* Implement keyboard layout switching
* Ensure that user's xkb_config is used
Logins seem to spuriously fail with both correct or incorrect passwords.
The failure is not related to the password. `cosmic-greeter` hangs but
the GUI still works. The password text area disappears as well.
I traced this issue down to the socket. It seems like accessing the
socket deadlocks with one thread waiting for the socket to become
readable while another waits for it to become writable.
Switching to `greet-ipc`'s `TokioCodec` and adding a lock to the socket
seems to have fixed this issue. I successfully logged in and inputted
incorrect passwords consecutively without experiencing a deadlock.