Michael Biebl wrote:
> Yves-Alexis Perez wrote:
>> On mer, 2009-04-29 at 08:55 +0200, Michael Biebl wrote:
> 
>>> That's why I proposed the idea of an additional/separate env var, that will 
>>> only
>>> be set for console logins, so we can easily differentiate X11 from console
>>> logins in Xsession.d/90consolekit.
>> That could be a good idea. In fact, what we want (correct me if I'm
>> wrong) is a way, in 90consolekit, to know if we should override the
>> currently running CK session or not. If there's no session, fine, run
>> inconditionnaly, but if there's already a CK session there might be
>> multiple cases (CK-aware DM, CK-pam + DM, CK-pam + console), in some
>> cases the CK-session should be kept, in some other it should be
>> overriden.
>>
>> Am I correct?
> 
> Yeah, I think this sums it up pretty good.
> 
> Another idea I'm currently contemplating, is to make ck-launch-session more
> clever, i.e. run ck-launch-session unconditionally in 90consolekit, and let
> ck-launch-session check itself, if there is already a CK session registered 
> for
> the user/tty
> 

Hi again,

I have a possible solution now, which works a bit differently, please see the
attached 90consolekit:

The idea is:
Run ck-launch-session in 90consolekit, when the following conditions are met

ck-launch-session is available (i.e. consolekit package is installed) and
XDG_SESSION_COOKIE is not set

or

ck-launch-session is available, XDG_SESSION_COOKIE is set, but the session has
no X11 device (i.e. it is a console session)

The latter check is implemented (rather hackishly) via a few dbus-send calls.


Please test and let me know if it works for you.
If you run startx from the console (with or without libpam-ck-connector
enabled), you should get an X11 session.
When you use gdm/kdm, you should *not* get double ck sessions.

Cheers,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
# -*- sh -*-
# Xsession.d script for ck-launch-session.
#
#
# This file is sourced by Xsession(5), not executed.

CK_LAUNCH_SESSION=/usr/bin/ck-launch-session

is_on_console() {
        session=$(dbus-send --system --dest=org.freedesktop.ConsoleKit 
--type=method_call --print-reply --reply-timeout=2000   
/org/freedesktop/ConsoleKit/Manager   
org.freedesktop.ConsoleKit.Manager.GetCurrentSession | grep path | awk '{print 
$3}' | sed s/\"//g)
        x11_display=$(dbus-send --system --dest=org.freedesktop.ConsoleKit 
--type=method_call --print-reply --reply-timeout=2000 $session 
org.freedesktop.ConsoleKit.Session.GetX11Display | grep string | awk '{print 
$2}')

        if [ $x11_display = '""' ] ; then
                return 0
        else
                return 1
        fi
}

if [ -x "$CK_LAUNCH_SESSION" ] && \
 ( [ -z "$XDG_SESSION_COOKIE" ] || is_on_console ) ; then 
    STARTUP="$CK_LAUNCH_SESSION $STARTUP"
fi

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to