If you are on a linux distro and you want to obtain the Ctrl + C event before the process ends in your terminal, in this article I am going to show you how to do it!
Cargo.toml
[dependencies]
k_board = { version = "1.2.4", features = ["ctrl_lower_letter"] }
main.rs
use k_board::{keyboard::Keyboard, keys::Keys};
fn main() {
for key in Keyboard::new() {
match key {
Keys::Ctrl('c') => {
println!("Yeah, you press Ctrl + C and the console doest ends!!");
break;
},
_ => (),
}
}
}
See you in the next articleโฃ๏ธ๐ค!!
Top comments (0)