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.4.tar.gz (14.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.4-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: totobotkey-0.0.4.tar.gz
  • Upload date:
  • Size: 14.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.4.tar.gz
Algorithm Hash digest
SHA256 b215d2ea2e8a2dcd310d5faf40d80c438403f8c6e06947ec173f032b7406993b
MD5 1020b6b734fdc6a6686bac313d6b44f5
BLAKE2b-256 f5eaa260b76ccd0cf3a3a0e349181c4e226a057c4fe8fc502946baacbc6c7492

See more details on using hashes here.

File details

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

File metadata

  • Download URL: totobotkey-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 17.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3b2a1ed3d5e2c2550dd99176147a505472c674a8855649f514bf0176fd52babb
MD5 9f3c676b5b790e0c68ad470bd5480d98
BLAKE2b-256 6d56d99891962a124a852accb7323a8333af98b5c75ddd2551bacc2d0ceed02a

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