仪表板屏幕保护程序的空闲时间检测(切换到另一个网站)

仪表板屏幕保护程序的空闲时间检测(切换到另一个网站)

我想创建一个仪表板,它会在一定空闲时间后更改网页,并在活动后跳转回原始页面。

不幸的是,我完全不懂编程,已经花了很多时间:我想整合我找到的代码,但我完全不知道该怎么做

我的代码:

  /etc/xdg/openbox/autostart *                                                                                                         

# If you want to use XFCE config tools...
#
#xfce-mcs-manager &
xset -dpms            # turn off display power management system
xset s noblank        # turn off screen blanking
xset s off            # turn off screen saver


# Remove exit errors from the config files that could trigger a warning

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences

# Run Chromium in kiosk mode
chromium-browser  --noerrdialogs --disable-infobars --enable-features=OverlayScrollbar --check-for-update-interval=31536000 --kiosk http://192.168.178.88:8123 https://dakboard.com/app/xxxxxxxx &



***while true; do
   xdotool keydown ctrl+Next; xdotool keyup ctrl+Next;
   sleep 10
done
* for testing***

我找到的空闲代码:

idleloop() {
    touch /tmp/.{,last_}input
    cmd='stat --printf="%s"'
    idletime=120
    a=2
    t=0
    while true
    do
        timeout 1 xinput test-xi2 --root > /tmp/.input
        
        if [[ `eval $cmd /tmp/.input` == `eval $cmd /tmp/.last_input` ]]
        then
            let t++ # increases $t by 1
        else
            t=0     # resets $t
        fi

        mv /tmp/.{,last_}input -f

        if [ $t -ge $idletime ] && [[ $a == "2" ]]
        then
            echo "user has gone idle"
            a=1
        fi
        if [ $t -lt $idletime ] && [[ $a == "1" ]]
        then
            echo "user has come back from idle"
            a=2
        fi
    done
}

idleloop

Br,

迈克尔

相关内容