Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define some multi-keys hotkeys? #102

Open
Mikachu2333 opened this issue May 19, 2024 · 1 comment
Open

How to define some multi-keys hotkeys? #102

Mikachu2333 opened this issue May 19, 2024 · 1 comment

Comments

@Mikachu2333
Copy link

Sry for bother, as a roob in rust, I couldn't create some multi-keys hotkeys with your project. Here is my code.

I'd want to create Ctrl+Alt+S and Ctrl+Alt+W hotkeys and run my command and meet trouble for no response.

fn reg_hotkeys(exe_path: PathBuf) {
    println!("Start Hotkey.");
    LControlKey.bind(move || {
        println!("LControl");
        let exe_path = exe_path.clone();
        while LAltKey.is_pressed() {
            println!("LControl+LAlt");
            while SKey.is_pressed() {
                println!("LControl+LAlt+S");
                let _ = Command::new(exe_path.clone()).spawn().unwrap();
            }
            while WKey.is_pressed() {
                println!("LControl+LAlt+W");
                let _ = Command::new(exe_path.clone())
                    .arg("--pin:clipboard")
                    .spawn()
                    .unwrap();
            }
        }
    });
}
@Mikachu2333
Copy link
Author

May similar to
#47 #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant