鼠标移动器防止闲置?

mem*_*und 5 mouse

是否有任何可以在 ubuntu 上模拟鼠标移动的工作实用程序?

重要提示:如果机器空闲 X 分钟,我只希望该实用程序控制鼠标。

当然我可以xdotool用来模拟一些运动,但是我如何检测电脑是否闲置了 x 分钟?我找不到任何适用于 linux 的工作工具...

mem*_*und 19

同时我创建了自己的脚本:

#requires:
# 'xprintidle' for inactivity check (in ms)
# 'rand' for generating random number (screen resolution)
# 'xdotool' to move the mouse pointer

#parameters:
# 100000 idle time in ms before executing the mousemove
# 800 / 600: your screen resolution, at at least the moving range for the mouse pointer

while :; do
    if  [ $(xprintidle) -gt 100000 ]
    then
        xdotool mousemove `rand -M 800` `rand -M 600`;
    fi

    sleep 30
done
Run Code Online (Sandbox Code Playgroud)

  • Debian Bullseye 中似乎没有“rand”二进制文件。人们可以设法将其替换为以下内容: xdotool mousemove $(echo $(( ${RANDOM} % 800 ))) $(echo $(( ${RANDOM} % 600 ))) (2认同)

小智 10

有一个程序可以在检测到您离开或空闲时移动鼠标。

https://github.com/carrot69/keep-presence/

您可以从 snap 安装它:

sudo snap install keep-presence

然后运行它:

keep-presence --seconds 30

如果检测到您空闲,它将在 30 秒后移动鼠标。