Skip to content
Browse files

Add ListSeats method to Manager interface

This adds a logind-compatible ListSeats method to the ConsoleKit.Manager
interface.  This is needed because the seat name does not always exactly
map to the object path (for instance, /Seat1 is 'seat0').

This also allows SDDM to work properly with ConsoleKit2.
  • Loading branch information
awilfox committed Oct 30, 2017
1 parent 962eca7 commit 6016bbb0fdb1a91c25062b93fe53964cf6aa4ac5
Showing with 60 additions and 0 deletions.
  1. +3 −0 data/ConsoleKit.conf
  2. +39 −0 src/ck-manager.c
  3. +18 −0 src/org.freedesktop.ConsoleKit.Manager.xml
@@ -78,6 +78,9 @@
<allow send_destination="org.freedesktop.ConsoleKit"
<allow send_destination="org.freedesktop.ConsoleKit"
<allow send_destination="org.freedesktop.ConsoleKit"
@@ -3840,6 +3840,44 @@ dbus_unlock_session (ConsoleKitManager *ckmanager,
return TRUE;

static gboolean
dbus_list_seats (ConsoleKitManager *ckmanager,
GDBusMethodInvocation *context)
CkManager *manager;
GVariantBuilder seat_builder;
GVariant *seat;
GHashTableIter seat_iter;
const gchar *key;
CkSeat *value;


manager = CK_MANAGER (ckmanager);

g_return_val_if_fail (CK_IS_MANAGER (manager), FALSE);

/* if we don't have seats, we need to return NULL */
if (g_hash_table_size (manager->priv->seats) == 0) {
throw_error (context, CK_MANAGER_ERROR_NO_SEATS, _("User has no seats"));
return TRUE;

g_variant_builder_init (&seat_builder, G_VARIANT_TYPE_ARRAY);

g_hash_table_iter_init (&seat_iter, manager->priv->seats);
while (g_hash_table_iter_next (&seat_iter, &key, &value)) {
seat = g_variant_new("(so)",
console_kit_seat_get_name( CONSOLE_KIT_SEAT(value) ),

g_variant_builder_add_value (&seat_builder, seat);

console_kit_manager_complete_list_seats (ckmanager, context, g_variant_builder_end (&seat_builder));
return TRUE;

static gboolean
dbus_get_seats (ConsoleKitManager *ckmanager,
GDBusMethodInvocation *context)
@@ -4134,6 +4172,7 @@ ck_manager_iface_init (ConsoleKitManagerIface *iface)
iface->handle_stop = dbus_stop;
iface->handle_suspend = dbus_suspend;
iface->handle_close_session = dbus_close_session;
iface->handle_list_seats = dbus_list_seats;
iface->handle_get_seats = dbus_get_seats;
iface->handle_get_sessions = dbus_get_sessions;
iface->handle_get_sessions_for_unix_user = dbus_get_sessions_for_unix_user;
@@ -531,6 +531,24 @@

<method name="ListSeats">
<arg name="seats" direction="out" type="a(so)">
<doc:summary>an array of seat names and IDs</doc:summary>
<doc:para>Retrieves a list of all <doc:ref type="interface" to="Seat">Seats</doc:ref>
that are present on the system.</doc:para>
<doc:para>Like the logind method of the same name, this returns both the seat's name
(such as "seat0") and the D-Bus object path for the seat object that implements the
<doc:ref type="interface" to="Seat">Seat</doc:ref> interface.</doc:para>
<doc:seealso><doc:ref type="method" to="Manager.GetSeats">GetSeats()</doc:ref></doc:seealso>

<method name="GetSeats">
<arg name="seats" direction="out" type="ao">

4 comments on commit 6016bbb


This comment has been minimized.

Copy link

@alienbob alienbob replied Nov 1, 2017

I built the latest ConsoleKit2 git snapshot (20171101) with this commit included, and to sddm-0.16.0 I applied the following patch to prevent this SDDM error:
[12:05:29.116] (WW) DAEMON: QDBusConnection: error: could not send message to service "org.freedesktop.ConsoleKit" path "/org/freedesktop/ConsoleKit/Manager" interface "/org.freedesktop.ConsoleKit.Manager" member "ListSeats": Invalid interface class: /org.freedesktop.ConsoleKit.Manager

--- sddm-0.16.0/src/daemon/LogindDBusTypes.cpp.orig     2017-10-05 08:24:24.000000000 +0200
+++ sddm-0.16.0/src/daemon/LogindDBusTypes.cpp  2017-11-01 12:08:37.021870157 +0100
@@ -63,7 +63,7 @@
         available = true;
         serviceName = QStringLiteral("org.freedesktop.ConsoleKit");
         managerPath = QStringLiteral("/org/freedesktop/ConsoleKit/Manager");
-        managerIfaceName = QStringLiteral("/org.freedesktop.ConsoleKit.Manager"); //note this doesn't match logind
+        managerIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.Manager"); //note this doesn't match logind
         seatIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.Seat");
         sessionIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.Session");
         userIfaceName = QStringLiteral("org.freedesktop.ConsoleKit.User");

Still, SDDM does not show its graphical login screen although the sddm process is running. Its logfile states:

[12:13:20.624] (II) DAEMON: Initializing...
[12:13:20.629] (II) DAEMON: Console kit interface found
[12:13:20.629] (II) DAEMON: Starting...

This is not a ConsoleKit2 issue, it is SDDM which expects CK2 to have the exact same DBus API as systemd-logind and that is a mis-judgement.
I tried adding a ConsoleKit xml definition, similar to what can be found for logind in [] but I am not qualified to do this... I lack the knowledge to fix SDDM. In any case, the XML files in the CK2 repository are not usable as-is because of "qdbusxml2cpp" errors while processing those.


This comment has been minimized.

Copy link

@EricKoegel EricKoegel replied Nov 1, 2017

@alienbob, There's a PR for SDDM that aims to improve the situation, sddm/sddm#923


This comment has been minimized.

Copy link

@alienbob alienbob replied Nov 1, 2017

That is good news @EricKoegel . I am always willing, and able, to help testing CK2 and SDDM interaction.


This comment has been minimized.

Copy link
Contributor Author

@awilfox awilfox replied Nov 2, 2017

@alienbob specifically you need the 'canGraphical' part of sddm/sddm#923 (in addition to the removal of improper '/' character) to make it stop hanging.

What it is doing is waiting for a seat that it can run X on, and since ConsoleKit does not expose (imo superfluous) 'canGraphical' property on seats, it simply waits forever for a notification that a seat with that property is added.

Please sign in to comment.
You can’t perform that action at this time.