accessibility/ydotool: Updated for version 1.0.4.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-07-12 04:26:29 -04:00 committed by Willy Sudiarto Raharjo
parent dfe098fafd
commit 4003242c76
No known key found for this signature in database
GPG key ID: 3F617144D7238786
5 changed files with 238 additions and 215 deletions

View file

@ -15,3 +15,11 @@ SlackBuild installs ydotool setuid root, but only users in the
real keyboard and mouse, it doesn't seem like a huge security risk to
let them send fake events. If this bothers you, run the script with
SETUID=no in the environment to disable it.
ydotool also requires its daemon (ydotoold) to be running. It can be
started manually, or you could start it from /etc/rc.d/rc.local with
code like this:
if [ -x /usr/sbin/ydotoold ]; then
/usr/sbin/ydotoold &> /var/log/ydotoold/log &
fi

View file

@ -1,25 +1,26 @@
.\" Generated by scdoc 1.11.1
.\" Generated by scdoc 1.11.2
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "YDOTOOL" "1" "2022-02-01"
.P
.TH "YDOTOOL" "1" "2023-07-12"
.SH NAME
.P
ydotool - command-line \fI/dev/uinput\fR automation tool
.P
.SH SYNOPSIS
.P
\fBydotool\fR \fBcmd\fR \fIargs.\&.\&.\&\fR
\fBydotool\fR \fBcmd\fR \fIargs\fR
.P
\fBydotool\fR \fBcmd\fR --help
.P
.SH DESCRIPTION
.P
\fBydotool\fR lets you programmatically (or manually) simulate keyboard input and mouse activity, etc.\& It does this by writing directly to \fI/dev/uinput\fR so it generally needs to run as root.\&
\fBydotool\fR lets you programmatically (or manually) simulate keyboard input and mouse activity, etc.\&
The \fBydotoold\fR(8) daemon must be running.\&
.P
.P
Currently implemented command(s):
.P
@ -35,254 +36,250 @@ Press keys
.RS 4
Move mouse pointer to absolute position
.RE
\fBmousemove_relative\fR
.RS 4
Move mouse pointer to relative position
.RE
\fBclick\fR
.RS 4
Click on mouse buttons
.RE
\fBrecorder\fR
.RS 4
Record/replay input events
.RE
\fBmouseup\fR
.RS 4
Send a mouse up event.\&
.RE
\fBmousedown\fR
.RS 4
Send a mouse down event.\&
.P
.RE
.SH KEYBOARD COMMANDS
\fBkey\fR [\fB--up\fR] [\fB--down\fR] [\fB--delay\fR \fI<ms>\fR] [\fB--key-delay\fR \fI<ms>\fR] [\fB--repeat\fR \fI<times>\fR] [\fB--repeat-delay <ms>\fR] [\fB--persist-delay <ms>\fR] \fI<key sequence>\fR
\fBkey\fR [\fB-d\fR,\fB--key-delay\fR \fI<ms>\fR] [\fI<KEYCODE:PRESSED>\fR .\&.\&.\&]
.P
.RS 4
Type a given keystroke.\& Examples being "alt+r", "ctrl+J",
"ctrl+alt+n", "backspace".\&
Type a given keycode.\&
.P
e.\&g.\& 28:1 28:0 means pressing on the Enter button on a standard US keyboard.\&
(where :1 for pressed means the key is down and then :0 means the key is released)
.P
42:1 38:1 38:0 24:1 24:0 38:1 38:0 42:0 - "LOL"
.P
Non-interpretable values, such as 0, aaa, l0l, will only cause a delay.\&
.P
See `/usr/include/linux/input-event-codes.\&h'\& for available key codes (KEY_*).\&
.P
You can find the key name/number your keyboard is sending to libinput by running `sudo libinput record` and then selecting your keyboard from the list it will show you the libinput proper key name and number for each key you press.\&
.P
Options:
.P
\fB--up\fR
.RS 4
Only keyup
.P
.RE
\fB--down\fR
.RS 4
Only keydown
.P
.RE
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before starting to output keystrokes.\& Default 100ms.\&
.P
.RE
\fB--key-delay\fR \fI<ms>\fR
\fB-d\fR,\fB--key-delay\fR \fI<ms>\fR
.RS 4
Delay time between keystrokes.\& Default 12ms.\&
.P
.RE
\fB--repeat\fR \fI<times>\fR
.RS 4
Times to repeat the key sequence.\&
.P
.RE
\fB--repeat-delay\fR \fI<ms>\fR
.RS 4
Delay time between repetitions.\& Default 0ms.\&
.P
.RE
\fB--persist-delay\fR \fI<ms>\fR
.RS 4
Keep virtual device alive for \fI<ms>\fR ms.\& Should be used in conjunction with \fB--down\fR or \fB--up\fR
.P
.RE
Generally, any valid name from \fI/usr/include/linux/input-event-codes.\&h\fR will work.\& Multiple keys are separated by '+'.\&
.P
Each key sequence can be any number of modifiers and keys, separated by plus (+)
For example: alt+r Alt+F4 CTRL+alt+f3 aLT+1+2+3 ctrl+Backspace
.P
Since we are emulating keyboard input, combinations like Shift+# is invalid because typing a `#' involves pressing Shift and 3.\&
.P
Example: Switch to tty1:
.RS 4
ydotool key ctrl+alt+f1
.P
.RE
Example: Close a window in graphical environment:
.RS 4
ydotool key Alt+F4
.P
.RE
.RE
\fBtype\fR [\fB--delay\fR \fI<ms>\fR] [\fB--key-delay\fR \fI<ms>\fR] [\fB--args\fR \fI<N>\fR] [\fB--file\fR \fI<filepath>\fR] "\fIsomething to type\fR"
\fBtype\fR [\fB-D\fR,\fB--next-delay\fR \fI<ms>\fR] [\fB-d\fR,\fB--key-delay\fR \fI<ms>\fR] [\fB-f\fR,\fB--file\fR \fI<filepath>\fR] "\fItext\fR"
.P
.RS 4
Types text as if you had typed it on the keyboard.\&
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
\fB-d\fR,\fB--key-delay\fR \fI<ms>\fR
.RS 4
Delay before starting typing.\& Default 100ms.\&
Delay time between key events (up/down each).\& Default 12ms.\&
.P
.RE
\fB--key-delay\fR \fI<ms>\fR
\fB-D\fR,\fB--next-delay\fR \fI<ms>\fR
.RS 4
Delay time between keystrokes.\& Default 12ms.\&
Delay between strings.\& Default 0ms.\&
.P
.RE
\fB--args\fR \fI<N>\fR
\fB-f\fR,\fB--file\fR \fI<filepath>\fR
.RS 4
?\&?\&?\&?\&
Specify a file, the contents of which will be typed as if passed as an argument.\& The filepath may also be '\&-'\& to read from stdin.\&
.P
.RE
\fB--file\fR \fI<filepath>\fR
Example: to type '\&Hello world!\&'\& you would do:
.RS 4
Specify a file, the contents of which will be typed as if passed as an argument.\& The filepath may also be '-' to read from stdin.\&
.P
.RE
Example: to type 'Hello world!\&' you would do:
.RS 4
ydotool type 'Hello world!\&'
ydotool type '\&Hello world!\&'\&
.P
.RE
.RE
.SH MOUSE COMMANDS
.P
\fBmousemove\fR [\fB--delay\fR \fI<ms>\fR] \fI<x> <y>\fR
\fBmousemove\fR [\fB-a\fR,\fB--absolute\fR] \fI<x> <y>\fR
.RS 4
Move the mouse to the specific X and Y coordinates on the screen.\&
Move the mouse to the relative X and Y coordinates on the screen.\&
.P
Options:
\fB--delay\fR \fI<ms>\fR
\fB--absolute\fR
.RS 4
Delay before starting move.\& Default 100ms.\&
Use absolute position
.P
.RE
Example: to move the cursor to absolute coordinates (100,100):
.RS 4
ydotool mousemove 100 100
ydotool mousemove --absolute 100 100
.P
.RE
.RE
\fBmousemove_relative\fR [\fB--delay\fR \fI<ms>\fR] \fI<x>\fR \fI<y>\fR
\fBclick\fR [\fB-d\fR,\fB--next-delay\fR \fI<ms>\fR] [\fB-r\fR,\fB--repeat\fR \fIN\fR ] [\fIbutton\fR .\&.\&.\&]
.RS 4
Move the mouse x,y pixels relative to the current position of the mouse cursor.\&
Send a click.\&
.P
Options:
\fB--delay\fR \fI<ms>\fR
\fB-d\fR,\fB--next-delay\fR \fI<ms>\fR
.RS 4
Delay before starting move.\& Default 100ms.\&
Delay between input events (up/down, a compete click means doubled time).\& Default 25ms.\&
.P
.RE
Example: Relatively move mouse pointer to -100,100:
\fB-r\fR,\fB--repeat\fR \fIN\fR
.RS 4
ydotool mousemove_relative -- -100 100
Repeat entire sequence N times
.P
.RE
.RE
\fBclick\fR [\fB--delay\fR \fI<ms>\fR] \fIbutton\fR
.RS 4
Send a click.\& Buttons are: 1=left 2=right 3=middle
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
.RS 4
Delay before click.\& Default 100ms.\&
.P
.RE
Example: Mouse right click:
.RS 4
ydotool click 2
.P
.RE
.RE
\fBrecorder\fR [\fB--delay\fR \fI<ms>\fR] [\fB--record\fR \fI<devices>\fR] [\fB--replay\fR \fI<input files>\fR] [\fB--display\fR] [\fB--duration\fR \fI<ms>\fR]
all mouse buttons are represented using hexadecimal numeric values, with an optional
bit mask to specify if mouse up/down needs to be omitted.\&
.P
.RS 4
Options:
.P
\fB--delay\fR \fI<ms>\fR
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x00 - LEFT
.RE
.RS 4
Delay time before start recording/replaying.\& Default 5000ms.\&
.P
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x01 - RIGHT
.RE
\fB--record\fR \fI<devices>\fR
.RS 4
Devices to record from.\& Default is all, including non-keyboard devices.\&
.P
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x02 - MIDDLE
.RE
\fB--replay\fR \fI<input files>\fR
.RS 4
The record file can't be replayed on an architecture with different endianness.\&
.P
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x03 - SIDE
.RE
\fB--display\fR
.RS 4
?\&?\&?\&?\&
.P
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x04 - EXTR
.RE
\fB--duration\fR \fI<ms>\fR
.RS 4
Record duration.\& Otherwise use SIGINT to stop recording.\&
.P
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x05 - FORWARD
.RE
.RE
\fBmouseup\fR [\fB--delay\fR \fI<ms>\fR] \fIbutton\fR
.RS 4
Send a mouse up event.\& Buttons are: 1=left 2=right 3=middle
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x06 - BACK
.RE
.RS 4
Delay before click.\& Default 100ms.\&
.P
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x07 - TASK
.RE
Example: Mouse right click:
.RS 4
ydotool click 2
.P
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x40 - Mouse down
.RE
.RE
\fBmousedown\fR [\fB--delay\fR \fI<ms>\fR] \fIbutton\fR
.RS 4
Send a mouse down event.\& Buttons are: 1=left 2=right 3=middle
.P
Options:
.P
\fB--delay\fR \fI<ms>\fR
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x80 - Mouse up
.RE
.RS 4
Delay before click.\& Default 100ms.\&
.P
.RE
Example: Mouse right click:
.RE
Examples:
.P
.RS 4
ydotool click 2
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x00: chooses left button, but does nothing (you can use this to implement extra sleeps)
.RE
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0xC0: left button click (down then up)
.RE
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x41: right button down
.RE
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.IP \(bu 4
.\}
0x82: middle button up
.RE
.P
The '\&0x'\& prefix can be omitted if you want.\&
.P
.RE
.RE
.SH YDOTOOL SOCKET
.P
The socket to write to for \fBydotoold\fR(8) can be changed by the environment variable YDOTOOL_SOCKET.\&
.P
.SH AUTHOR
.P
ydotool was written by ReimuNotMoe.\&
.P
This man page by bob.\&hepple@gmail.\&com
This manpage was written by bob.\&hepple@gmail.\&com but updated since.\&
.P
.SH BUGS
.P
When \fBydotool\fR(1) runs and creates a virtual input device, it will take some time for your graphical environment (eg X11/Wayland) to recognize and enable the virtual input device.\& (Usually done by udev)
.P
If the delay is too short, the virtual input device may not be recognized & enabled by the graphical environment in time.\&
.P
In order to solve this problem, there is a persistent background service, \fBydotoold\fR(1), to hold a persistent virtual device, and accept input from \fBydotool\fR(1).\& When \fBydotoold\fR(1) is unavailable, \fBydotool\fR(1) will work without it.\&
.P
.SH COPYRIGHT
MIT License
.SH LICENCE
AGPLv3
.P
.SH SEE ALSO
.P

