[PATCH] xdg-screensaver: Support MATE desktop

Mansour mansour at oxplot.com
Sat Oct 5 08:32:16 PDT 2013


>From 83358a12ccb60177b6698db33fb85176c5400fde Mon Sep 17 00:00:00 2001
From: Mansour Behabadi <mansour at oxplot.com>
Date: Sun, 6 Oct 2013 01:07:38 +1000
Subject: [PATCH] xdg-screensaver: Support MATE desktop

Signed-off-by: Mansour Behabadi <mansour at oxplot.com>
---
 scripts/xdg-screensaver | 57 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/scripts/xdg-screensaver b/scripts/xdg-screensaver
index 2757c5b..801ef85 100755
--- a/scripts/xdg-screensaver
+++ b/scripts/xdg-screensaver
@@ -429,6 +429,10 @@ perform_action()
       screensaver_gnome_screensaver "$1"
       ;;

+    mate_screensaver)
+      screensaver_mate_screensaver "$1"
+      ;;
+
     xscreensaver)
       screensaver_xscreensaver "$1"
       ;;
@@ -815,6 +819,57 @@ screensaver_gnome_screensaver()
     esac
 }

+screensaver_mate_screensaver()
+{
+# mate-screensaver is almost identical to gnome's counterpart for now
+# but due to possibility of it diverging, we have a separate function
+# for it.
+    case "$1" in
+        suspend)
+        screensaver_suspend_loop mate-screensaver-command --poke
+        result=0
+        ;;
+
+        resume)
+        # Automatic resume when $screensaver_file disappears
+        result=0
+        ;;
+
+        activate)
+        mate-screensaver-command --activate > /dev/null 2> /dev/null
+        result=$?
+        ;;
+
+        lock)
+        mate-screensaver-command --lock > /dev/null 2> /dev/null
+        result=$?
+        ;;
+
+        reset)
+        # Turns the screensaver off right now
+        mate-screensaver-command --deactivate > /dev/null 2> /dev/null
+        result=$?
+        ;;
+
+        status)
+        result=0
+        if [ -f "$screensaver_file" ] ; then
+            echo "disabled"
+        elif mate-screensaver-command --query > /dev/null 2> /dev/null; then
+            echo "enabled"
+        else
+            # Something is wrong
+            echo "disabled"
+        fi
+        ;;
+
+        *)
+        echo "ERROR: Unknown command '$1" >&2
+        return 1
+        ;;
+    esac
+}
+
 screensaver_xscreensaver()
 {
     case "$1" in
@@ -918,6 +973,8 @@ detectDE
 xscreensaver-command -version 2> /dev/null | grep XScreenSaver >
/dev/null && DE="xscreensaver"
 # Consider "gnome-screensaver" a separate DE
 gnome-screensaver-command -q > /dev/null 2>&1 && DE="gnome_screensaver"
+# Consider "mate-screensaver" a separate DE
+mate-screensaver-command -q > /dev/null 2>&1 && DE="mate_screensaver"

 if [ "$action" = "resume" ] ; then
     do_resume
-- 
1.8.3.1


More information about the xdg mailing list