How to deactivate screensaver after resume from suspend?

  • Hi,


    Does anybody know how I can deactivate my screensaver after Kodi is resumed again after a suspend?

    The reason that I ask is that my Kodi screensaver is still active after being resumed.

    On resume I would like to execute the buit-in function "ActivateWindow(home)" in order to deactivate the screensaver.

    I created a resume script in the /storage/.config/sleep.d folder containing the command "kodi-send --action=ActivateWindow(home)", but that didnot work.

    Seems that Kodi is not active yet when the resume script gets executed. When I execute the command manually in a Putty window then the command works fine.

    Another solution might be to use the addon "Kodi Callbacks", but then I need to know which event I can use to trigger the command?

    Any help / suggestions are very much appreciated.


    Thanks,

    Jeroen

  • You could add a sleep xx to your script to wait xx seconds for Kodi to become "active".

    I added "sleep 20" but it is not working. On the screen I just see a rotating cursor for 20 secs and after that Kodi is ready.

    So I think Kodi is waiting for the resume script to be completely finished, before it accepts any new input/commands.

  • What architecture is this? amd64?


    I've no idea apart from that.


    It might help others if you provide log details: Post URL (After resume) from

    dmesg|paste

    cat /storage/.kodi/temp/kodi.log|paste

  • Hi @Iridium,


    I am using Intel architecture.

    See log details ==> http://ix.io/2dKp


    This is how my sript looks like (/storage/.config/sleep.d/02-home.power) :

    Bash
    #!/bin/sh
    case "$1" in
    pre)
    kodi-send --action="Action(close)" --delay=100 --action="ActivateWindow(home)" >> /tmp/test.log
    ;;
    post)
    kodi-send --action="Action(close)" --delay=100 --action="ActivateWindow(home)" >> /tmp/test.log
    ;;
    esac


    I can see in the /tmp/test.log file that the kodi-send action was executed.

    However the actions seem to be ignored by Kodi, because nothing happens with the screen.

    When Kodi is resumed again the screen is still in the old situation.


    Code
    Macmini:~/.config/sleep.d # more /tmp/test.log
    Sending: {'content': 'Action(close)', 'type': 'action'}
    Sending: {'content': 100, 'type': 'delay'}
    Sending: {'content': 'ActivateWindow(home)', 'type': 'action'}
    Sending: {'content': 'Action(close)', 'type': 'action'}
    Sending: {'content': 100, 'type': 'delay'}
    Sending: {'content': 'ActivateWindow(home)', 'type': 'action'}
  • I have found another solution that works for me.


    Created a service "/storage/.config/system.d/kodiresume.service" that gets invoked during resume from suspend.

    Enabled the service with following command line:

    cd /storage/.config/system.d/

    systemctl enable kodiresume.service


    The service file contains the following: