diff --git a/.goreleaser.yml b/.goreleaser.yml index ccc637ddc..16e04ce3c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -26,6 +26,15 @@ builds: post: - mkdir -p dist/windows_amd64 - cp ".\target\x86_64-pc-windows-msvc\release\komorebic.exe" ".\dist\komorebic_windows_amd64_v1\komorebic.exe" + - id: komorebic-no-console + main: dummy.go + goos: ["windows"] + goarch: ["amd64"] + binary: komorebic-no-console + hooks: + post: + - mkdir -p dist/windows_amd64 + - cp ".\target\x86_64-pc-windows-msvc\release\komorebic-no-console.exe" ".\dist\komorebic_no_console_windows_amd64_v1\komorebic-no-console.exe" archives: - name_template: "{{ .ProjectName }}-{{ .Version }}-x86_64-pc-windows-msvc" diff --git a/Cargo.lock b/Cargo.lock index bcd19556c..0c3f6147e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -849,6 +849,10 @@ dependencies = [ "windows", ] +[[package]] +name = "komorebic-no-console" +version = "0.1.19" + [[package]] name = "lazy_static" version = "1.4.0" diff --git a/Cargo.toml b/Cargo.toml index e9558ae0c..a19813fed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "komorebi", "komorebi-core", "komorebic", + "komorebic-no-console", ] [workspace.dependencies] diff --git a/komorebic-no-console/Cargo.toml b/komorebic-no-console/Cargo.toml new file mode 100644 index 000000000..1316d974c --- /dev/null +++ b/komorebic-no-console/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "komorebic-no-console" +version = "0.1.19" +authors = ["Jade Iqbal "] +description = "The command-line interface (without a console) for Komorebi, a tiling window manager for Windows" +categories = ["cli", "tiling-window-manager", "windows"] +repository = "https://github.com/LGUG2Z/komorebi" +license = "MIT" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + + diff --git a/komorebic-no-console/src/main.rs b/komorebic-no-console/src/main.rs new file mode 100644 index 000000000..8ab801348 --- /dev/null +++ b/komorebic-no-console/src/main.rs @@ -0,0 +1,19 @@ +#![windows_subsystem = "windows"] + +use std::io; +use std::os::windows::process::CommandExt; +use std::process::Command; + +const CREATE_NO_WINDOW: u32 = 0x08000000; + +fn main() -> io::Result<()> { + let mut current_exe = std::env::current_exe().expect("unable to get exec path"); + current_exe.pop(); + let komorebic_exe = current_exe.join("komorebic.exe"); + + Command::new(komorebic_exe) + .args(std::env::args_os().skip(1)) + .creation_flags(CREATE_NO_WINDOW) + .status() + .map(|_| ()) +} diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index e135e2c34..3e633ee94 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -1196,10 +1196,9 @@ fn main() -> Result<()> { ); } SubCommand::EnableAutostart(args) => { - let mut current_exe_dir = std::env::current_exe().expect("unable to get exec path"); - current_exe_dir.pop(); - - let komorebic_exe = current_exe_dir.join("komorebic.exe"); + let mut current_exe = std::env::current_exe().expect("unable to get exec path"); + current_exe.pop(); + let komorebic_exe = current_exe.join("komorebic-no-console.exe"); let komorebic_exe = dunce::simplified(&komorebic_exe); let startup_dir = startup_dir()?; diff --git a/wix/main.wxs b/wix/main.wxs index 969063f4f..779db61cd 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -92,6 +92,9 @@ + + + @@ -108,6 +111,8 @@ + +