pip3 install xprintidle
open idle_command_runner.py with an text editor and change the CMD
python3 ./idle_command_runner.py
python3 ./idle_command_runner.py
10 of 300 sec of inactivity befor start command
21 of 300 sec of inactivity befor start command
32 of 300 sec of inactivity befor start command
...
300 of 300 sec of inactivity befor start command
start command
...
1 of 300 sec of inactivity befor start command
stop command