# 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](https://github.com/ReimuNotMoe/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](https://github.com/ReimuNotMoe/ydotool), which also includes ydotoold
**Quick note on ydotoold :** (I AM NOT A SYSADMIN, DON'T TAKE THIS AS A GOOD SECURITY MEASURE)<br>
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 :
```bash
python -m venv .venv
pip install totobotkey
```
See the `Script.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.
Raw data
{
"_id": null,
"home_page": null,
"name": "TotoBotKey",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "Automation, Wayland",
"author": null,
"author_email": "Vanane <vanane@vanane.net>",
"download_url": "https://files.pythonhosted.org/packages/28/8b/a685f83b30ba7b63a7bf9f38afe2a4340a3aeaa7e93c8452908b7ce04e86/totobotkey-0.0.3.tar.gz",
"platform": null,
"description": "# TotoBotKey\n## Just like AutoHotKey !*\n*with a $0 budget and 8 hours of work\n\n## What is this ?\nA scripting macro tool written in Python, mainly destined to Wayland (but it might work with Xorg too, ig ?).\nThe inputs are simulated using [ydotool](https://github.com/ReimuNotMoe/ydotool), whereas the events are managed simply by reading udev's input files.\n\nIt work not unsimilarly to AutoHotKey, which I've yet to find a satisfying replacement on Linux, and more specifically on Wayland.\n\n## Why tho ?\nI've yet to find a satisfying replacement on Linux, and more specifically on Wayland.\nApparently, 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\u2122-capable !\n\n## What do I need ?\n- A computer and an OS that uses Wayland\n- Python 3.9+\n- [ydotool](https://github.com/ReimuNotMoe/ydotool), which also includes ydotoold\n\n**Quick note on ydotoold :** (I AM NOT A SYSADMIN, DON'T TAKE THIS AS A GOOD SECURITY MEASURE)<br>\nIt 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.\n\nThe way _I_ am running ydotoold right now is the following :\n- Added myself to `input` group\n- Added `export YDOTOOL_SOCKET='/tmp/.ydotool_socket'` in my `~.bashrc`\n- A service runs `ydotoold -P 660 -o 0:<input GID>`\n\n## How do I use it ?\nPreferrably in a Python virtual environment :\n```bash\npython -m venv .venv\npip install totobotkey\n```\n\nSee the `Script.md` file for detailed explanations and syntax.\n\nSee the `examples` directory for an example script and main file.\n\n## To-do List\nBy order of priority :\n- Refactor and clean codebase (lmao)\n- Add support for each ydotool command options (delaying keys, sending keydown/up, etc.)\n- Add keydown/keyup events\n - i'm starting to think that it doesn't make much sense\n- Encapsulate decorations into a class\n- Better handling of keyboard layout\n - Current solution : \"you figure out your own keys dictionary\"\n - Final solution : \"let's use input.h because ydotool said so\"\n- Add a screenshot function (or a library that does just that on Wayland)\n - \"You figure out your own screenshot function\"\n- Provide a basic GUI to manage running scripts\n - Maybe also a killswitch which you can activate with a shortcut, a click or just hovering your mouse above\n\n## Known bugs\n### TotoBotKey\n- Every keypress combination needs a slight delay to be taken in account, in the domain of 50ms\n- Keys might become locked in the held state under some circumstences :\n - Spamming keys _way_ too quickly\n - Holding keys while exiting the program\n- The cursor's sensitivity seems to double when a script is running\n - 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\n\n### Ydotool\n- `mousemove` command :\n - 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.\n - This is managed by TotoBotKey\n - Distances in pixels seem to be doubled for no given reason. It's taken in account in the code, but still.\n - This might be an issue on multiple monitors settings, with mine having two 1920x1080 monitors. I've yet to test on another computer.\n - 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.\n",
"bugtrack_url": null,
"license": null,
"summary": "Just like AutoHotKey, on Wayland (and probably X)",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/Vanane/TotoBotKey",
"issues": "https://github.com/Vanane/TotoBotKey/issues"
},
"split_keywords": [
"automation",
" wayland"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e2fd28949be1589dc5d1306b8438fcf6388496fe7e6dc6d0367c8b353fa7955d",
"md5": "5824595926ad99635b35219f89b2d206",
"sha256": "f3a507634b4e13ba723003cdd6923b443723858bebe9875be7d2fab0e74e592a"
},
"downloads": -1,
"filename": "TotoBotKey-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5824595926ad99635b35219f89b2d206",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 14987,
"upload_time": "2024-12-28T11:42:31",
"upload_time_iso_8601": "2024-12-28T11:42:31.440142Z",
"url": "https://files.pythonhosted.org/packages/e2/fd/28949be1589dc5d1306b8438fcf6388496fe7e6dc6d0367c8b353fa7955d/TotoBotKey-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "288ba685f83b30ba7b63a7bf9f38afe2a4340a3aeaa7e93c8452908b7ce04e86",
"md5": "45976249f7733ce2d4dedd24b66a235a",
"sha256": "487d68fbc062d1ec20a406473a403f7c75efaeb78b7beaf015946dbe124d60ae"
},
"downloads": -1,
"filename": "totobotkey-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "45976249f7733ce2d4dedd24b66a235a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 11960,
"upload_time": "2024-12-28T11:42:33",
"upload_time_iso_8601": "2024-12-28T11:42:33.697533Z",
"url": "https://files.pythonhosted.org/packages/28/8b/a685f83b30ba7b63a7bf9f38afe2a4340a3aeaa7e93c8452908b7ce04e86/totobotkey-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-28 11:42:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Vanane",
"github_project": "TotoBotKey",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "evdev",
"specs": [
[
"==",
"1.7.1"
]
]
},
{
"name": "bitstring",
"specs": [
[
"==",
"4.2.3"
]
]
}
],
"lcname": "totobotkey"
}