Git Product home page Git Product logo

ydotool's Introduction

ydotool Build Status Release Status

Generic Linux command-line automation tool (no X!)

ydotool is not limited to Wayland. You can use it on anything as long as it accepts keyboard/mouse/whatever input. For example, X11, text console, "RetroArch OS", fbdev apps (fbterm/mplayer/SDL1/LittleVGL/Qt Embedded), etc.

2024 Roadmap

Our ultra-lightweight JavaScript runtime, Resonance, will be released in Q2 2024 in LGPL license.

ydotool will then be rewritten in JavaScript afterwards, to enable more people to understand the code & contribute.

You have NO reason to reject this. The RAM consumption (RSS) will NOT exceed 1MB.

Important Note

The man page is not always up to date. Please use --help to ensure correctness.

ChangeLog

This project is now refactored. (from v1.0.0)

Changes:

  • Rewritten in pure C99
  • No external dependencies
  • Uses a lot less memory & no dynamic memory allocation

Breaking Changes:

  • recorder removed because it's irrelevant. It will become a separate project
  • Command chaining and sleep are removed because this should be your shell's job
  • ydotool now must work with ydotoold
  • Usage of click and key are changed

Good News:

  • Some people can finally build this project offline
  • key now (only) accepts keycodes, so it's not limited to a specific keyboard layout
  • Now it's possible to implement support for different keyboard layouts in type

Usage

Currently implemented command(s):

  • click - Click on mouse buttons
  • mousemove - Move mouse pointer to absolute position
  • type - Type a string
  • key - Press keys
  • debug - Print the socket, number of parameters and parameter values
  • bakers - Show the honorable bakers
  • stdin - Sends the key presses as it was a keyboard (i.e from ssh) See PR #229

Examples

Switch to tty1 (Ctrl+Alt+F1), wait 2 seconds, and type some words:

ydotool key 29:1 56:1 59:1 59:0 56:0 29:0; sleep 2; ydotool type 'echo Hey guys. This is Austin.'

Close a window in graphical environment (Alt+F4):

ydotool key 56:1 62:1 62:0 56:0

Relatively move mouse pointer to -100,100:

ydotool mousemove -x -100 -y 100

Move mouse pointer to 100,100:

ydotool mousemove --absolute -x 100 -y 100

Mouse right click:

ydotool click 0xC1

Mouse repeating left click:

ydotool click --repeat 5 --next-delay 25 0xC0

Repeat the keyboard presses from stdin:

ydotool stdin

Notes

Runtime

ydotoold (daemon) program requires access to /dev/uinput. This usually requires root permissions.

Available key names

See /usr/include/linux/input-event-codes.h

Why a background service is needed

ydotool works differently from xdotool. xdotool sends X events directly to X server, while ydotool uses the uinput framework of Linux kernel to emulate an input device.

When ydotool runs and creates a virtual input device, it will take some time for your graphical environment (X11/Wayland) to recognize and enable the virtual input device. (Usually done by udev)

So, if the delay was too short, the virtual input device may not get recognized & enabled by your graphical environment in time.

In order to solve this problem, a persistent background service, ydotoold, is made to hold a persistent virtual device, and accept input from ydotool.

Since v1.0.0, the use of ydotoold is mandatory.

Build

CMake 3.22+ is required.

Build options

There are a few extra options that can be configured when running CMake

  • BUILD_DOCS=ON|OFF - whether to build the documentation, depends on scdoc. Default: ON
  • SYSTEMD_USER_SERVICE=ON|OFF - whether to use systemd user service file, depends on systemd. Default: ON
  • SYSTEMD_SYSTEM_SERVICE=ON|OFF - whether to use systemd system service file, depends on systemd. Default: OFF
  • OPENRC=ON|OFF - whether to use openrc service file. Default: OFF (TBD)

Compile

mkdir build
cd build
cmake ..
make -j `nproc`

If issues appears, check the build options, but try to install the dependecies:

Debian-based:

sudo apt install scdoc

RHEL-based:

sudo dnf install scdoc

Troubleshooting

Custom keyboard layouts

