diff --git a/src/cmd_line.rs b/src/cmd_line.rs index bf37fe0..e3a4247 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -134,11 +134,13 @@ pub fn handle_command_line_arguments(args: Vec) -> Result<(), String> { Arg::with_name("wayland_app_id") .long("wayland-app-id") .takes_value(true) + .help("Specify an App ID for Wayland"), ) .arg( Arg::with_name("x11_wm_class") .long("x11-wm-class") .takes_value(true) + .help("Specify an X11 WM class"), ); let matches = clapp.get_matches_from(args); diff --git a/src/main.rs b/src/main.rs index 3c91474..c4dd4c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,6 +117,9 @@ fn main() { // Multiple other parts of the app "queue_next_frame" function to ensure animations continue // properly or updates to the graphics are pushed to the screen. + #[cfg(target_os = "windows")] + windows_attach_to_console(); + //Will exit if -h or -v if let Err(err) = cmd_line::handle_command_line_arguments(args().collect()) { eprintln!("{}", err); @@ -244,3 +247,13 @@ fn handle_macos() { } } } + +#[cfg(target_os = "windows")] +fn windows_attach_to_console() { + // Attach to parent console tip found here: https://github.com/rust-lang/rust/issues/67159#issuecomment-987882771 + use winapi::um::wincon::{AttachConsole, ATTACH_PARENT_PROCESS}; + unsafe { + AttachConsole(ATTACH_PARENT_PROCESS); + } +} +