Skip to main content

Just like AutoHotKey, on Wayland (and probably X)

Project description

TotoBotKey

Just like AutoHotKey !*

*with a $0 budget and 8 hours of work

What is this ?

A scripting macro tool written in Python, mainly destined to Wayland (but it might work with Xorg too, ig ?). The inputs are simulated using ydotool, whereas the events are managed simply by reading udev's input files.

It work not unsimilarly to AutoHotKey, which I've yet to find a satisfying replacement on Linux, and more specifically on Wayland.

Why tho ?

I've yet to find a satisfying replacement on Linux, and more specifically on Wayland. Apparently, KDE's macro tool is complete enough to do most stuff, but I believe that a single script to rule them all that handles everything feels easier to use and manage. Also, versioning™-capable !

What do I need ?

  • A computer and an OS that uses Wayland
  • Python 3.9+
  • ydotool, which also includes ydotoold

Quick note on ydotoold : (I AM NOT A SYSADMIN, DON'T TAKE THIS AS A GOOD SECURITY MEASURE)
It is recommended to run it as root user, but by doing so, ydotoold will create a socket file that's unreadable by a normal user.

The way I am running ydotoold right now is the following :

  • Added myself to input group
  • Added export YDOTOOL_SOCKET='/tmp/.ydotool_socket' in my ~.bashrc
  • A service runs ydotoold -P 660 -o 0:<input GID>

How do I use it ?

Preferrably in a Python virtual environment :

python -m venv .venv
pip install totobotkey

See the Scripting.md file for detailed explanations and syntax.

See the examples directory for an example script and main file.

To-do List

By order of priority :

  • Refactor and clean codebase (lmao)
  • Add support for each ydotool command options (delaying keys, sending keydown/up, etc.)
  • Add keydown/keyup events
    • i'm starting to think that it doesn't make much sense
  • Encapsulate decorations into a class
  • Better handling of keyboard layout
    • Current solution : "you figure out your own keys dictionary"
    • Final solution : "let's use input.h because ydotool said so"
  • Add a screenshot function (or a library that does just that on Wayland)
    • "You figure out your own screenshot function"
  • Provide a basic GUI to manage running scripts
    • Maybe also a killswitch which you can activate with a shortcut, a click or just hovering your mouse above

Known bugs

TotoBotKey

  • Every keypress combination needs a slight delay to be taken in account, in the domain of 50ms
  • Keys might become locked in the held state under some circumstences :
    • Spamming keys way too quickly
    • Holding keys while exiting the program
  • The cursor's sensitivity seems to double when a script is running
    • I suspect that this is related to the fact that input events, including mouse movements, are played back on the ydotoold device which might not have the same settings than the original mouse device

Ydotool

  • mousemove command :
    • Option absolute seems broken on ydotool's side right now. A workaround consists in using two mousemove commands at once, one to set the cursor at (0,0), the other to move relatively to that.
      • This is managed by TotoBotKey
    • Distances in pixels seem to be doubled for no given reason. It's taken in account in the code, but still.
      • This might be an issue on multiple monitors settings, with mine having two 1920x1080 monitors. I've yet to test on another computer.
    • The cursor might not be able to move from one monitor to another, if you're using multiple monitors. The cursor would move relatively to the monitor it's present on.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

totobotkey-0.0.6.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

totobotkey-0.0.6-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file totobotkey-0.0.6.tar.gz.

File metadata

  • Download URL: totobotkey-0.0.6.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for totobotkey-0.0.6.tar.gz
Algorithm Hash digest
SHA256 19c037332e2fef7adf00d20a754ddb44163d9fdc1826e4d83befa1ec9b47a2db
MD5 b46c411d38bc849ad1e719975ece79a7
BLAKE2b-256 d6e7c2331b6a5823c74b47c943ffbdcf39582ee747d51b899a19bcc27fdef663

See more details on using hashes here.

File details

Details for the file totobotkey-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: totobotkey-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for totobotkey-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 be12ad67403e1f9cbe0e62ed7181411ee22e54508a94bf090ef4f20b5005cfda
MD5 5320ad73e6ffdc69eca24f3c961b32ed
BLAKE2b-256 5739fa1314befa22ca39c0ba1da11734438cdbbfb19f733e84f66cae2fb4c9ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page