Currently, ydotool does not recognize if the user is using a custom keyboard layout. In order to comfortably use ydotool alongside a custom keyboard layout, the user could use one of the following fixes/workarounds:

Sway

In sway, the process is fairly easy. Following the instructions there, you would end up with something like:

input "16700:8197:DELL_DELL_USB_Keyboard" {
	xkb_layout "us,us"
	xkb_variant "dvorak,"
	xkb_options "grp:shifts_toggle, caps:swapescape"
}

The identifier for your keyboard can be obtained from the output of swaymsg -t get_inputs.

Hyprland

You can use Per-device input configs in Hyprland. Simply add following snippet to your config:

device:ydotoold-virtual-device {
    kb_layout = us
    kb_variant =
    kb_options =
}

Use a hardware-configurable keyboard

As mentioned here, consider using a hardware-based configuration that supports using a custom layout without configuring it in software.

Current situation

This project is now being maintained thanks to all the people that are supporting this project!

All backers and sponsors are listed here.

How to support us

  • Donate on our Patreon
  • Buy our products on our Official Store, if they are meaningful to you (please leave a message: ydotool user, so we can know that this purchase is for supporting ydotool)

More talks

Article: "Open Source" is Broken

Independent software developers in China, like us, have 10 times more life pressure than Marak, the author of faker.js. Since ydotool has the opportunity to benefit large IT companies who won't pay a penny to us, we've changed the license to AGPLv3. These large IT companies are the main cause of life pressure here, such as the "996" working hours.

Marak's fate will repeat on all open source developers eventually (of course we aren't talking about those who were born in billionare families) if we just keep fighting with each other and do nothing to improve the situation. If you make open source software as well, don't hesitate to ask for donations if you actually need them.

Also make sure you understand all the terms of AGPLv3 before using this software.

ydotool's People

Contributors

1ace avatar 9ary avatar adeliktas avatar antoniojpfernandes avatar automaticit-anthonyyen1 avatar bhepple avatar cincodenada avatar classicoldsong avatar hed-mhernandez avatar icedman avatar jacob-horton avatar jgcodes2020 avatar johngebbie avatar kepi avatar kitakar5525 avatar kraem avatar maxice8 avatar mgoral avatar mnutt avatar paiusco avatar pallaswept avatar r00tman avatar reimunotmoe avatar satmandu avatar smattr avatar supercheetah avatar t0fik avatar tbm avatar thyrc avatar tinfoilsubmarine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ydotool's Issues

Can't find `libboost_program_options` on Ubuntu

I'm on Ubuntu 19.04 and I installed ydotool via the .deb file available in the Releases tab. I have the package libboost-program-options-dev installed, but I still get this error message:

ydotool: error while loading shared libraries: libboost_program_options.so.1.65.1: cannot open shared object file: No such file or directory

I tried installing also libboost-program-options-dev:i386, with no success.

NumPad keys

Hello, thanks for creating this tool! I'm trying to use ydotool to emulate numpad key pressed, but so far I had no success - I don't know how to make ydotool press the numpad key. I tried things like:

ydotool key MINUS
ydotool key KPMINUS

But neither of them work. Any suggestions?

[question] What is the records file syntax?

I tried to record some events:

sudo ydotool recorder --record foo
sudo ydotool recorder --display foo

This outputs some logs similar to this:

Offset: 0x2a0
Delay: 0.063964392 second
Event: 4, 4, 458758
-
Offset: 0x2b8
Delay: 0.000004128 second
Event: 1, 46, 1
-
Offset: 0x2d0
Delay: 0.000001284 second
Event: 0, 0, 0

What this Offset value and these Event values and how am I supposed to use them to type ydotools commands?

I tried sudo ydotool key 0x2d0 but triggers the 0 keyboard key, because 0x2d0 starts with a 0.

Provide static binaries

ydotool can be quite annoying to install especially due to the fact it relies on 2 libraries which aren't commonly used.

It would be nice if the release section provided more up to date binaries and binaries that are statically linked with libuInputPlus.so.0 and libevdevPlus.so.0

