diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e9948cf..0a331ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,6 +86,7 @@ jobs: mkdir -p "$CONTENTS/MacOS" "$CONTENTS/Resources" cp "target/${{ matrix.target }}/release/ashell" "$CONTENTS/MacOS/" + cp "assets/icons/ashell.icns" "$CONTENTS/Resources/ashell.icns" VERSION_NUM="${VERSION#v}" cat > "$CONTENTS/Info.plist" <en CFBundleExecutable ashell + CFBundleIconFile + ashell.icns CFBundleIdentifier dev.ashell.app CFBundleInfoDictionaryVersion diff --git a/Cargo.lock b/Cargo.lock index f9a3408..6429233 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -296,6 +296,7 @@ dependencies = [ "gpui-component", "gpui-component-assets", "gpui_platform", + "image", "menu", "portable-pty", "rfd", @@ -315,6 +316,7 @@ dependencies = [ "tracing-subscriber", "uuid", "walkdir", + "winres", "zip", ] @@ -7481,6 +7483,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.8.23" @@ -9135,6 +9146,15 @@ dependencies = [ "windows-sys 0.59.0", ] +[[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 = "winsafe" version = "0.0.19" diff --git a/Cargo.toml b/Cargo.toml index a5e82d0..78396e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,9 +38,13 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } uuid = { version = "1", features = ["v4", "serde"] } walkdir = "2" zip = { version = "2", default-features = false, features = ["deflate"] } +image = { version = "0.25.9", default-features = false, features = ["png"] } [profile.release] opt-level = 3 lto = "thin" codegen-units = 1 strip = true + +[build-dependencies] +winres = "0.1.12" diff --git a/assets/icons/ashell.icns b/assets/icons/ashell.icns new file mode 100644 index 0000000..93b29c1 Binary files /dev/null and b/assets/icons/ashell.icns differ diff --git a/assets/icons/ashell.ico b/assets/icons/ashell.ico new file mode 100644 index 0000000..2ada99c Binary files /dev/null and b/assets/icons/ashell.ico differ diff --git a/assets/icons/ashell.png b/assets/icons/ashell.png new file mode 100644 index 0000000..c7b725a Binary files /dev/null and b/assets/icons/ashell.png differ diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..11295a9 --- /dev/null +++ b/build.rs @@ -0,0 +1,8 @@ +fn main() { + #[cfg(windows)] + { + let mut res = winres::WindowsResource::new(); + res.set_icon("assets/icons/ashell.ico"); + res.compile().unwrap(); + } +} diff --git a/scripts/package-macos-app.sh b/scripts/package-macos-app.sh index 50648ab..8b2d2c8 100755 --- a/scripts/package-macos-app.sh +++ b/scripts/package-macos-app.sh @@ -17,6 +17,8 @@ rm -rf "$APP_DIR" mkdir -p "$MACOS_DIR" "$RESOURCES_DIR" cp "$ROOT_DIR/target/release/$APP_NAME" "$MACOS_DIR/$APP_NAME" +cp "$ROOT_DIR/assets/icons/ashell.icns" "$RESOURCES_DIR/ashell.icns" + cat > "$CONTENTS_DIR/Info.plist" < "$CONTENTS_DIR/Info.plist" <en CFBundleExecutable $APP_NAME + CFBundleIconFile + ashell.icns CFBundleIdentifier $BUNDLE_ID CFBundleInfoDictionaryVersion diff --git a/src/main.rs b/src/main.rs index f176b6f..648ce96 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3539,6 +3539,11 @@ fn sync_macos_launch_environment() {} fn open_main_window(cx: &mut App) { let mut window_options = WindowOptions::default(); + #[cfg(not(target_os = "macos"))] + if let Ok(img) = image::load_from_memory(include_bytes!("../assets/icons/ashell.png")) { + window_options.icon = Some(std::sync::Arc::new(img.into_rgba8())); + } + if let Some(display) = cx.displays().first().cloned() { let display_bounds = display.bounds(); let width = display_bounds.size.width * 0.8;