EvilHotKeys is a Python script that allows you to automate key presses and scan pixel colors for various games. It's intended to replace AutoHotKey as Python is compatible on multiple operating systems. Now supports both X11 and Wayland (GNOME) environments.
- Cross-platform hotkey automation
- Pixel color detection and searching
- Support for X11 and Wayland (GNOME) environments
- Session-based permission handling for Wayland
- Game-specific automation scripts
- Extensible architecture for adding new games
- NEW: Interactive coordinate helper tool
- NEW: YAML-based configuration system
- Professional logging framework
- Vectorized pixel search (10-100x faster)
- Python 3.7+
- X11 display server
- Python 3.7+
- GNOME desktop environment on Wayland
- System packages:
python3-dbus,python3-gi,gir1.2-gtk-3.0,xdg-desktop-portal-gnome
- Clone the repository:
git clone https://github.com/busybox42/EvilHotKeys - Install system dependencies (for Wayland support):
# Ubuntu/Debian sudo apt install python3-dbus python3-gi gir1.2-gtk-3.0 xdg-desktop-portal-gnome # Fedora sudo dnf install python3-dbus python3-gobject gtk3-devel # Arch Linux sudo pacman -S python-dbus python-gobject gtk3
- Install Python dependencies:
pip install -r requirements.txt
Console Mode:
python main.pyGUI Mode:
python main-gui.pyEnhanced GUI with Monitoring (NEW!):
python main-gui-enhanced.pyThe enhanced GUI shows:
- Real-time APM (Actions Per Minute)
- Performance metrics (keys pressed, interrupts fired)
- Live activity log with timestamps
- Visual status indicators
See ENHANCED_GUI_GUIDE.md for details.
Easily capture and save pixel coordinates for your game:
python coordinate_helper.py- Select your game
- Enter a coordinate name (or use presets like "interrupt")
- Hover over the UI element in-game
- Press F9 to capture
- Click "Save to Config"
See COORDINATE_HELPER_GUIDE.md for detailed instructions.
Copy the example config and customize for your setup:
cp config.example.yaml config.yaml
nano config.yamlConfigure:
- Screen resolution
- Performance profiles (fast, balanced, responsive)
- Game-specific pixel coordinates
- Logging preferences
When running EvilHotKeys for the first time on GNOME Wayland:
- A permission dialog will appear asking for screenshot access
- Click "Allow" to grant permission
- The permission will be remembered for the current session
- You may need to restart the application after granting permission
Run the test script to verify Wayland functionality:
python test_wayland_support.pyThis will test:
- Environment detection
- Screenshot permissions
- Pixel color detection
- Pixel search functionality
- Performance benchmarks
The application automatically detects your environment:
- X11: Uses PIL ImageGrab for screenshots
- Wayland (GNOME): Uses GNOME D-Bus Screenshot interface
- Other: Falls back to X11 methods
On Wayland, screenshots are cached for up to 100ms to improve performance when sampling multiple pixels.
- Create a new directory for the game in the
gamesdirectory. - Create a
specsdirectory inside the game directory. - Create a new Python file for each spec in the
specsdirectory. - Implement the spec logic in the Python file.
from libs.pixel_get_color import get_color
from libs.keyboard_actions import press_and_release
import time
def run(stop_event):
while not stop_event.is_set():
# Check pixel color
color = get_color(100, 100)
if color == (255, 0, 0): # Red pixel
press_and_release('space')
time.sleep(0.1)Permission dialog doesn't appear:
- Ensure
xdg-desktop-portal-gnomeis installed and running - Check that you're running on GNOME Wayland:
echo $XDG_SESSION_TYPE
Screenshots fail:
- Verify D-Bus service is available:
dbus-send --session --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.freedesktop.DBus.Introspectable.Introspect - Check if GNOME Screenshot service is running
Performance issues:
- Screenshots are cached for 100ms to improve performance
- Consider reducing the frequency of pixel checks in your specs
PIL ImageGrab fails:
- Install additional dependencies:
pip install Pillow[X11] - Ensure X11 is running and accessible
Import errors:
- Ensure all dependencies are installed:
pip install -r requirements.txt - Check Python version compatibility
Permission errors:
- Ensure your user has access to input devices
- Consider running with appropriate permissions
- Fork the repository.
- Create a new branch:
git checkout -b my-feature-branch - Make your changes and commit them:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-feature-branch - Create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.