AUR build broken after redesign

[ 70%] Building CXX object CMakeFiles/key.dir/Tools/Key/Key.cpp.o 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Daemon/ydotoold.cpp: In function ‘int client_handler(int)’: 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Daemon/ydotoold.cpp:31:2: error: ‘uInputRawData’ was not declared in this scope 
  uInputRawData buf{0}; 
  ^~~~~~~~~~~~~ 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Daemon/ydotoold.cpp:34:22: error: ‘buf’ was not declared in this scope 
   int rc = recv(fd, &buf, sizeof(buf), MSG_WAITALL); 
                      ^~~ 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp: In function ‘int socket_callback(uint16_t, uint16_t, int32_t, void*)’: 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp:75:2: error: ‘uInputRawData’ was not declared in this scope 
  uInputRawData buf{0}; 
  ^~~~~~~~~~~~~ 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp:76:2: error: ‘buf’ was not declared in this scope 
  buf.type = type; 
  ^~~ 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp:83:1: warning: no return statement in function returning non-void [-Wreturn-type] 
 } 
 ^ 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp: In function ‘int main(int, const char**)’: 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp:122:59: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 
   instance->uInputContext->Init(&socket_callback, (void *)fd_client); 
                                                           ^~~~~~~~~ 
/home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp:122:68: error: no matching function for call to ‘uInputPlus::uInput::Init(int (*)(uint16_t, uint16_t, int32_t, void*), void*)’ 
   instance->uInputContext->Init(&socket_callback, (void *)fd_client); 
                                                                    ^ 
In file included from /home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/../CommonIncludes.hpp:36, 
                 from /home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.hpp:17, 
                 from /home/ashkan/.cache/yay/ydotool-git/src/ydotool/Client/ydotool.cpp:13: 
/usr/include/uInputPlus/uInput.hpp:44:7: note: candidate: ‘void uInputPlus::uInput::Init(const uInputPlus::uInputSetup&)’ 
  void Init(const uInputSetup &setup); 
       ^~~~ 
/usr/include/uInputPlus/uInput.hpp:44:7: note:   candidate expects 1 argument, 2 provided 
make[2]: *** [CMakeFiles/ydotoold.dir/build.make:63: CMakeFiles/ydotoold.dir/Daemon/ydotoold.cpp.o] Error 1 
make[1]: *** [CMakeFiles/Makefile2:295: CMakeFiles/ydotoold.dir/all] Error 2 
make[1]: *** Waiting for unfinished jobs.... 
make[2]: *** [CMakeFiles/ydotool_client.dir/build.make:63: CMakeFiles/ydotool_client.dir/Client/ydotool.cpp.o] Error 1 
make[1]: *** [CMakeFiles/Makefile2:221: CMakeFiles/ydotool_client.dir/all] Error 2 
[ 75%] Linking CXX shared library libclick.so 
[ 80%] Linking CXX shared library libmousemove.so 
[ 85%] Linking CXX shared library libtype.so 
[ 85%] Built target click 
[ 85%] Built target type 
[ 85%] Built target mousemove 
[ 90%] Linking CXX shared library libkey.so 
[ 90%] Built target key 
make: *** [Makefile:152: all] Error 2 
==> ERROR: A failure occurred in build(). 
    Aborting... 
Error making: ydotool-git 

Install libydotool.so and libydotool.a into /usr/local/lib/, not /usr/local/bin/

After recent changes to cmake configuration,, make install installs libydotool.so and libydotool.a into /usr/local/bin instead of /usr/local/lib.

Since ldconfig does not normally look in /usr/local/bin for shared objects, libydotool.so cannot be found, so ydotoold does not start:

ydotoold: error while loading shared libraries: libydotool.so: cannot open shared object file: No such file or directory

Until cmake is reconfigured, you could work around this after install by manually moving these two files to a directory that ldconfig searches, and trigger ldconfig to rescan:

sudo mv /usr/local/bin/libydotool.{so,a} /usr/local/lib/
sudo ldconfig

Please version the libydotool.so package

