Added support for Unity
authorJames Bunton <jamesbunton@delx.net.au>
Wed, 29 Feb 2012 02:09:01 +0000 (13:09 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Wed, 29 Feb 2012 02:09:01 +0000 (13:09 +1100)
wallchanger.py

index 74be97b..4ee3b08 100755 (executable)
@@ -47,6 +47,10 @@ def init(*args, **kwargs):
        if commands.getstatusoutput("xwininfo -name 'KDE Desktop'")[0] == 0:
                changers.append(KDEChanger(*args, **kwargs))
 
+       logging.debug("Testing for Unity")
+       if commands.getstatusoutput("xlsclients | grep -qi unity")[0] == 0:
+               changers.append(UnityChanger(*args, **kwargs))
+
        logging.debug("Testing for Gnome")
        if commands.getstatusoutput("xwininfo -name 'gnome-settings-daemon'")[0] == 0:
                changers.append(GnomeChanger(*args, **kwargs))
@@ -254,6 +258,13 @@ class GnomeChanger(BaseChanger):
                logging.debug(cmd)
                return not self._runProgram(cmd)
 
+class UnityChanger(BaseChanger):
+       name = "Unity"
+       def set_image(self, file):
+               cmd = ['gsettings', 'set', 'org.gnome.desktop.background', 'picture-uri', 'file://'+file]
+               logging.debug(cmd)
+               return not self._runProgram(cmd)
+
 class KDEChanger(BaseChanger):
        name = "KDE"
        def set_image(self, file):