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.5.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.5-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: totobotkey-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 162774e3459c7f602aaf60d0d4e8471ba097b2b40f7c14910a15b8ade9f676fb
MD5 7c9217dd039213cdb5a23f9659586386
BLAKE2b-256 a7196dca543c3870aca6acda218434125c01d3323215c20e9da21f34e884ee77

See more details on using hashes here.

File details

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

File metadata

  • Download URL: totobotkey-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ca208d0673af230d6ffb877a79de7172f5a0ab2a5faab4fa0822ca48566a1e99
MD5 d7b825f02097a3485f9df234090cfa6d
BLAKE2b-256 67af535e3449ea991b8fb09aa7403fb9d46ced5ac61d4237331617568b77c395

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