obv-mikhail / InputBot

Rust library for creating global hotkeys, and simulating inputs
MIT License
420 stars 74 forks source link

Key bindings not working on Wayland #107

Closed aegroto closed 1 month ago

aegroto commented 1 month ago

Hello! I have written a very simple program that should print a message every time a key is pressed:

use inputbot::KeybdKey;

pub fn main() {
    println!("Binding...");

    KeybdKey::bind_all(|event| {
        println!("Event: {:?}", event);
    });

    inputbot::handle_input_events();
}

However, this doesn't seem to work. Key sending is somehow working, although some characters are randomly missing. I have also noticed that the signature of inputbot::handle_input_events() has changed from the examples, as it does not require a boolean argument anymore. I am using the version 0.6.0 from crates.io.

I am running Hyprland, here is the output of hyprctl version:

Hyprland, built from branch  at commit 0f594732b063a90d44df8c5d402d658f27471dfe  (props: bump version to 0.43.0).
Date: Sun Sep 8 16:48:21 2024
Tag: v0.43.0, commits: 5196

flags: (if any)

Does this library support Wayland? I guess this may be related to my setup.

EDIT: It seems like it works when running the script as sudo, I am sorry but I totally missed the line in the README. I am closing the issue.