Added keyboard logging
This commit is contained in:
parent
e73fc2db51
commit
db14b27885
1 changed files with 21 additions and 13 deletions
|
@ -1,7 +1,10 @@
|
|||
use log::debug;
|
||||
|
||||
use wlroots::{
|
||||
compositor,
|
||||
input::{self, keyboard},
|
||||
xkbcommon::xkb::keysyms,
|
||||
xkbcommon::xkb::{keysyms, keysym_get_name},
|
||||
WLR_KEY_PRESSED,
|
||||
};
|
||||
|
||||
pub struct Keyboard;
|
||||
|
@ -14,6 +17,8 @@ impl input::keyboard::Handler for Keyboard {
|
|||
key_event: &keyboard::event::Key,
|
||||
) {
|
||||
for key in key_event.pressed_keys() {
|
||||
if key_event.key_state() == WLR_KEY_PRESSED {
|
||||
debug!("Key down: {}", keysym_get_name(key));
|
||||
match key {
|
||||
keysyms::KEY_Escape => compositor::terminate(),
|
||||
keysyms::KEY_XF86Switch_VT_1..=keysyms::KEY_XF86Switch_VT_12 => {
|
||||
|
@ -28,6 +33,9 @@ impl input::keyboard::Handler for Keyboard {
|
|||
}
|
||||
_ => {}
|
||||
}
|
||||
} else {
|
||||
debug!("Key up: {}", keysym_get_name(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue