diff --git a/src/main.rs b/src/main.rs index bc01a2c..4dcb0c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ const SERVER_ADDRESS: &str = "10.0.0.168:5000"; fn main() { let icon = include_bytes!("icon1.ico"); - let mut tray_icon = tray_icon::TrayIcon::setup(icon); + let tray_icon = tray_icon::TrayIcon::setup(icon); let settings_json = load_json(); let hotkeys = Hotkeys::new(settings_json); @@ -42,12 +42,11 @@ fn main() { let mut socket = Socket::handle_connections(Socket::make_listener(SERVER_ADDRESS), from_socket_tx); - let (hotkey_close_flag_tx, hotkey_close_flag_rx) = sync_flag::new_syncflag(true); - let control_c_called_flag_rx = setup_control_c(hotkey_close_flag_tx); + let control_c_called_flag_rx = setup_control_c(); let hotkey_handle = thread::spawn(move || { println!("starting hotkey thread"); - modules::external_interface::create_keyboard_hooks(hotkey_channel_tx, hotkey_close_flag_rx); + modules::external_interface::create_keyboard_hooks(hotkey_channel_tx); println!("closing hotkey thread"); }); @@ -106,12 +105,11 @@ fn handle_instructions( } } -fn setup_control_c(mut hotkey_close_flag_tx: sync_flag::SyncFlagTx) -> sync_flag::SyncFlagRx { +fn setup_control_c() -> sync_flag::SyncFlagRx { let (mut control_c_flag_tx, control_c_called_flag_rx) = sync_flag::new_syncflag(false); ctrlc::set_handler(move || { println!("ctrl c caught"); control_c_flag_tx.set(true); - hotkey_close_flag_tx.set(false); }) .expect("control C handler failed!"); control_c_called_flag_rx diff --git a/src/modules/external_interface.rs b/src/modules/external_interface.rs index 9319ac6..253cfca 100644 --- a/src/modules/external_interface.rs +++ b/src/modules/external_interface.rs @@ -21,7 +21,6 @@ pub const OPTIONS_PATH: &str = "./options.json"; pub fn create_keyboard_hooks( channel_tx: crossbeam_channel::Sender, - close_flag: workctl::sync_flag::SyncFlagRx, ) { let tx_1 = channel_tx.clone(); inputbot::KeybdKey::PageUpKey.bind(move || { @@ -44,7 +43,7 @@ pub fn create_keyboard_hooks( }); #[cfg(feature = "default")] - inputbot::handle_input_events(close_flag); + inputbot::handle_input_events(); } #[cfg(feature = "no_hotkeys")]