diff --git a/src/modules/hotkey_handler.rs b/src/modules/hotkey_handler.rs new file mode 100644 index 0000000..7c80c4d --- /dev/null +++ b/src/modules/hotkey_handler.rs @@ -0,0 +1,16 @@ +use super::stream_states::{state_update::StateUpdate, enums::SlideChange}; + +pub fn create_keyboard_hooks(channel_tx: crossbeam_channel::Sender) { + + let tx_1 = channel_tx.clone(); + inputbot::KeybdKey::PageUpKey.bind(move || { + tx_1.send(StateUpdate::ChangeSlide(SlideChange::Next).to_json().to_string()).unwrap(); + }); + + let tx_2 = channel_tx.clone(); + inputbot::KeybdKey::PageDownKey.bind(move || { + tx_2.send(StateUpdate::ChangeSlide(SlideChange::Previous).to_json().to_string()).unwrap(); + }); + + inputbot::handle_input_events(); +} \ No newline at end of file