I would like to write a script to prevent a computer from locking by virtually wiggling the mouse. However, I do not have xdotool
on the computer that I am using, and I cannot install since I am not root. Is there a way to move the cursor without using xdotool
?
That you cannot install xdotool
because you are not root doesn't mean you cannot run the program, for that you don't need any special privileges.
Just download and compile from source.
If you don't have access to a compiler then you can download the package for your system directly and extract the file from the package (for .deb
first use ar
, extracting from .rpm
can be done with rpm2cpio
)
According to this answer you can move the pointer of your mouse with command-line with the following procedure:
First you need to find mouse input device with
grep mouse /proc/bus/input/devices | grep event
You should see something like
H: Handlers=mouse0 event7
in my case. It could output more then one line if you have more then one mouse (e.g. touchpad). The important part isevent7
, it means you will write to/dev/input/event7
.Then the following will move mouse pointer 100 pixels to the right:
seconds=$(date +%s) type=2 # EV_REL code=0 # REL_X value=100 # 100 pixels printf '%08X%04X%04X%08X%08X\n' $value $code $type 0 $seconds | xxd -r -p | \ perl -0777e 'print scalar reverse <>' > /dev/input/event7 type=0 # EV_SYN code=0 # SYN_REPORT value=0 printf '%08X%04X%04X%08X%08X\n' $value $code $type 0 $seconds | xxd -r -p | \ perl -0777e 'print scalar reverse <>' > /dev/input/event7
I didn't test whether this procedure is equivalent to real mouse movement in the sense of interrupting locking mechanism.
dbus-send
an option to disable the screensaver? How can I trigger the screensaver's locking feature using D-BUS from the command line? – slm♦ Oct 26 '14 at 5:06