Coder Social home page Coder Social logo

ydotool's Introduction

ydotool

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

pipeline status

Releases

Important Notes

Since Jun, 2019, I have little time to maintain this project because I'm striving to start an undertaking (instead of working 996).

If you would like to have features you want implemented quickly, you could consider donating to this project. This will allow me to allocate more time on this project.

Also, pull requests are always welcomed. Thanks in advance for your generous help.

Usage

In most times, replace x with y. :P

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

Examples

Type some words:

ydotool type 'Hey guys. This is Austin.'

Switch to tty1:

ydotool key ctrl+alt+f1

Close a window in graphical environment:

ydotool key Alt+F4

Move mouse pointer to 100,100:

ydotool mousemove 100 100

Relatively move mouse pointer to -100,100:

ydotool mousemove_relative -- -100 100

Mouse right click:

ydotool click 2

Notes

About the project

As of May, 2019, searching wayland xdotool replacement online won't get much useful results.

If you find this project useful, please consider to spread it.

Runtime

This program requires access to /dev/uinput. This usually requires root permissions.

You can use it on anything as long as it accepts keyboard/mouse/whatever input. For example, wayland, text console, etc.

Available key names

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

About the --delay option

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 an 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 got recognized & enabled by your graphical environment in time.

In order to solve this problem, I made a persistent background service, ydotoold, to hold a persistent virtual device, and accept input from ydotool. When ydotoold is unavailable, ydotool will work without it.

New modular design

Now everyone can write their own tool to use with ydotool. Have a look at the Tool folder.

I will write some documents for this when I have time.

Build

Dependencies

Compile

Nearly all my projects use CMake. It's very simple:

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

Packages

RPM packages are available at COPR. fedora-30 and fedora-31 are built. Contact [email protected] if you need other RPM builds.

Install with:

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

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.

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.

ydotool's People

Contributors

reimunotmoe avatar bhepple avatar classicoldsong avatar tinfoilsubmarine avatar icedman avatar kitakar5525 avatar alexminder avatar barraponto avatar brunelli avatar r00tman avatar

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.