From: Oleg Broytman Date: Fri, 18 Feb 2011 13:52:34 +0000 (+0000) Subject: xsetbg (DBus version). X-Git-Tag: v4.0.0~19 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=1e78bdb4689601d3b4b774cff2ad9dbdc00326c7;p=xsetbg.git xsetbg (DBus version). git-svn-id: file:///home/phd/archive/SVN/xsetbg/trunk@49 143022c7-580b-0410-bae3-87f2bf5d3141 --- diff --git a/xsetbg-dbus-change b/xsetbg-dbus-change new file mode 100755 index 0000000..99a4d22 --- /dev/null +++ b/xsetbg-dbus-change @@ -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 index 0000000..7d2e337 --- /dev/null +++ b/xsetbg-dbus-client.py @@ -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 " +__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 index 0000000..52f2e2b --- /dev/null +++ b/xsetbg-dbus-force @@ -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 index 0000000..c10e812 --- /dev/null +++ b/xsetbg-dbus-restart @@ -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 index 0000000..418deb1 --- /dev/null +++ b/xsetbg-dbus-start @@ -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 index 0000000..3d2bec8 --- /dev/null +++ b/xsetbg-dbus-stop @@ -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 index 0000000..386df21 --- /dev/null +++ b/xsetbg-dbus.py @@ -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 " +__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() diff --git a/xsetbg-change b/xsetbg-http-change similarity index 100% rename from xsetbg-change rename to xsetbg-http-change diff --git a/xsetbg-force b/xsetbg-http-force 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 index 0000000..81eb21b --- /dev/null +++ b/xsetbg-http-restart @@ -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 index 0000000..03a6cfb --- /dev/null +++ b/xsetbg-http-start @@ -0,0 +1,4 @@ +#! /bin/sh + +umask 077 +nice -20 ionice -c3 "$HOME/lib/xsetbg"/xsetbg-wsgi.py >/dev/null 2>&1 & diff --git a/xsetbg-stop b/xsetbg-http-stop similarity index 100% rename from xsetbg-stop rename to xsetbg-http-stop diff --git a/xsetbg-restart b/xsetbg-restart deleted file mode 100755 index ca35682..0000000 --- a/xsetbg-restart +++ /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 index 85e3f1a..0000000 --- a/xsetbg-start +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -umask 077 -nice -20 ionice -c3 "$HOME/lib/xsetbg"/xsetbg.py >/dev/null 2>&1 &