diff --git a/Cargo.lock b/Cargo.lock index f58ac4ff0f09e..952e5a0f89834 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1075,7 +1075,7 @@ dependencies = [ "smallvec", "smartstring", "textwrap", - "toml", + "toml 0.7.6", "tree-sitter", "unicode-general-category", "unicode-segmentation", @@ -1119,7 +1119,7 @@ dependencies = [ "serde", "tempfile", "threadpool", - "toml", + "toml 0.7.6", "tree-sitter", "which", ] @@ -1187,9 +1187,10 @@ dependencies = [ "tempfile", "tokio", "tokio-stream", - "toml", + "toml 0.7.6", "url", "which", + "winres", ] [[package]] @@ -1252,7 +1253,7 @@ dependencies = [ "slotmap", "tokio", "tokio-stream", - "toml", + "toml 0.7.6", "url", "which", ] @@ -2140,6 +2141,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml" version = "0.7.6" @@ -2600,6 +2610,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml 0.5.11", +] + [[package]] name = "xtask" version = "23.10.0" @@ -2608,7 +2627,7 @@ dependencies = [ "helix-loader", "helix-term", "helix-view", - "toml", + "toml 0.7.6", ] [[package]] diff --git a/contrib/helix-256p.ico b/contrib/helix-256p.ico new file mode 100644 index 0000000000000..16781cc10b53d Binary files /dev/null and b/contrib/helix-256p.ico differ diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 4ff7fc0b1798c..f9c2b9df03ba6 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -81,6 +81,10 @@ crossterm = { version = "0.27", features = ["event-stream", "use-dev-tty"] } [build-dependencies] helix-loader = { path = "../helix-loader" } +[target.'cfg(windows)'.build-dependencies] +# winres to inject icon into Windows binary +winres = "0.1.12" + [dev-dependencies] smallvec = "1.11" indoc = "2.0.4" diff --git a/helix-term/build.rs b/helix-term/build.rs index b47dae8ef6530..7e7409f16decf 100644 --- a/helix-term/build.rs +++ b/helix-term/build.rs @@ -1,4 +1,5 @@ use helix_loader::grammar::{build_grammars, fetch_grammars}; +extern crate winres; fn main() { if std::env::var("HELIX_DISABLE_AUTO_GRAMMAR_BUILD").is_err() { @@ -6,4 +7,9 @@ fn main() { build_grammars(Some(std::env::var("TARGET").unwrap())) .expect("Failed to compile tree-sitter grammars"); } + if cfg!(target_os = "windows") { + let mut res = winres::WindowsResource::new(); + res.set_icon("../contrib/helix-256p.ico"); + res.compile().unwrap(); + } }