]> git.phdru.name Git - xsetbg.git/commitdiff
xsetbg (DBus version).
authorOleg Broytman <phd@phdru.name>
Fri, 18 Feb 2011 13:52:34 +0000 (13:52 +0000)
committerOleg Broytman <phd@phdru.name>
Fri, 18 Feb 2011 13:52:34 +0000 (13:52 +0000)
git-svn-id: file:///home/phd/archive/SVN/xsetbg/trunk@49 143022c7-580b-0410-bae3-87f2bf5d3141

14 files changed:
xsetbg-dbus-change [new file with mode: 0755]
xsetbg-dbus-client.py [new file with mode: 0644]
xsetbg-dbus-force [new file with mode: 0755]
xsetbg-dbus-restart [new file with mode: 0755]
xsetbg-dbus-start [new file with mode: 0755]
xsetbg-dbus-stop [new file with mode: 0755]
xsetbg-dbus.py [new file with mode: 0755]
xsetbg-http-change [moved from xsetbg-change with 100% similarity]
xsetbg-http-force [moved from xsetbg-force with 100% similarity]
xsetbg-http-restart [new file with mode: 0755]
xsetbg-http-start [new file with mode: 0755]
xsetbg-http-stop [moved from xsetbg-stop with 100% similarity]
xsetbg-restart [deleted file]
xsetbg-start [deleted file]

diff --git a/xsetbg-dbus-change b/xsetbg-dbus-change
new file mode 100755 (executable)
index 0000000..99a4d22
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec "$HOME/lib/xsetbg"/xsetbg-dbus-client.py change
diff --git a/xsetbg-dbus-client.py b/xsetbg-dbus-client.py
new file mode 100644 (file)
index 0000000..7d2e337
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+"""XSetBg DBus client
+
+"""
+
+__version__ = "$Revision: 48 $"[11:-2]
+__revision__ = "$Id: xsetbg-wsgi.py 48 2011-02-18 13:35:39Z phd $"[5:-2]
+__date__ = "$Date: 2011-02-18 16:35:39 +0300 (Fri, 18 Feb 2011) $"[7:-2]
+
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2000-2010 PhiloSoft Design"
+__license__ = "GNU GPL"
+
+
+import sys
+import dbus
+
+def main():
+    try:
+        command = sys.argv[1]
+    except IndexError:
+        sys.exit('Usage: %s command' % sys.argv[0])
+
+    bus = dbus.SessionBus()
+    remote_object = bus.get_object("name.phdru.XSetBg", "/XSetBg")
+    iface = dbus.Interface(remote_object, "name.phdru.XSetBg")
+
+    getattr(iface, command)()
+
+if __name__ == '__main__':
+    main()
diff --git a/xsetbg-dbus-force b/xsetbg-dbus-force
new file mode 100755 (executable)
index 0000000..52f2e2b
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec "$HOME/lib/xsetbg"/xsetbg-dbus-client.py force
diff --git a/xsetbg-dbus-restart b/xsetbg-dbus-restart
new file mode 100755 (executable)
index 0000000..c10e812
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+"$HOME/lib/xsetbg"/xsetbg-dbus-stop && exec "$HOME/lib/xsetbg"/xsetbg-dbus-start
diff --git a/xsetbg-dbus-start b/xsetbg-dbus-start
new file mode 100755 (executable)
index 0000000..418deb1
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+umask 077
+nice -20 ionice -c3 "$HOME/lib/xsetbg"/xsetbg-dbus.py >/dev/null 2>&1 &
diff --git a/xsetbg-dbus-stop b/xsetbg-dbus-stop
new file mode 100755 (executable)
index 0000000..3d2bec8
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec "$HOME/lib/xsetbg"/xsetbg-dbus-client.py stop
diff --git a/xsetbg-dbus.py b/xsetbg-dbus.py
new file mode 100755 (executable)
index 0000000..386df21
--- /dev/null
@@ -0,0 +1,51 @@
+#! /usr/bin/env python
+"""XSetBg (DBus version)
+
+"""
+
+__version__ = "$Revision$"[11:-2]
+__revision__ = "$Id$"[5:-2]
+__date__ = "$Date$"[7:-2]
+
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2000-2010 PhiloSoft Design"
+__license__ = "GNU GPL"
+
+import gobject
+
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+
+from xsetbg import change
+
+
+class XsetBg(dbus.service.Object):
+
+    @dbus.service.method("name.phdru.XSetBg", in_signature='', out_signature='')
+    def change(self):
+        change()
+
+    @dbus.service.method("name.phdru.XSetBg", in_signature='', out_signature='')
+    def force(self):
+        change(force=True)
+
+    @dbus.service.method("name.phdru.XSetBg", in_signature='', out_signature='')
+    def stop(self):
+        mainloop.quit()
+
+    @dbus.service.method("name.phdru.XSetBg", in_signature='', out_signature='')
+    def stop(self):
+        mainloop.quit()
+
+
+if __name__ == '__main__':
+    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+    session_bus = dbus.SessionBus()
+    name = dbus.service.BusName("name.phdru.XSetBg", session_bus)
+    object = XsetBg(session_bus, '/XSetBg')
+
+    change(force=True)
+    mainloop = gobject.MainLoop()
+    mainloop.run()
similarity index 100%
rename from xsetbg-change
rename to xsetbg-http-change
similarity index 100%
rename from xsetbg-force
rename to xsetbg-http-force
diff --git a/xsetbg-http-restart b/xsetbg-http-restart
new file mode 100755 (executable)
index 0000000..81eb21b
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+"$HOME/lib/xsetbg"/xsetbg-http-stop && exec "$HOME/lib/xsetbg"/xsetbg-http-start
diff --git a/xsetbg-http-start b/xsetbg-http-start
new file mode 100755 (executable)
index 0000000..03a6cfb
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+umask 077
+nice -20 ionice -c3 "$HOME/lib/xsetbg"/xsetbg-wsgi.py >/dev/null 2>&1 &
similarity index 100%
rename from xsetbg-stop
rename to xsetbg-http-stop
diff --git a/xsetbg-restart b/xsetbg-restart
deleted file mode 100755 (executable)
index ca35682..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#! /bin/sh
-"$HOME/lib/xsetbg"/xsetbg-stop && exec "$HOME/lib/xsetbg"/xsetbg-start
diff --git a/xsetbg-start b/xsetbg-start
deleted file mode 100755 (executable)
index 85e3f1a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#! /bin/sh
-
-umask 077
-nice -20 ionice -c3 "$HOME/lib/xsetbg"/xsetbg.py >/dev/null 2>&1 &