I'm looking for ways to more completely control my Intel based LibreELEC PC. Ideally I want to use my harmony hub companion remote to initiate suspend when the off button is pressed. I've been searching around the internet and I haven't found much information about suspending LibreELEC via HID device. This is probably easier to accomplish with an IR remote or a remote with a dedicated sleep button. If anyone has gone down this particular rabbit hole, I'm interested in knowing what you found.
Mainly, LibreELEC works great for me. My only real issue stems from the fact that Kodi will trigger idle functions while I have Chrome active. I read the wiki and I see there's a script to inhibit Kodi's idle functions while SSH, NFS, or Samba connections are active. Is there a way to modify the script to monitor for active Chrome instances to similarly inhibit idle functions? I've copied the script from the wiki. Unfortunately, I have no experience scripting to know where to begin. Can anyone offer advice?
#!/bin/sh
IDLE_SHUTDOWN_ALLOWED_LAST_STATE=-1
while true
do
KODI_RUNNING=`ps -A | grep kodi.bin | grep -v grep | wc -l`
if [ 1 == $KODI_RUNNING ] ; then
SSH_ACTIVE=`netstat -tnpa | grep 'tcp.*:22.*ESTABLISHED.*' | wc -l`
NFS_ACTIVE=`netstat -tnpa | grep 'tcp.*:111.*ESTABLISHED.*' | wc -l`
SMB_ACTIVE=`netstat -tnpa | grep 'tcp.*:445.*ESTABLISHED.*' | wc -l`
[ $SSH_ACTIVE -gt 0 -o $NFS_ACTIVE -gt 0 -o $SMB_ACTIVE -gt 0 ] && IDLE_SHUTDOWN_ALLOWED=1 || IDLE_SHUTDOWN_ALLOWED=0
if [ $IDLE_SHUTDOWN_ALLOWED_LAST_STATE != $IDLE_SHUTDOWN_ALLOWED ] ; then
IDLE_SHUTDOWN_ALLOWED_LAST_STATE=$IDLE_SHUTDOWN_ALLOWED
kodi-send --action="AllowIdleShutdown"
if [ 0 == $IDLE_SHUTDOWN_ALLOWED ] ; then
kodi-send --action="InhibitIdleShutdown(false)"
else
kodi-send --action="InhibitIdleShutdown(true)"
fi
fi
fi
sleep 60
done
Display More