summaryrefslogtreecommitdiff
path: root/gnome-base/gdm/files/gdm-set-session
diff options
context:
space:
mode:
authorBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:46:38 +0200
committerBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:46:38 +0200
commit539ab2c329ef87cb855c5965a4e3995af9b1cad3 (patch)
treeeb48abd2bb1152d7a5a6e8e048d20f76b0057c9e /gnome-base/gdm/files/gdm-set-session
parentbf9f773fb3fcefed199cd8af38b65f77b347c80c (diff)
Added gnome already splitted ebuilds. will split later if needed to improve deps heaven
Diffstat (limited to 'gnome-base/gdm/files/gdm-set-session')
-rwxr-xr-xgnome-base/gdm/files/gdm-set-session52
1 files changed, 52 insertions, 0 deletions
diff --git a/gnome-base/gdm/files/gdm-set-session b/gnome-base/gdm/files/gdm-set-session
new file mode 100755
index 00000000..491b9a67
--- /dev/null
+++ b/gnome-base/gdm/files/gdm-set-session
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+"""Simple script that updates the default session in AccountServices"""
+
+import sys
+import time
+
+from gi.repository import GLib as glib
+
+import dbus
+from dbus.mainloop.glib import DBusGMainLoop
+
+ACCOUNTS_DBUS_NAME = "org.freedesktop.Accounts"
+ACCOUNTS_DBUS_PATH = "/org/freedesktop/Accounts"
+ACCOUNTS_USER_DBUS_NAME = "org.freedesktop.Accounts.User"
+
+if __name__ == "__main__":
+
+ try:
+ username = sys.argv[1]
+ session = sys.argv[2]
+ except IndexError:
+ sys.stderr.write("%s <username> <default session>\n")
+ raise SystemExit(1)
+
+ dbus_loop = DBusGMainLoop(set_as_default = True)
+ loop = glib.MainLoop()
+ glib.threads_init()
+
+ def setup():
+ try:
+ system_bus = dbus.SystemBus(mainloop=dbus_loop)
+ dbus_object = system_bus.get_object(
+ ACCOUNTS_DBUS_NAME, ACCOUNTS_DBUS_PATH)
+
+ iface = dbus.Interface(
+ dbus_object, dbus_interface=ACCOUNTS_DBUS_NAME)
+
+ user_path = iface.FindUserByName(username)
+
+ dbus_object = system_bus.get_object(
+ ACCOUNTS_DBUS_NAME, user_path)
+
+ iface_usr = dbus.Interface(
+ dbus_object, dbus_interface=ACCOUNTS_USER_DBUS_NAME)
+
+ iface_usr.SetXSession(session)
+
+ finally:
+ loop.quit()
+
+ glib.timeout_add(0, setup)
+ loop.run()