Announcement

Collapse
No announcement yet.

Programatic control "Screen Energy Saving" dbus??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Programatic control "Screen Energy Saving" dbus??

    I am looking to add some controls to a startup script for a program that will

    DISABLE Screen Energy Saving when the program starts
    RE-ENABLE Screen Energy Saving when the sprogram shutsdown.

    dbus

    via qdbus org.freedesktop.PowerManagement ?

    I am not a dbus guru, and what I am finding in searches is well, not really outlining how to use this to DISABLE/RE-ENABLE this as I want..

    Basically the BASH script would

    qdbus org.freedesktop.PowerManagement (DISABLE SCREEN ENERGY SAVING)
    /me/program/Program
    qdbus org.freedesktop.PowerManagement (RE-ENABLE SCREEN ENERGY SAVING)

    I don't mind the screen dimming, whille this runs, but manually changing this setting each time is well so wrong.

    Any pointers to do this? dbus? Something else?

    Thanks!

    #2
    (I presume you know about exploring the dbus with qdbus.)

    Perhaps
    Code:
    qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver org.freedesktop.ScreenSaver.Inhibit "my purpose" "my reason"  
    12482
    # sometime later
    qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver org.freedesktop.ScreenSaver.UnInhibit 12482
    I didn't check whether that had any effect.
    Regards, John Little

    Comment


      #3
      Originally posted by jlittle View Post
      (I presume you know about exploring the dbus with qdbus.).
      Umm... "I am not a dbus guru," so, Nope.


      Originally posted by jlittle View Post
      Perhaps
      Code:
      qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver org.freedesktop.ScreenSaver.Inhibit "my purpose" "my reason"
      12482
      # sometime later
      qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver org.freedesktop.ScreenSaver.UnInhibit 12482
      I didn't check whether that had any effect.
      Thanks I will look at that to see.

      What I am looking for is something that explains..

      ie: here is a list of settings available via dbus, and an index which has "Screen Energy Saving" and there are the settings for on/off.

      Simple easy peasy stuff spell it out. Don't be like ALSA which has documentation like you are some how the creator of all sounds of the universe.

      Comment


        #4
        I said
        I presume you know about exploring the dbus with qdbus.
        Originally posted by rec9140 View Post
        Umm... "I am not a dbus guru," so, Nope.
        I imagine very few people are dbus gurus, I certainly am not, but anyone one can explore. I'll relate the process I went through.

        One can start, in a konsole, by running just qdbus. That lists all the services listening on the dbus. Then one picks a service that might be what you want, and runs qdbus giving that service; in this case I thought org.freedesktop.ScreenSaver might be interesting, so I ran
        Code:
        qdbus org.freedesktop.ScreenSaver
        That lists the "paths" that service supports; the most interesting one is often similar to the service, with "/" separators instead of ".". So then I ran
        Code:
        qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver
        That lists the methods for that service and path, and gives some idea of the parameters each service might take. The Inhibit method output a number when I ran it, and the UnInhibit method takes a "uint cookie" (presumably a uint is an unsigned integer), so I guessed the number output is the cookie I should use.

        Rather than the command line tool qdbus, one can use the GUI qdbusviewer (in the APT package qttools5-dev-tools). Point and click, but its listing of the methods doesn't show the parameters until you click on the method, so I find it slower to work with.
        Regards, John Little

        Comment

        Working...
        X