Github messages for voidlinux
 help / color / mirror / Atom feed
From: JohnGebbie <JohnGebbie@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New package: ydotool-1.0.1
Date: Wed, 10 Aug 2022 14:54:11 +0200	[thread overview]
Message-ID: <20220810125411.xb7DnYG1cxmDP5RZx03oAhVCK7IM25VYFOmhwaFcJqA@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-38268@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages ydotool
https://github.com/void-linux/void-packages/pull/38268

New package: ydotool-1.0.1
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures:
  - aarch64-musl
  - armv7l
  - armv6l-musl


I copied https://github.com/void-linux/void-packages/pull/31237 but ydotool has got easier to install.
To use it, you enable the ydotoold service and add your user to the "input" group.
This should press and release the A key: `ydotool key 30:1 30:0`

Currently I seem to need to `sv restart ydotoold` after I reboot.
Their manpages are out of date: https://github.com/ReimuNotMoe/ydotool/pull/144

Closes https://github.com/void-linux/void-packages/issues/31163

A patch file from https://github.com/void-linux/void-packages/pull/38268.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ydotool-38268.patch --]
[-- Type: text/x-diff, Size: 9637 bytes --]

From 68997073e23f82ba0b94b8363463d0669b221cf6 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Mon, 8 Aug 2022 20:37:27 +0100
Subject: [PATCH] New package: ydotool-1.0.1

---
 srcpkgs/ydotool/INSTALL.msg               |   6 +
 srcpkgs/ydotool/files/80-uinput.rules     |   3 +
 srcpkgs/ydotool/files/ydotool-workaround  |   2 +
 srcpkgs/ydotool/files/ydotool.1           | 287 ++++++++++++++++++++++
 srcpkgs/ydotool/files/ydotoold-workaround |   2 +
 srcpkgs/ydotool/files/ydotoold/run        |   5 +
 srcpkgs/ydotool/template                  |  30 +++
 7 files changed, 335 insertions(+)
 create mode 100644 srcpkgs/ydotool/INSTALL.msg
 create mode 100644 srcpkgs/ydotool/files/80-uinput.rules
 create mode 100755 srcpkgs/ydotool/files/ydotool-workaround
 create mode 100644 srcpkgs/ydotool/files/ydotool.1
 create mode 100755 srcpkgs/ydotool/files/ydotoold-workaround
 create mode 100755 srcpkgs/ydotool/files/ydotoold/run
 create mode 100644 srcpkgs/ydotool/template

