Use an external script to manipulate the display
authorEnrico Zini <enrico@enricozini.org>
Mon, 28 Sep 2009 15:09:12 +0000 (16:09 +0100)
committerEnrico Zini <enrico@enricozini.org>
Mon, 28 Sep 2009 15:09:12 +0000 (16:09 +0100)
src/app_power.vala
src/config.vala
src/zavai.vala

index 6a3533e2683f1509ec06e62787ddefaa5f03e16f..4bdf2e63396a3a73dd209b4e94100600ee3a5400 100644 (file)
@@ -379,8 +379,9 @@ public class Backlight: zavai.Service
                try {
                        //display.SetBacklightPower(true);
                        //usage.SetResourcePolicy("Display", "auto");
-                       usage.RequestResource("Display");
-                       usage.ReleaseResource("Display");
+                       //usage.RequestResource("Display");
+                       //usage.ReleaseResource("Display");
+                       zavai.app.run_script(zavai.config.homedir + "/display wiggle");
                } catch (Error e) {
                        zavai.log.error("Requesting/releasing resource Display: " + e.message);
                }
@@ -392,7 +393,7 @@ public class Backlight: zavai.Service
                {
                        try {
                                //display.SetBacklightPower(false);
-                               zavai.app.run_script(zavai.config.xset_dpms_turn_off);
+                               zavai.app.run_script(zavai.config.homedir + "/display lock_off");
                                /*
                                string policy = usage.GetResourcePolicy("Display");
                                if (policy == "auto")
@@ -410,7 +411,7 @@ public class Backlight: zavai.Service
        {
                try {
                        //display.SetBacklightPower(true);
-                       zavai.app.run_script(zavai.config.xset_dpms_long_wait);
+                       zavai.app.run_script(zavai.config.homedir + "/display defaults");
                        //usage.SetResourcePolicy("Display", "auto");
                } catch (GLib.Error e) {
                        zavai.log.error(e.message);
@@ -424,7 +425,7 @@ public class Backlight: zavai.Service
                if (started) return;
                try {
                        usage.RequestResource("Display");
-                       zavai.app.run_script(zavai.config.xset_dpms_always_on);
+                       zavai.app.run_script(zavai.config.homedir + "/display lock_on");
                        zavai.log.info("Acquired display");
                        base.start();
                } catch (GLib.Error e) {
@@ -439,7 +440,7 @@ public class Backlight: zavai.Service
                if (!started) return;
                try {
                        usage.ReleaseResource("Display");
-                       zavai.app.run_script(zavai.config.xset_dpms_long_wait);
+                       zavai.app.run_script(zavai.config.homedir + "/display defaults");
                        zavai.log.info("Released display");
                        base.stop();
                } catch (GLib.Error e) {
index 42617790b6bef3486c6a42fad6981691eae45a3c..4626d22d3de5d48d35dfd5d420f2d37257e2f9c5 100644 (file)
@@ -25,10 +25,6 @@ public class Config
     public string version { get; set; }
     public string homedir { get; set; }
     public string icondir { get; set; }
-    public string xset_dpms_always_on { get; set; }
-    public string xset_dpms_turn_off { get; set; }
-    public string xset_dpms_long_wait { get; set; }
-    public string xset_dpms_short_wait { get; set; }
     public int min_button_height { get; set; }
 
     public Config()
@@ -38,10 +34,6 @@ public class Config
         homedir = GLib.Environment.get_home_dir() + "/.zavai";
         icondir = "./icons";
         min_button_height = 80;
-       xset_dpms_always_on = "xset dpms force on; xset dpms 0 0 0";
-       xset_dpms_turn_off = "xset dpms force off; xset dpms 0 0 5";
-       xset_dpms_long_wait = "xset dpms force on; xset dpms 0 0 30";
-       xset_dpms_short_wait = "xset dpms force on; xset dpms 0 0 5";
     }
 
 /*
index 1b02d8e97a411cb249c7e7ec2dc3b698d3f6bb51..eaa9aeff1c6182a860622dad6b73e087dbcefa5f 100644 (file)
@@ -75,7 +75,7 @@ static int main (string[] args) {
        // User interface
        zavai.ui.main.init();
        zavai.ui.gps.init();
-       zavai.app.run_script(zavai.config.xset_dpms_long_wait);
+       zavai.app.run_script(zavai.config.homedir + "/display init");
        zavai.ui.power.init();
        zavai.ui.kbd.init();
        zavai.ui.wm.init();