diff --git a/.gitignore b/.gitignore index 6d138a0..472a111 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,3 @@ /ydotool-0.2.0.tar.gz /ydotool-1.0.0.tar.gz /ydotool-1.0.1.tar.gz -/ydotool-1.0.3.tar.gz -/ydotool-1.0.4.tar.gz diff --git a/portable_endian.h b/portable_endian.h new file mode 100644 index 0000000..99845d0 --- /dev/null +++ b/portable_endian.h @@ -0,0 +1,118 @@ +// "License": Public Domain +// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. +// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to +// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it +// an example on how to get the endian conversion functions on different platforms. + +#ifndef PORTABLE_ENDIAN_H__ +#define PORTABLE_ENDIAN_H__ + +#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) + +# define __WINDOWS__ + +#endif + +#if defined(__linux__) || defined(__CYGWIN__) + +# include + +#elif defined(__APPLE__) + +# include + +# define htobe16(x) OSSwapHostToBigInt16(x) +# define htole16(x) OSSwapHostToLittleInt16(x) +# define be16toh(x) OSSwapBigToHostInt16(x) +# define le16toh(x) OSSwapLittleToHostInt16(x) + +# define htobe32(x) OSSwapHostToBigInt32(x) +# define htole32(x) OSSwapHostToLittleInt32(x) +# define be32toh(x) OSSwapBigToHostInt32(x) +# define le32toh(x) OSSwapLittleToHostInt32(x) + +# define htobe64(x) OSSwapHostToBigInt64(x) +# define htole64(x) OSSwapHostToLittleInt64(x) +# define be64toh(x) OSSwapBigToHostInt64(x) +# define le64toh(x) OSSwapLittleToHostInt64(x) + +# define __BYTE_ORDER BYTE_ORDER +# define __BIG_ENDIAN BIG_ENDIAN +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __PDP_ENDIAN PDP_ENDIAN + +#elif defined(__OpenBSD__) + +# include + +#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) + +# include + +# define be16toh(x) betoh16(x) +# define le16toh(x) letoh16(x) + +# define be32toh(x) betoh32(x) +# define le32toh(x) letoh32(x) + +# define be64toh(x) betoh64(x) +# define le64toh(x) letoh64(x) + +#elif defined(__WINDOWS__) + +# include +# include + +# if BYTE_ORDER == LITTLE_ENDIAN + +# define htobe16(x) htons(x) +# define htole16(x) (x) +# define be16toh(x) ntohs(x) +# define le16toh(x) (x) + +# define htobe32(x) htonl(x) +# define htole32(x) (x) +# define be32toh(x) ntohl(x) +# define le32toh(x) (x) + +# define htobe64(x) htonll(x) +# define htole64(x) (x) +# define be64toh(x) ntohll(x) +# define le64toh(x) (x) + +# elif BYTE_ORDER == BIG_ENDIAN + + /* that would be xbox 360 */ +# define htobe16(x) (x) +# define htole16(x) __builtin_bswap16(x) +# define be16toh(x) (x) +# define le16toh(x) __builtin_bswap16(x) + +# define htobe32(x) (x) +# define htole32(x) __builtin_bswap32(x) +# define be32toh(x) (x) +# define le32toh(x) __builtin_bswap32(x) + +# define htobe64(x) (x) +# define htole64(x) __builtin_bswap64(x) +# define be64toh(x) (x) +# define le64toh(x) __builtin_bswap64(x) + +# else + +# error byte order not supported + +# endif + +# define __BYTE_ORDER BYTE_ORDER +# define __BIG_ENDIAN BIG_ENDIAN +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __PDP_ENDIAN PDP_ENDIAN + +#else + +# error platform not supported + +#endif + +#endif \ No newline at end of file diff --git a/sources b/sources index a96e355..59c1275 100644 --- a/sources +++ b/sources @@ -1 +1,6 @@ -SHA512 (ydotool-1.0.4.tar.gz) = bbf66d752aa1dce9173c930e3a71bc277b330763b1aa0e38f9fec1976c282c64330251ba5abe222a991f4bcafbabf1312a940eb4b40a34bf99f628c2a41bc4a2 +SHA512 (cpm.cmake-0.27.5.tar.gz) = ef3a8dac77c189f0e612acc714e27464a075b86ba3454fe3410ab043a221d0a11ccd4654b9b1d3f4b33fc7a0f0fd64a1e30322a0552e3fc13528e33b82f1b350 +SHA512 (cxxopts-2d8e17c4f88efce80e274cb03eeb902e055a91d3.tar.gz) = ff26b941bdbae999b0d476f62d4a3c0c66aee2f1dac7bd4c1e05380532fbf93b462a2355d809a89eddb2d52aa8a6c7c31625a7fa442deca494e3358fa95ea009 +SHA512 (iodash-0.1.0.tar.gz) = 3ef05b5d909276c2e1be4619d0b075fcf001b5577939234f4952dd43b81f8806089d6e5d20dbe04743e3bd0c586f659709814cd0a4eb6938ebec4f727ff617ac +SHA512 (libevdevPlus-0.2.1.tar.gz) = 2cf4725c491631f25263d27d07722e85ddd2c4489426fd3842c75ca84e697765003083262b565d85d232f178684fae52f0f2ca3d5c89a3c0d1655d9f08a8d3d3 +SHA512 (libuInputPlus-0.2.1.tar.gz) = aeaa23c4b5631ddc0c9a54507d4cecb38d8b792015aa636d37bab3dbc3fa1229a6a02297d4c7c0d922fa512c3e3a8429b32a2432f06e1ceaeed1a91c857731cd +SHA512 (ydotool-1.0.1.tar.gz) = 4a9eede564b0e1cc706b12d75daadae79b9de7ba6a8165928b97fd54969fa874cb1be3e32ad706337808a94630cfbeb2e82a34cbe5682aa7549ce6ae726d744d diff --git a/ydotool-man-page.patch b/ydotool-man-page.patch new file mode 100644 index 0000000..2ea1bd3 --- /dev/null +++ b/ydotool-man-page.patch @@ -0,0 +1,194 @@ +diff -Nur ydotool-1.0.1-orig/manpage/ydotool.1.scd ydotool-1.0.1/manpage/ydotool.1.scd +--- ydotool-1.0.1-orig/manpage/ydotool.1.scd 2022-02-16 19:38:49.000000000 +1000 ++++ ydotool-1.0.1/manpage/ydotool.1.scd 2022-03-21 14:46:37.916103638 +1000 +@@ -1,12 +1,11 @@ + YDOTOOL(1) +- + # NAME + + ydotool - command-line _/dev/uinput_ automation tool + + # SYNOPSIS + +-*ydotool* *cmd* _args_ [ , *cmd* _args_ ... ] ++*ydotool* *cmd* _args_ + + *ydotool* *cmd* --help + +@@ -14,8 +13,6 @@ + + *ydotool* lets you programmatically (or manually) simulate keyboard input and mouse activity, etc. It does this by writing directly to _/dev/uinput_ so it generally needs to run as root. + +-It's possible to chain multiple commands together, separated by a comma between two spaces. +- + Currently implemented command(s): + + *type* +@@ -26,67 +23,37 @@ + Move mouse pointer to absolute position + *click* + Click on mouse buttons +-*recorder* +- Record/replay input events +-*sleep* +- sleep for a while + + # KEYBOARD COMMANDS +-*key* [*--up*] [*--down*] [*--next-delay* __] [*--key-delay* __] [*--repeat* __] [*--repeat-delay *] __ ++*key* [*-d*,*--key-delay* __] [__ ...] + +- Type a given keystroke. Examples being "alt+r", "ctrl+J", +- "ctrl+alt+n", "backspace". ++ Type a given keycode. ++ ++ e.g. 28:1 28:0 means pressing on the Enter button on a standard US keyboard. + +- Options: ++ 42:1 38:1 38:0 24:1 24:0 38:1 38:0 42:0 - "LOL" + +- *--up* +- Only keyup +- +- *--down* +- Only keydown ++ Non-interpretable values, such as 0, aaa, l0l, will only cause a delay. + +- *--delay* __ +- Delay before starting to output keystrokes. Default 100ms. ++ See `/usr/include/linux/input-event-codes.h' for available key codes (KEY_\*). + +- *--key-delay* __ ++ Options: ++ *-d*,*--key-delay* __ + Delay time between keystrokes. Default 12ms. + +- *--repeat* __ +- Times to repeat the key sequence. +- +- *--repeat-delay* __ +- Delay time between repetitions. Default 0ms. +- +- Generally, any valid name from _/usr/include/linux/input-event-codes.h_ will work. Multiple keys are separated by '+'. +- +- 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 +- +- Since we are emulating keyboard input, combinations like Shift+# is invalid because typing a `#' involves pressing Shift and 3. +- +- Example: Switch to tty1: +- ydotool key ctrl+alt+f1 +- +- Example: Close a window in graphical environment: +- ydotool key Alt+F4 +- +-*type* [*--next-delay* __] [*--key-delay* __] [*--texts* _arg_] [*--file* __] "_texts_" ++*type* [*-D*,*--next-delay* __] [*-d*,*--key-delay* __] [*-f*,*--file* __] "_text_" + + Types text as if you had typed it on the keyboard. + + Options: + +- *--next-delay* __ +- Delay before starting typing. Default 100ms. ++ *-d*,*--key-delay* __ ++ Delay time between key events (up/down each). Default 12ms. + +- *--key-delay* __ +- Delay time between keystrokes. Default 12ms. +- +- *--texts* _arg_ +- Texts to type ++ *-D*,*--next-delay* __ ++ Delay between strings. Default 0ms. + +- *--file* __ ++ *-f*,*--file* __ + 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. + + Example: to type 'Hello world!' you would do: +@@ -94,8 +61,8 @@ + + # MOUSE COMMANDS + +-*mousemove* _ _ +- Move the mouse to the specific relative X and Y coordinates on the screen. ++*mousemove* [*-a*,*--absolute*] _ _ ++ Move the mouse to the relative X and Y coordinates on the screen. + + Options: + *--absolute* +@@ -104,47 +71,38 @@ + Example: to move the cursor to absolute coordinates (100,100): + ydotool mousemove --absolute 100 100 + +-*click* [*--next-delay* __] _button_ +- Send a click. Buttons are: _left_, _right_ or _middle_ +- +- Options: +- +- *--next-delay* __ +- Delay before click. Default 100ms. +- +- *--up* +- Only mouseup +- +- *--down* +- Only mousedown +- +- *--buttons* __ +- Buttons to press (left, right, middle) +- +- Example: Mouse middle click: +- ydotool click middle +- +-*recorder* [*--record* __] [*--replay* __] [*--display*] [*--duration* __] [*--devices* __] [*--file* __] ++*click* [*-d*,*--next-delay* __] [*-r*,*--repeat* _N_ ] [_button_ ...] ++ Send a click. + + Options: ++ *-d*,*--next-delay* __ ++ Delay between input events (up/down, a compete click means doubled time). Default 25ms. + +- *--record* __ +- Devices to record from. Default is all, including non-keyboard devices. +- +- *--replay* __ +- The record file can't be replayed on an architecture with different endianness. +- +- *--display* +- Display ++ *-r*,*--repeat* _N_ ++ Repeat entire sequence N times + +- *--duration* __ +- Record duration. Otherwise use SIGINT to stop recording. ++ all mouse buttons are represented using hexadecimal numeric values, with an optional ++ bit mask to specify if mouse up/down needs to be omitted. + +- *--devices* __ +- Devices, separated by comma, to record from. Default is all devices (default: "") ++ - 0x00 - LEFT ++ - 0x01 - RIGHT ++ - 0x02 - MIDDLE ++ - 0x03 - SIDE ++ - 0x04 - EXTR ++ - 0x05 - FORWARD ++ - 0x06 - BACK ++ - 0x07 - TASK ++ - 0x40 - Mouse down ++ - 0x80 - Mouse up ++ ++ Examples: ++ ++ - 0x00: chooses left button, but does nothing (you can use this to implement extra sleeps) ++ - 0xC0: left button click (down then up) ++ - 0x41: right button down ++ - 0x82: middle button up + +- *--file* __ +- File to record to / replay from ++ The '0x' prefix can be omitted if you want. + + # AUTHOR + diff --git a/ydotool.spec b/ydotool.spec index f830497..cc118e1 100644 --- a/ydotool.spec +++ b/ydotool.spec @@ -2,20 +2,39 @@ %undefine __cmake_in_source_build +%global github_url https://github.com +%global iodash_name IODash +%global iodash_version 0.1.0 +%global libevdevplus_name libevdevPlus +%global libevdevplus_version 0.2.1 +%global libuinputplus_name libuInputPlus +%global libuinputplus_version 0.2.1 +%global cxxopts_name cxxopts +%global cxxopts_version 3.0.0 +%global cxxopts_commit 2d8e17c4f88efce80e274cb03eeb902e055a91d3 +%global cpm_cmake_name cpm.cmake +%global cpm_cmake_version 0.27.5 %global debug_package %{nil} Name: ydotool -Version: 1.0.4 -Release: 9%{?dist} +Version: 1.0.1 +Release: 2%{?dist} Summary: Generic command-line automation tool (no X!) -# Automatically converted from old format: AGPLv3 -License: AGPL-3.0-only -URL: https://github.com/ReimuNotMoe/%{name} +License: AGPLv3, Public Domain +URL: %github_url/ReimuNotMoe/%{name} Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +Source1: %{github_url}/YukiWorkshop/%{iodash_name}/archive/v%{iodash_version}/%(c=%{iodash_name}; echo ${c,,})-%{iodash_version}.tar.gz +Source2: %{github_url}/YukiWorkshop/%{libevdevplus_name}/archive/v%{libevdevplus_version}/%{libevdevplus_name}-%{libevdevplus_version}.tar.gz +Source3: %{github_url}/YukiWorkshop/%{libuinputplus_name}/archive/v%{libuinputplus_version}/%{libuinputplus_name}-%{libuinputplus_version}.tar.gz +Source4: %{github_url}/jarro2783/%{cxxopts_name}/archive/%{cxxopts_commit}/%{cxxopts_name}-%{cxxopts_commit}.tar.gz +Source5: %{github_url}/TheLartians/%{cpm_cmake_name}/archive/v%{cpm_cmake_version}/%{cpm_cmake_name}-%{cpm_cmake_version}.tar.gz +Source6: https://gist.githubusercontent.com/panzi/6856583/raw/1eca2ab34f2301b9641aa73d1016b951fff3fc39/portable_endian.h + +Patch1: ydotool-man-page.patch BuildRequires: cmake -BuildRequires: gcc +BuildRequires: gcc-c++ BuildRequires: make BuildRequires: scdoc BuildRequires: systemd-rpm-macros @@ -25,6 +44,24 @@ BuildRequires: systemd-rpm-macros Performs some of the functions of xdotool(1) without requiring X11 - however, it generally requires root permission (to open /dev/uinput) +NOTE: changes in this release: +NOTE: --delay option is now --next-delay +NOTE: mousemove is now relative unless --absolute is given +NOTE: mouseup, mousedown, mousemove_relative is removed +NOTE: click accepts left, right, middle instead of 1, 2, 3 +NOTE: sleep is a new command + +SEE: ydotool --help for latest info + +Currently implemented command(s): + +- type - Type a string +- key - Press keys +- mousemove - Move mouse pointer to absolute position +- click - Click on mouse buttons +- recorder - Record/replay input events +- sleep - sleep ms + N.B. it is strongly recommended to start the ydotoold daemon with: - systemctl enable ydotool @@ -32,9 +69,25 @@ N.B. it is strongly recommended to start the ydotoold daemon with: %prep %setup -q +gzip -dc %{S:1} | tar xf - +gzip -dc %{S:2} | tar xf - +gzip -dc %{S:3} | tar xf - +gzip -dc %{S:4} | tar xf - +gzip -dc %{S:5} | tar xf - + +%patch1 -p1 + +# this is missing from IODash - I have logged a bug report upstream +# https://github.com/YukiWorkshop/IODash/issues/1 +# it is licenced 'public domain': +cp %{S:6} %{iodash_name}-%{iodash_version}/portable-endian.h %build -%cmake -DBUILD_SHARED_LIBS:BOOL=OFF +%cmake -DBUILD_SHARED_LIBS:BOOL=OFF \ +-DCPM_%{iodash_name}_SOURCE=$PWD/%{iodash_name}-%{iodash_version} \ +-DCPM_%{libevdevplus_name}_SOURCE=$PWD/%{libevdevplus_name}-%{libevdevplus_version} \ +-DCPM_%{libuinputplus_name}_SOURCE=$PWD/%{libuinputplus_name}-%{libuinputplus_version} \ +-DCPM_%{cxxopts_name}_SOURCE=$PWD/%{cxxopts_name}-%{cxxopts_commit} make -C %{_vpath_builddir} -j `nproc` @@ -69,42 +122,6 @@ scdoc < manpage/%{name}d.8.scd > %{buildroot}/%{_mandir}/man8/%{name}d.8 %{_mandir}/man8/%{name}d.8.* %changelog -* Fri Jul 17 2026 Fedora Release Engineering - 1.0.4-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild - -* Sat Jan 17 2026 Fedora Release Engineering - 1.0.4-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild - -* Fri Jul 25 2025 Fedora Release Engineering - 1.0.4-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Sun Jan 19 2025 Fedora Release Engineering - 1.0.4-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Sat Jul 20 2024 Fedora Release Engineering - 1.0.4-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Wed Jul 17 2024 Miroslav Suchý - 1.0.4-4 -- convert license to SPDX - -* Sat Jan 27 2024 Fedora Release Engineering - 1.0.4-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sat Jul 22 2023 Fedora Release Engineering - 1.0.4-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Tue Jan 31 2023 Bob Hepple - 1.0.4-1 -- new version - -* Sat Jan 21 2023 Fedora Release Engineering - 1.0.3-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Thu Jan 12 2023 Bob Hepple - 1.0.3-1 -- new version - -* Sat Jul 23 2022 Fedora Release Engineering - 1.0.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - * Mon Mar 21 2022 Bob Hepple - 1.0.1-2 - added new manual (also pushed upstream)