diff --git a/srcpkgs/ydotool/INSTALL.msg b/srcpkgs/ydotool/INSTALL.msg
new file mode 100644
index 000000000000..1812d29a7afc
--- /dev/null
+++ b/srcpkgs/ydotool/INSTALL.msg
@@ -0,0 +1,6 @@
+udev rules for uinput has been installed,
+to access /dev/uinput, add yourself to group input:
+
+    $ sudo usermod -a -G input $USER
+
+and then re-login to make it effective.
diff --git a/srcpkgs/ydotool/files/80-uinput.rules b/srcpkgs/ydotool/files/80-uinput.rules
new file mode 100644
index 000000000000..988d34547f52
--- /dev/null
+++ b/srcpkgs/ydotool/files/80-uinput.rules
@@ -0,0 +1,3 @@
+## ydotoold fix
+## https://github.com/ReimuNotMoe/ydotool/issues/25#issuecomment-535842993
+KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
diff --git a/srcpkgs/ydotool/files/ydotool-workaround b/srcpkgs/ydotool/files/ydotool-workaround
new file mode 100755
index 000000000000..7264726a6433
--- /dev/null
+++ b/srcpkgs/ydotool/files/ydotool-workaround
@@ -0,0 +1,2 @@
+#!/bin/sh
+YDOTOOL_SOCKET="${YDOTOOL_SOCKET:-/var/lib/ydotoold/socket}" /usr/libexec/ydotool "$@"
diff --git a/srcpkgs/ydotool/files/ydotool.1 b/srcpkgs/ydotool/files/ydotool.1
new file mode 100644
index 000000000000..d054dd7ec3e5
--- /dev/null
+++ b/srcpkgs/ydotool/files/ydotool.1
@@ -0,0 +1,287 @@
+.\" 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-08-10"
+.SH NAME
+.P
+ydotool - command-line \fI/dev/uinput\fR automation tool
+.P
+.SH SYNOPSIS
+.P
+\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.\&
+.P
+Currently implemented command(s):
+.P
+\fBtype\fR
+.RS 4
+Type a string
+.RE
+\fBkey\fR
+.RS 4
+Press keys
+.RE
+\fBmousemove\fR
+.RS 4
+Move mouse pointer to absolute position
+.RE
+\fBclick\fR
+.RS 4
+Click on mouse buttons
+.P
+.RE
+.SH KEYBOARD COMMANDS
+\fBkey\fR [\fB-d\fR,\fB--key-delay\fR \fI<ms>\fR] [\fI<KEYCODE:PRESSED>\fR .\&.\&.\&]
+.P
+.RS 4
+Type a given keycode.\&
+.P
+e.\&g.\& 28:1 28:0 means pressing on the Enter button on a standard US keyboard.\&
+.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
+Options:
+\fB-d\fR,\fB--key-delay\fR \fI<ms>\fR
+.RS 4
+Delay time between keystrokes.\& Default 12ms.\&
+.P
+.RE
+.RE
+\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-d\fR,\fB--key-delay\fR \fI<ms>\fR
+.RS 4
+Delay time between key events (up/down each).\& Default 12ms.\&
+.P
+.RE
+\fB-D\fR,\fB--next-delay\fR \fI<ms>\fR
+.RS 4
+Delay between strings.\& Default 0ms.\&
+.P
+.RE
+\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
+Example: to type '\&Hello world!\&'\& you would do:
+.RS 4
+ydotool type '\&Hello world!\&'\&
+.P
+.RE
+.RE
+.SH MOUSE COMMANDS
+.P
+\fBmousemove\fR [\fB-a\fR,\fB--absolute\fR] \fI<x> <y>\fR
+.RS 4
+Move the mouse to the relative X and Y coordinates on the screen.\&
+.P
+Options:
+\fB--absolute\fR
+.RS 4
+Use absolute position
+.P
+.RE
+Example: to move the cursor to absolute coordinates (100,100):
+.RS 4
+ydotool mousemove --absolute 100 100
+.P
+.RE
+.RE
+\fBclick\fR [\fB-d\fR,\fB--next-delay\fR \fI<ms>\fR] [\fB-r\fR,\fB--repeat\fR \fIN\fR ] [\fIbutton\fR .\&.\&.\&]
+.RS 4
+Send a click.\&
+.P
+Options:
+\fB-d\fR,\fB--next-delay\fR \fI<ms>\fR
+.RS 4
+Delay between input events (up/down, a compete click means doubled time).\& Default 25ms.\&
+.P
+.RE
+\fB-r\fR,\fB--repeat\fR \fIN\fR
+.RS 4
+Repeat entire sequence N times
+.P
+.RE
+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
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x00 - LEFT
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x01 - RIGHT
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x02 - MIDDLE
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x03 - SIDE
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x04 - EXTR
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x05 - FORWARD
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x06 - BACK
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x07 - TASK
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x40 - Mouse down
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.IP \(bu 4
+.\}
+0x80 - Mouse up
+.RE
+  
+.RS 4
+
+.RE
+.RE
+Examples:
+.P
+.RS 4
+.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
+.SH AUTHOR
+.P
+ydotool was written by ReimuNotMoe.\&
+.P
+This man page by bob.\&hepple@gmail.\&com
+.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 LICENCE
+AGPLv3
+.P
+.SH SEE ALSO
+.P
+\fBydotoold\fR(8)
+.P
+Project site: <https://github.\&com/ReimuNotMoe/ydotool>
diff --git a/srcpkgs/ydotool/files/ydotoold-workaround b/srcpkgs/ydotool/files/ydotoold-workaround
new file mode 100755
index 000000000000..ae4558078719
--- /dev/null
+++ b/srcpkgs/ydotool/files/ydotoold-workaround
@@ -0,0 +1,2 @@
+#!/bin/sh
+/usr/libexec/ydotoold -p /var/lib/ydotoold/socket -P 660
diff --git a/srcpkgs/ydotool/files/ydotoold/run b/srcpkgs/ydotool/files/ydotoold/run
new file mode 100755
index 000000000000..e52ad8606eb2
--- /dev/null
+++ b/srcpkgs/ydotool/files/ydotoold/run
@@ -0,0 +1,5 @@
+#!/bin/sh
+# This service is experimental.
+# At boot, without the sleep, X11 sometimes ignores ydotool.
+sleep 2
+exec chpst -u _ydotoold:input ydotoold 2>&1
diff --git a/srcpkgs/ydotool/template b/srcpkgs/ydotool/template
new file mode 100644
index 000000000000..20360580a3e7
--- /dev/null
+++ b/srcpkgs/ydotool/template
@@ -0,0 +1,30 @@
+# Template file for 'ydotool'
+pkgname=ydotool
+version=1.0.1
+revision=1
+build_style=cmake
+hostmakedepends="pkg-config scdoc"
+short_desc="Generic command-line automation tool, works on Wayland and X11"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="AGPL-3.0-only"
+homepage="https://github.com/ReimuNotMoe/ydotool"
+distfiles="https://github.com/ReimuNotMoe/ydotool/archive/v${version}.tar.gz"
+checksum=02311cdc608f205711b06a95e5fd71093b2294f4920efc526f5e98a2ddab42b8
+
+system_accounts="_ydotoold"
+_ydotoold_groups="input"
+
+# Used instead of /tmp so any group input user can replace the socket.
+make_dirs='/var/lib/ydotoold 0775 _ydotoold input'
+
+post_install() {
+	vinstall "${DESTDIR}/usr/bin/ydotool" 755 /usr/libexec
+	vbin "${FILESDIR}/ydotool-workaround" ydotool
+	vinstall "${DESTDIR}/usr/bin/ydotoold" 755 /usr/libexec
+	vbin "${FILESDIR}/ydotoold-workaround" ydotoold
+	vsv ydotoold
+	vinstall "${FILESDIR}/80-uinput.rules" 644 usr/lib/udev/rules.d
+	vlicense LICENSE
+	# https://github.com/ReimuNotMoe/ydotool/pull/144
+	vman "${FILESDIR}/ydotool.1"
+}

  parent reply	other threads:[~2022-08-10 12:54 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 12:49 [PR PATCH] " JohnGebbie
2022-07-25 12:51 ` [PR PATCH] [Updated] " JohnGebbie
2022-07-25 15:14 ` JohnGebbie
2022-07-25 15:27 ` JohnGebbie
2022-08-03 15:23 ` [PR REVIEW] " classabbyamp
2022-08-04  2:35 ` RunningDroid
2022-08-07 20:34 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-07 20:36 ` JohnGebbie
2022-08-07 20:38 ` [PR REVIEW] " JohnGebbie
2022-08-08 19:28 ` [PR PATCH] [Closed]: " JohnGebbie
2022-08-08 19:28 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-08 19:44 ` JohnGebbie
2022-08-08 19:44 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-08 21:33 ` JohnGebbie
2022-08-10  9:58 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-10 10:00 ` JohnGebbie
2022-08-10 11:50 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-10 12:54 ` JohnGebbie [this message]
2022-08-10 13:07 ` JohnGebbie
2022-08-10 13:19 ` JohnGebbie
2022-08-10 14:29 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-10 14:33 ` JohnGebbie
2022-08-10 14:35 ` JohnGebbie
2022-08-10 14:52 ` JohnGebbie
2022-08-10 14:55 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-17  9:13 ` JohnGebbie
2022-08-17  9:27 ` [PR PATCH] [Updated] " JohnGebbie
2022-08-17  9:37 ` JohnGebbie
2022-08-17  9:38 ` JohnGebbie
2022-08-17 14:52 ` JohnGebbie
2022-10-12 19:31 ` [PR PATCH] [Closed]: " JohnGebbie
2022-10-12 20:19 [PR PATCH] " JohnGebbie
2022-10-12 22:13 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-15  9:18 ` JohnGebbie
2022-10-15 10:47 ` JohnGebbie
2022-10-15 11:10 ` JohnGebbie
2022-10-15 11:14 ` JohnGebbie
2022-10-16 10:06 ` JohnGebbie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220810125411.xb7DnYG1cxmDP5RZx03oAhVCK7IM25VYFOmhwaFcJqA@z \
    --to=johngebbie@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).