Please version the libydotool.so package as the fedora packaging guidelines require all shared libraries to be versioned - I am not allowed to package ydotool for fedora with an unversioned shared library. I can versioned it in a patch downstream here in fedora-land but there is a danger that I would choose version numbers that conflict or misalign with a future version number chosen by upstream (yourself).

Much better if you can do the versioning.

Thanks - and thanks again for a great package - I would not be using sway if it were not for ydotool (I would stick to i3wm/xdotool/xvkbd).

Document valid key names

Key naming is not compatible with xdotool (e.g. ydotool key space and ydotool key return don't work but ydotool key " " and ydotool key enter do). It would be nice if there was a link in the readme to somewhere that listed valid keys.

fork ydotoold

When using ydotoold in scripts one has to start the daemon using ydotoold&. When using ydotool type too quickly this results in a few characters being lost. It would be nice if the ydotool daemon actually forks once it's started to make handling easier.

window id and position and bring to top?

ydotool works great for the implemented features. It seems I need xdotool to get the windows id? and xwininfo to get the window coords

xdotool search --onlyvisible --class google-chrome
(this will return a window id)

use
xwininfo -id
(this will return the cords of the window)

and I can use xdotool to set a windows on top

Am I suppose to use these 3 programs together to do things?
Or am I doing things wrong?

Plans to implement getactivewindow?

I understand with the changes in Wayland it may not be possible, but at the same time it looks like this may just be getting offloaded to the DE and could be obtained via dbus signals with the DE? I am also wondering if the DE's aren't still getting this info from Wayland too though. Either way it'd be a highly useful function to implement.

‘Table_ModifierKeys’ was not declared in this scope

Hello!

I am getting the following build error:

/home/aviau/git/ydotool/Tools/Key/Key.cpp: In function ‘std::vector<int> KeyStroke2Code(const string&)’:
/home/aviau/git/ydotool/Tools/Key/Key.cpp:72:16: error: ‘Table_ModifierKeys’ was not declared in this scope
   72 |   auto t_kms = Table_ModifierKeys.find(it);
      |                ^~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/ydotool_library.dir/build.make:167: CMakeFiles/ydotool_library.dir/Tools/Key/Key.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:191: CMakeFiles/ydotool_library.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

It looks like there is something missing in that file? Or is the tool incomplete?

Cheers,

ydotoold steals focus

I'm using rofi-pass on arch linux with the ydotool patch from aur.

pacman -Qi ydotool-git reports Version: v0.1.8.r29.g7764122-3

When I open rofi-pass, it loses focus after a short time (a second or so). Also when holding a key down in a terminal the key doesn't repeat or stops after a short time. If I stop ydotoold, the key repeats normally.

can I fix this with some config change or is this a problem with ydotoold itself?

Wrong keyboard mapping

I have a keyboard mapping issue, it's like ydotools types on a keyboard with a wrong keyboard mapping:

$ sudo ydotool type 'azerty'
ydotool: notice: ydotoold backend unavailable (may have latency+delay issues)
qwerty%
$ qwerty

`ydotool <cmd> --help` requires elavated permissions

Currently if I run commands that should just print help messages, ydotool will close with an error.
Examples:
ydotool click
ydotool click --help

No special permissions should be required to print help text.

still too slow

i've tested wayland, libinput-gestures with ydotool/mousemove_relative to simulate three finger drag. still too much latency even with the daemon.

i intended to replace x11, libinput-gestures, xdotool - with the above; but no luck for now

Ship a systemd service file for ydotoold

Having a systemd service file would allow packagers to install it to the correct place on the users system so they could just do, for example: systemctl --user enable --now ydotoold to have it run on startup.

You can have a look at my service file here. The install section would need to be adjusted to use a more generic target to not be Sway specific.

I just wanted to open up this issue before bothering with a PR, to see if you are interested. Let me know what you think.

Build script won't find libuInputPlus and libevdevPlus for linking

Hi,
please see this comment reported on the Arch Linux AUR package:

https://aur.archlinux.org/packages/ydotool-git/#comment-710452

User reports the following linking issue, which I was able to reproduce in a clean Docker container:

[100%] Linking CXX executable ydotool_static
/usr/bin/ld: cannot find -luInputPlus
/usr/bin/ld: cannot find -levdevPlus
/usr/bin/ld: libydotool.a(Tool.cpp.o): in function `ydotool::Tool::ToolManager::TryDlOpen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Tool.cpp:(.text+0x20e): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: cannot find -luInputPlus
/usr/bin/ld: cannot find -levdevPlus
collect2: error: ld returned 1 exit status

I believe it's an issue with the build scripts, but I couldn't find anything weird.

See the following asciinema for an example of a container build: https://asciinema.org/a/yJKDNWfhzs83xGHGMDkX0Pp2L

It's pretty much this:

pacman -Syu base-devel git sudo
useradd -m -G wheel user
visudo
## (enable passwordless sudo for wheel users)
su - user
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg
sudo pacman -U yay-bin*.pkg.*
yay -S ydotool-git

Type unicode characters

Good project !!
I tried type unicode characters as below, but they didn't appeared. Ascii char's are well.
Is there any idea?

---- unicode ----
% ydotool type テスト
ydotool: Executing `type' at 0x7fff66cc3928
argc = 2
argv[1] = テスト

---- ascii ----
% ydotool type test
ydotool: Executing `type' at 0x7ffd1a5d9f78
argc = 2
argv[1] = test
test

Shift+# possible on some keyboards

The output of ydotool key --help says:

Since we are emulating keyboard input, combination like Shift+# is invalid.
Because typing a `#' involves pressing Shift and 3.

However, that's not true for some keyboard layouts. For example, on the german layout the #-key is an own key next to the enter key. So on german keyboards the combination Shift+# would actually work.

error while loading shared libraries: libuInputPlus.so.0: No such file or directory

I successfully compiled and installed the three listed dependencies. Then I successfully built and installed ydotool. But when I run it I get this error:

$ ydotool
ydotool: error while loading shared libraries: libuInputPlus.so.0: cannot open shared object file: No such file or directory

I'm on ArchLinux (1.4? ArchLabs 2019.1.20)

shared library calls exit

The fedora auditing tools picked up the fact that the libydotool.so shared library calls exit (in several places). A quick google on the topic led me to this explanation:

simbody/simbody#659:

Calling exit in a shared libary is generally considered bad practice, as the caller has no way to catch the call, and you will be exiting the main application (the caller).

I would suggest to replace all exit calls by throwing an exception. If the exception is not caught, the behavior will be the same as it is now, but a caller has the option to catch the exception and react appropriately.

Doesn't work with non-QWERTY layouts (e.g. Dvorak)

Hi, if I type in ydotool type "This is a test" I get this instead: Ydco co a y.oyv which signifies that ydotool is typing in QWERTY, not Dvorak.

For reference, I'm using sway as my WM and the following lines of config:

input * xkb_layout "us,us"
input * xkb_variant ",dvorak"
input * xkb_options "grp:shifts_toggle, caps:swapescape"

Strange behavior with --delay

(aur: ydotool-git v0.1.5.r4.ged1e20f-1)
I just provide the terminal output

% ydotool key a                                                                  
ydotool: Executing `key' at 0x7fff41c8eef8
argc = 2
argv[1] = a
a⏎
        
% ydotool key --delay 5 a                                                 
ydotool: Executing `key' at 0x7ffff9298f78
argc = 4
argv[1] = --delay
argv[2] = 5
argv[3] = a
Delay was set to 5 milliseconds.

% ydotool key --delay 100 a                                               
ydotool: Executing `key' at 0x7fff83835f08
argc = 4
argv[1] = --delay
argv[2] = 100
argv[3] = a
Delay was set to 64 milliseconds.
a⏎
    
% ydotool key --delay 15 a                                                
ydotool: Executing `key' at 0x7ffc64b01098
argc = 4
argv[1] = --delay
argv[2] = 15
argv[3] = a
Delay was set to f milliseconds.

% ydotool key --delay 10 a                                             
ydotool: Executing `key' at 0x7fffb7bc8818
argc = 4
argv[1] = --delay
argv[2] = 10
argv[3] = a
Delay was set to a milliseconds.

% ydotool key --delay 150 a                                               
ydotool: Executing `key' at 0x7fff6f31f728
argc = 4
argv[1] = --delay
argv[2] = 150
argv[3] = a
Delay was set to 96 milliseconds.
a⏎                                                                                       

Also as seen, in some cases keycodes aren't event sent

Some keys aren't recognized

Hi, I just found your project and I like it a lot :)

