diff --git a/Cargo.toml b/Cargo.toml index 5cd56d7..77fd603 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ once_cell = "1.3.1" native-windows-gui = { version = "1.0.4", features = ["high-dpi", "notice"] } native-windows-derive = "1.0.3" winapi = { version = "0.3.9", features = [ - "libloaderapi", "handleapi", + "libloaderapi", "handleapi", "wincon", "winuser" ] } webview2 = "0.1.0" webview2-sys = "0.1.0-beta.1" diff --git a/src/main.rs b/src/main.rs index 36f758b..c1b5127 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,8 @@ use native_windows_gui::{self as nwg, NativeUi}; +use std::ptr; use structopt::StructOpt; +use winapi::um::wincon::GetConsoleWindow; +use winapi::um::winuser::{ShowWindow, SW_HIDE}; mod stremio_app; use crate::stremio_app::{stremio_server::StremioServer, MainWindow}; @@ -16,6 +19,14 @@ struct Opt { } fn main() { + // Hide the terminal window + let window = unsafe { GetConsoleWindow() }; + if window != ptr::null_mut() { + unsafe { + ShowWindow(window, SW_HIDE); + } + } + // native-windows-gui has some basic high DPI support with the high-dpi // feature. It supports the "System DPI Awareness" mode, but not the more // advanced Per-Monitor (v2) DPI Awareness modes.