diff --git a/options.json b/options.json index b75e5e5..7c7d2cd 100644 --- a/options.json +++ b/options.json @@ -18,7 +18,8 @@ "windows":{ "obs_re": "OBS *", "propresenter_re": "ProPresenter - .*", - "chrome_re": ".* - Google Chrome" + "chrome_re": ".* - Google Chrome", + "tcp_port": "8005" }, "hotkeys":{ "obs":{ diff --git a/src/main.rs b/src/main.rs index e0bb349..adbe857 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,24 +10,17 @@ use crate::modules::stream_states::state_update::StateUpdate; mod tests; mod modules; -#[cfg(target_os = "windows")] -const SERVER_ADDRESS: &str = "10.0.0.114:5000"; - -#[cfg(release)] -#[cfg(target_os = "windows")] -const SERVER_ADDRESS: &str = "10.0.0.209:5000"; - -#[cfg(target_os = "linux")] -const SERVER_ADDRESS: &str = "10.0.0.168:5000"; +const SERVER_ADDRESS: &str = "0.0.0.0:"; fn main() { let settings_json = load_json(); - let hotkeys = Hotkeys::new(settings_json); + let hotkeys = Hotkeys::new(settings_json.clone()); let (from_socket_tx, from_socket_rx) = unbounded::(); let hotkey_channel_tx = from_socket_tx.clone(); - let mut socket = Socket::handle_connections(Socket::make_listener(SERVER_ADDRESS), from_socket_tx); + println!("Opening on port: {}", settings_json["windows"]["tcp_port"]); + let mut socket = Socket::handle_connections(Socket::make_listener((String::from(SERVER_ADDRESS) + &settings_json["windows"]["tcp_port"].to_string()).as_str()), 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); diff --git a/src/modules/external_interface.rs b/src/modules/external_interface.rs index 1ad1c15..421fba0 100644 --- a/src/modules/external_interface.rs +++ b/src/modules/external_interface.rs @@ -30,7 +30,7 @@ pub fn create_keyboard_hooks(channel_tx: crossbeam_channel::Sender, clos tx_2.send(StateUpdate::ChangeSlide(SlideChange::NextHotkey).to_json().to_string()).unwrap(); }); - inputbot::handle_input_events(close_flag); + inputbot::handle_input_events(); } #[cfg(feature = "no_hotkeys")]