I'm having an issue though: if I run ydotool key down, I would expect it to press the "arrow down" key. However it types d instead.

Also it seems to deduplicate keys. If I run ydotool key h e l l o it types helo, even if I add more Ls around it only keeps one (I know there's type for that but I'd like to report this issue as well :) ).

EDIT:
I kept using it and I've noticed a bunch of more keys aren't recognized. I'll add them to the following list when I find them:

  • Arrow keys
  • Super
  • XF86*

(I made an ArchLinux AUR package for ydotool and its dependencies: https://aur.archlinux.org/packages/ydotool-git/)

Stable Releases

Hi,
I am Arch Linux Trusted User and I would like to push your software to our official repositories.
If you are interested it would be glad if you could schedule stable releases for your software.
This would make packaging a lot easier. Thanks

What is boost::program_options?

Hi there,

I'm trying to compile this project on openSUSE tumbleweed so that I can make it available to download using the opensuse pacakge manager.

I've successfully compiled libuinputplus and libevdevplus but I cannot figure out what boost::program_options actually is. Would you mind elaborating on this so that I can try searching for it in the official opensuse repos?

Would you mind also explaining the difference between libuinputplus/libevdevplus and the standard libraries libuinput and libevdev? (If I can just use the latter it would make the build process a lot simpler)

flag to build static instead

Would it be possible to create a cmake flag to link ydotool as static?

I can build ydotool_client_static but then make install won't install it.

Also, is there a way to link ydotoold staticly?

broken build on fedora-31

compiling from 9c3a4e7 is OK
compiling (per the README) from 9117331 (master) is broken:

[ 73%] Linking CXX shared library libydotool.so
[ 76%] Linking CXX static library libydotool.a
[ 76%] Built target ydotool_library_static
Scanning dependencies of target ydotool_static
Scanning dependencies of target ydotoold_static
[ 79%] Building CXX object CMakeFiles/ydotool_static.dir/Client/ydotool.cpp.o
[ 82%] Building CXX object CMakeFiles/ydotoold_static.dir/Daemon/ydotoold.cpp.o
[ 82%] Built target ydotool_library
Scanning dependencies of target ydotool
Scanning dependencies of target ydotoold
[ 85%] Building CXX object CMakeFiles/ydotool.dir/Client/ydotool.cpp.o
[ 88%] Building CXX object CMakeFiles/ydotoold.dir/Daemon/ydotoold.cpp.o
[ 91%] Linking CXX executable ydotoold_static
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lboost_program_options
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ydotoold_static.dir/build.make:85: ydotoold_static] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/ydotoold_static.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 94%] Linking CXX executable ydotool_static
/usr/bin/ld: cannot find -lboost_program_options
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -ldl
/usr/bin/ld: cannot find -lboost_program_options
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ydotool_static.dir/build.make:85: ydotool_static] Error 1
make[1]: *** [CMakeFiles/Makefile2:221: CMakeFiles/ydotool_static.dir/all] Error 2
[ 97%] Linking CXX executable ydotoold
[100%] Linking CXX executable ydotool
[100%] Built target ydotoold
[100%] Built target ydotool
make: *** [Makefile:152: all] Error 2