View file

@ -6,20 +6,15 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# Note: this is not the latest version of ydotool, though it's newer
# than the version that Debian packages. It uses the stable(ish)
# libevdevplus and libuinputplus versions that Debian also packages.
# Later ytodool, libevdevplus, and libuinputplus versions are
# rapidly-moving targets for now. Plus, latest ydotool uses "CPM"
# (Cmake Package Manager) to auto-download its dependencies, and I
# haven't had time to figure out how to defeat that so the script can
# run without doing network access...
# 20230712 bkw: updated for v1.0.4. Many changes upstream.
# - no longer need REQUIRES="libuinputplus libevdevplus".
# - regenerated bundled man pages.
# - updated README to mention the daemon, since it's now required.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=ydotool
VERSION=${VERSION:-0.1.9}
VERSION=${VERSION:-1.0.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -67,40 +62,52 @@ chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# The cmake project version variables control the shared library's
# version, which should match the actual ytodool version... version
# 0.1.9 thinks it's 0.1.5.
patch -p1 < $CWD/project_version.diff
# Upstream's man pages are in scdoc format, which looks like a pretty
# nice text-to-manpage mini-language. Rather than require scdoc as a
# dependency, I just converted the man pages and included them with
# the script. If they ever need to be generated again: install scdoc,
# then run this with BUILD_MAN=yes, which will create $CWD/ydotool.1
# and $CWD/ydotoold.8... then run "git add ydotool.1 ydotoold.8".
# 20230712 bkw: cmake is harder to fake out than make by himself.
BUILD_MAN="${BUILD_MAN:-no}"
if [ "$BUILD_MAN" = "yes" ]; then
# BUILD_MAN=yes is a maintainer option, nobody else needs to use it.
if [ ! -x /usr/bin/scdoc ]; then
echo "*** $0: BUILD_MAN=yes requires scdoc to be installed."
exit 1
fi
else
# Regular build, will use pre-generated man pages from $CWD, so
# disable it in CMakeLists.txt.
sed -i '/add_subdirectory(manpage)/d' CMakeLists.txt
fi
mkdir -p build
cd build
cmake \
-DDYNAMIC_BUILD=on \
-DSTATIC_BUILD=off \
-DCMAKE_CXX_FLAGS_RELEASE="$SLKCFLAGS -DNDEBUG" \
-DCMAKE_C_FLAGS_RELEASE="$SLKCFLAGS -DNDEBUG" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
-DMAN_INSTALL_DIR=/usr/man \
-DCMAKE_INSTALL_MANDIR=/usr/man \
-DCMAKE_BUILD_TYPE=Release ..
make VERBOSE=1
make install/strip DESTDIR=$PKG
cd ..
# Upstream's man pages are in scdoc format, which looks like a pretty
# nice text-to-manpage mini-language. Rather than require scdoc as a
# dependency, I just converted the man pages and included them with
# the script. If they ever need to be generated again, use this:
# 20230712 bkw: the daemon has a .8 man page, it should go here:
mkdir -p $PKG/usr/sbin
mv $PKG/usr/bin/ydotoold $PKG/usr/sbin
if [ "${CONVERT_MAN:-no}" = "yes" ]; then
sed -i 's,\\fR,,' manpage/ydotool.1.scd
scdoc < manpage/ydotool.1.scd > $CWD/ydotool.1
scdoc < manpage/ydotoold.8.scd > $CWD/ydotoold.8
if [ "$BUILD_MAN" = "yes" ]; then
cp build/manpage/ydotool{.1,d.8} $CWD
else
mkdir -p $PKG/usr/man/man{1,8}
cat $CWD/ydotool.1 > $PKG/usr/man/man1/ydotool.1
cat $CWD/ydotoold.8 > $PKG/usr/man/man8/ydotoold.8
fi
PMAN=$PKG/usr/man
mkdir -p $PMAN/man{1,8}
gzip -9c < $CWD/$PRGNAM.1 > $PMAN/man1/$PRGNAM.1.gz
gzip -9c < $CWD/${PRGNAM}d.8 > $PMAN/man8/${PRGNAM}d.8.gz
gzip -9 $PKG/usr/man/man*/*
# Install setuid unless disabled. See README for rationale.
if [ "${SETUID:-yes}" = "yes" ]; then

View file

@ -1,10 +1,10 @@
PRGNAM="ydotool"
VERSION="0.1.9"
VERSION="1.0.4"
HOMEPAGE="https://github.com/ReimuNotMoe/ydotool"
DOWNLOAD="https://github.com/ReimuNotMoe/ydotool/archive/v0.1.9/ydotool-0.1.9.tar.gz"
MD5SUM="5b1de1443bd62c1bd60219d8972e5fb6"
DOWNLOAD="https://github.com/ReimuNotMoe/ydotool/archive/v1.0.4/ydotool-1.0.4.tar.gz"
MD5SUM="2552acf3068a880c1d27e8dfe928ed0d"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="libuinputplus libevdevplus"
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="urchlay@slackware.uk"

View file

@ -1,11 +1,11 @@
.\" Generated by scdoc 1.11.1
.\" Generated by scdoc 1.11.2
.\" Complete documentation for this program is not available as a GNU info page
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.\" Begin generated content:
.TH "ydotoold" "8" "2022-02-01"
.TH "ydotoold" "8" "2023-07-12"
.P
.SH NAME
.P
@ -13,29 +13,40 @@ ydotoold - daemon for \fBydotool\fR(1)
.P
.SH SYNOPSIS
.P
\fBydotoold\fR
\fBydotoold\fR \fI[OPTION.\&.\&.\&]\fR
.P
.SH DESCRIPTION
.P
\fBydotool\fR lets you programmatically (or manually) simulate
keyboard input and mouse activity, etc.\& It does this by writing
directly to \fB/dev/uinput\fR so it generally needs to run as root.\&
\fBydotoold\fR holds a persistent virtual device, and accepts input from \fBydotool\fR(1).\&
.P
When \fBydotool\fR(1) runs and creates a virtual input device, it will take some time for your graphical environment (eg X11/Wayland) to recognize and enable the virtual input device.\& (Usually done by udev)
.SH OPTIONS
.P
If the delay is too short, the virtual input device may not be recognized & enabled by the graphical environment in time.\&
.RS 4
\fB-p\fR, \fB--socket-path arg\fR \fI<path>\fR
.RS 4
Set socket path.\&
.P
In order to solve this problem, the \fBydotoold\fR background service holds a persistent virtual device, and accepts input from \fBydotool\fR(1).\& When \fBydotoold\fR(1) is unavailable, \fBydotool\fR(1) will work without it.\&
.RE
\fB-P\fR, \fB--socket-perm arg\fR \fI<perms>\fR
.RS 4
Set socket permission.\&
.P
.RE
\fB-h\fR, \fB--help\fR
.RS 4
Display help and exit.\&
.P
.RE
.RE
.SH AUTHOR
.P
\fBydotool\fR(1) and \fBydotoold\fR(8) were written by ReimuNotMoe.\&
.P
This man page by bob.\&hepple@gmail.\&com
This manpage was written by bob.\&hepple@gmail.\&com but updated since.\&
.P
.SH COPYRIGHT
.SH LICENCE
.P
MIT License
AGPLv3
.P
.SH SEE ALSO
.P