In case someone else is searching for a work-around for this issue: ck-history --last-compat This is sufficient to determine the logged-in user with X display, e.g. to lock the screen via a script upon an ACPI lid close event. Peter