Compiling/installation issue

I'm trying to compile and install ydotool on Ubuntu 19.04 but am getting the following error after following the build instructions and running make -j nproc:

Scanning dependencies of target ydotool_library_static Scanning dependencies of target ydotool_library [ 5%] Building CXX object CMakeFiles/ydotool_library_static.dir/Library/Instance.cpp.o [ 10%] Building CXX object CMakeFiles/ydotool_library_static.dir/Library/Tool.cpp.o [ 15%] Building CXX object CMakeFiles/ydotool_library_static.dir/Library/libydotool.cpp.o [ 20%] Building CXX object CMakeFiles/ydotool_library.dir/Library/libydotool.cpp.o [ 25%] Building CXX object CMakeFiles/ydotool_library.dir/Library/Tool.cpp.o [ 30%] Building CXX object CMakeFiles/ydotool_library.dir/Library/Instance.cpp.o [ 35%] Linking CXX static library libydotool.a [ 35%] Built target ydotool_library_static [ 40%] Linking CXX shared library libydotool.so [ 40%] Built target ydotool_library Scanning dependencies of target type Scanning dependencies of target click Scanning dependencies of target key Scanning dependencies of target ydotoold [ 45%] Building CXX object CMakeFiles/type.dir/Tools/Type/Type.cpp.o [ 50%] Building CXX object CMakeFiles/key.dir/Tools/Key/Key.cpp.o [ 55%] Building CXX object CMakeFiles/ydotoold.dir/Daemon/ydotoold.cpp.o [ 60%] Building CXX object CMakeFiles/click.dir/Tools/Click/Click.cpp.o /home/rwbarat/ydotool/Tools/Key/Key.cpp: In function ‘std::vector<int> KeyStroke2Code(const string&)’: /home/rwbarat/ydotool/Tools/Key/Key.cpp:73:16: error: ‘Table_ModifierKeys’ was not declared in this scope auto t_kms = Table_ModifierKeys.find(it); ^~~~~~~~~~~~~~~~~~ /home/rwbarat/ydotool/Daemon/ydotoold.cpp: In function ‘int client_handler(int)’: /home/rwbarat/ydotool/Daemon/ydotoold.cpp:31:2: error: ‘uInputRawData’ was not declared in this scope uInputRawData buf{0}; ^~~~~~~~~~~~~ /home/rwbarat/ydotool/Daemon/ydotoold.cpp:34:22: error: ‘buf’ was not declared in this scope int rc = recv(fd, &buf, sizeof(buf), MSG_WAITALL); ^~~ make[2]: *** [CMakeFiles/ydotoold.dir/build.make:63: CMakeFiles/ydotoold.dir/Daemon/ydotoold.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:147: CMakeFiles/ydotoold.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... make[2]: *** [CMakeFiles/key.dir/build.make:63: CMakeFiles/key.dir/Tools/Key/Key.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/key.dir/all] Error 2 [ 65%] Linking CXX shared library libclick.so [ 70%] Linking CXX shared library libtype.so [ 70%] Built target click [ 70%] Built target type make: *** [Makefile:152: all] Error 2

Technical question (for creating PPA & using for touchpad gestures)

Hello,
I'd like to make a PPA for Ubuntu/Debian based distros of your project. My question is, what this program uses from boost-libs? Because Debian based distros hasn't got a separate boost-libs package so I need to intall the complete libboost-all-dev to be sure that the required function is included, but it's over 500MB.

Thank you in advance,
Daniel

Repeat command N times

My typical usage for this is repeating a command several times.
To avoid me having to make a while loop whenever I use this command, it would be great if you could add a --repeat argument like xdotool has.

Examples usage:
ydotool type 1 --repeat 10 -> "1111111111"

Impossible to nicely type strings beginning with '-'

Since ydotool type $string doesn't support any method to escape characters or otherwise indicate the beginning and end of the actual string to be typed, when I try to type a string beginning with '-', it complains about an unrecognized option.

Accented keys aren't correctly typed

I'm using rofi-pass, and I can see that some of my passwords are not correctly typed by ydotool, with the french caracters 'é', or 'à' or 'è'…

For example if I enter
ydotool type "Hello, it's working, after é it is not"
it returns:
Hello, it's working, after but nothing after the special caracter.

Ability to record input?

Is there a way to record input for ydootol, to replay it later?

One example where it can be useful is automated benchmarkng for games. I.e. consider such scenario:

  1. Start the game, then record the input while you perform certain actions that you want to benchmark.
  2. Start the game again, and replay the input. Capture performance metrics logs.

This can create a way to run a reproducible benchmark for any game, but recording part is quite critical, since you can't really manually construct such input.

ydotoold backend unavailable

I installed ydotools from sources and experienced this issue:

$ pwd # I execute ydotool binary from the build folder, just to be sure
[...]/ydotool/build
$./ydotool type 'Hey guys. This is Austin.'
ydotool: notice: ydotoold backend unavailable (may have latency+delay issues)
terminate called after throwing an instance of 'std::runtime_error'
  what():  failed to open uinput device
zsh: abort (core dumped)  ./ydotool type 'Hey guys. This is Austin.'
ydotool type 'Hey guys. This is Austin.'

Additional information:

$ ./ydotool help
<prints the help menu successfully>
$ ls /usr/lib/libuInputPlus.so /usr/lib/libydotool.so /usr/lib/libevdevPlus.so
/usr/lib/libevdevPlus.so  /usr/lib/libuInputPlus.so  /usr/lib/libydotool.so

fedora packages available

I've built some packages for fedora-30/31 in COPR (only tested on f-31). x86_64 only so far.

They were built against head of tree on 20200211.

I've added a systemd service file (see below).

Other RPM builds (eg f-29, OpenSuse, Centos, i386 etc) are only a click away for me so let me know if you need one.

To install:

sudo dnf copr enable wef/ydotool 
sudo dnf copr enable wef/libuInputPlus
sudo dnf copr enable wef/libevdevPlus
sudo dnf install ydotool

Optionally:

sudo systemctl enable ydotoold
sudo systemctl start ydotoold

/usr/lib/systemd/system/ydotoold.service:

[Unit]
Description=Starts ydotoold service
After=network.target

[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/ydotoold
ExecReload=/usr/bin/kill -HUP $MAINPID
KillMode=process
TimeoutSec=180

[Install]
WantedBy=multi-user.target

getmouselocation

Hi ! is it possible to get the current mouse position in Wayland ? It would really help me make scripts.

I looked on Google but found no answer to my question.

Thanks in advance !

Add --version option

Many CLI programs have the --version option (among with an eventual shortcut -v).

Among other things, the program version will be a useful information when creating new issues here. It's also a common command to check that the program is successfully installed.

Segmentation fault when using ydotool with ydotoold

On Arch with latest aur build I've got this issue when trying to use ydotool with the daemon. I also have updated libuinputplus to latest aur build.

Starting the daemon itself works fine:

> sudo ydotoold
ydotoold: listening on socket /tmp/.ydotool_socket
ydotoold: accepted client

But then when trying ydotool in another terminal:

> sudo ydotool type 'test'
ydotool: library search path: /usr/local/lib/ydotool:/usr/lib/ydotool:/usr/lib/x86_64-linux-gnu/ydotool:/usr/lib/i386-linux-gnu/ydotool

ydotool: notice: Using ydotoold backend
ydotool: debug: tool `type' constructed at 0x5620997e4a10
argc = 2
argv[1] = test
Usage: ydotool <cmd> <args>
Available commands:
  mousemove
  type
  key
  click
zsh: segmentation fault  sudo ydotool type 'test'

Trying this in gdb I've got this backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x0000000100140001 in ?? ()
(gdb) bt
#0  0x0000000100140001 in ?? ()
#1  0x89503bf2b6585900 in ?? ()
#2  0x00007fffffffe120 in ?? ()
#3  0x00007ffff7f98984 in uInputPlus::uInput::Emit(unsigned short, unsigned short, int) const () from /usr/lib/libuInputPlus.so.0
#4  0x00007ffff7f989ef in uInputPlus::uInput::SendKey(unsigned short, unsigned int, bool) const () from /usr/lib/libuInputPlus.so.0
#5  0x00007ffff794bb92 in Type::TypeText(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/ydotool/libtype.so
#6  0x00007ffff794cc1e in Type::Exec(int, char const**) () from /usr/lib/ydotool/libtype.so
#7  0x0000555555557451 in main ()

ydotool without the daemon works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.