PM: merge M1.14 app icon and README banner
Some checks are pending
ci / ci (macos-15) (push) Waiting to run
ci / ci (ubuntu-24.04) (push) Waiting to run
ci / ci (windows-2025) (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/architecture.md
This commit is contained in:
danny 2026-10-16 17:01:18 +02:00
commit db34e2ca52
7 changed files with 221 additions and 34 deletions

2
.gitignore vendored
View file

@ -9,3 +9,5 @@ dist/
.vscode/ .vscode/
/apps/lutra-desktop/icons/ /apps/lutra-desktop/icons/
/apps/lutra-desktop/gen/ /apps/lutra-desktop/gen/
/docs/psd/
/docs/pngs/

View file

@ -4,9 +4,11 @@ Every non-code asset in this repository (icons, images, example projects, colour
**Policy (mandatory):** Lutra contains **no JetBrains iconography, images, colour schemes, keymaps, live or file templates, inspection texts or screenshots**. Every asset is either original work by Lutra contributors, or third-party material under an open licence (OSI open source, public domain / CC0, or Creative Commons that allows redistribution), and it is attributed below. Screenshots of JetBrains software are never committed. **Policy (mandatory):** Lutra contains **no JetBrains iconography, images, colour schemes, keymaps, live or file templates, inspection texts or screenshots**. Every asset is either original work by Lutra contributors, or third-party material under an open licence (OSI open source, public domain / CC0, or Creative Commons that allows redistribution), and it is attributed below. Screenshots of JetBrains software are never committed.
Generated-in-code art is original and has no file to list (default colour schemes, file-type badges, the placeholder app icon). Generated-in-code art is original and has no file to list (default colour schemes, file-type badges, the placeholder app icon that `apps/lutra-desktop/build.rs` falls back to when `assets/app-icon/icon.png` is missing).
**Font files are never committed.** Inter and JetBrains Mono (both SIL OFL 1.1) come from the `@fontsource` npm packages and are listed in `NOTICE`. **Lucide icons** come from the `lucide-vue-next` npm package (ISC) and are listed in `NOTICE`; only icons drawn for Lutra live in `assets/icons/` with the prefix `lt-`. **Font files are never committed.** Inter and JetBrains Mono (both SIL OFL 1.1) come from the `@fontsource` npm packages and are listed in `NOTICE`. **Lucide icons** come from the `lucide-vue-next` npm package (ISC) and are listed in `NOTICE`; only icons drawn for Lutra live in `assets/icons/` with the prefix `lt-`.
| Asset | Author | Source | Licence | Notes | | Asset | Author | Source | Licence | Notes |
|---|---|---|---|---| |---|---|---|---|---|
| `assets/app-icon/icon.png` | Daniel Diekert | concept generated with Gemini (Google), finished by Daniel Diekert in Photoshop (2026-10-15) | MIT OR Apache-2.0 | App icon master, 720 x 720 RGBA with rounded corners baked in; a square crop of the banner scene. `apps/lutra-desktop/build.rs` downscales it to the Tauri icons. Photoshop source kept outside git. |
| `docs/images/banner.png` | Daniel Diekert | concept generated with Gemini (Google), finished by Daniel Diekert in Photoshop (2026-10-15) | MIT OR Apache-2.0 | README banner, 1456 x 720. Wordmark font: tbd. Photoshop source kept outside git. |

View file

@ -1,9 +1,9 @@
<h1 align="center">🦦 Lutra</h1>
<p align="center"> <p align="center">
<b>An otterly perfect IDE.</b> <img alt="Lutra — an otterly perfect IDE" src="docs/images/banner.png" width="100%">
</p> </p>
<h1 align="center">Lutra</h1>
<p align="center"> <p align="center">
A fast, open-source, clean-room PHP IDE in the spirit of the PhpStorm workflow. A fast, open-source, clean-room PHP IDE in the spirit of the PhpStorm workflow.
Rust core, Vue interface, native on macOS, Windows and Linux. Rust core, Vue interface, native on macOS, Windows and Linux.

View file

@ -1,28 +1,70 @@
//! Build script of the desktop app. //! Build script of the desktop app.
//! //!
//! Generates the placeholder app icon (an otter-brown rounded square holding a //! Produces the app icons Tauri needs into the gitignored `icons/` directory,
//! pale stone) into the gitignored `icons/` directory, then runs the Tauri //! then runs the Tauri build step, which needs those files. The source is the
//! build step, which needs those files. The real icon is the owner's to //! owner's master icon `assets/app-icon/icon.png` (listed in ASSETS.md),
//! commission; this one is generated in code and has no asset file. //! downscaled to the window icon `icon.png` and to a multi-size `icon.ico`.
//! If the master is missing or unreadable, the build prints a warning and
//! falls back to a placeholder generated in code (an otter-brown rounded
//! square holding a pale stone), so the build never fails over the icon.
use std::error::Error; use std::error::Error;
use std::fs; use std::fs;
use std::path::Path; use std::io::Cursor;
use std::path::{Path, PathBuf};
/// Edge length of the generated icon in pixels. /// Edge length of the placeholder and of the window icon `icon.png`.
const SIZE: u32 = 256; const SIZE: u32 = 256;
/// Edge lengths of the images in `icon.ico`.
const ICO_SIZES: [u32; 6] = [16, 32, 48, 64, 128, 256];
/// Largest accepted edge length of the master icon, which caps the decoding
/// work a broken or oversized file can cause.
const MAX_MASTER: u32 = 4096;
/// Path of the master icon relative to the crate directory.
const MASTER: &str = "../../assets/app-icon/icon.png";
/// A square RGBA image with 8 bits per channel, not premultiplied.
struct Image {
/// Edge length in pixels.
size: u32,
/// Pixels row by row, four bytes each.
rgba: Vec<u8>,
}
/// Writes the icons and runs `tauri_build`. /// Writes the icons and runs `tauri_build`.
/// ///
/// # Errors /// # Errors
/// Fails if the icons cannot be encoded or written. /// Fails if the icons cannot be encoded or written. An unusable master icon
/// is not an error; the placeholder replaces it.
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
let dir = Path::new(&std::env::var("CARGO_MANIFEST_DIR")?).join("icons"); let manifest = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR")?);
fs::create_dir_all(&dir)?; let master_path = manifest.join(MASTER);
let png = encode_png(&draw_icon(), SIZE)?;
write_if_changed(&dir.join("icon.png"), &png)?;
write_if_changed(&dir.join("icon.ico"), &ico_from_png(&png))?;
println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed={}", master_path.display());
let master = match load_master(&master_path) {
Ok(image) => image,
Err(e) => {
println!(
"cargo:warning=app icon {}: {e}; using the generated placeholder",
master_path.display()
);
Image {
size: SIZE,
rgba: draw_icon(),
}
}
};
let dir = manifest.join("icons");
fs::create_dir_all(&dir)?;
write_if_changed(&dir.join("icon.png"), &encode_png(&resize(&master, SIZE))?)?;
let mut entries = Vec::with_capacity(ICO_SIZES.len());
for size in ICO_SIZES {
entries.push((size, encode_png(&resize(&master, size))?));
}
write_if_changed(&dir.join("icon.ico"), &ico(&entries))?;
tauri_build::build(); tauri_build::build();
Ok(()) Ok(())
} }
@ -39,8 +81,137 @@ fn write_if_changed(path: &Path, bytes: &[u8]) -> std::io::Result<()> {
fs::write(path, bytes) fs::write(path, bytes)
} }
/// Draws the icon as RGBA pixels, row by row, with 4×4 supersampling for /// Reads the master icon and converts it to 8-bit RGBA.
/// smooth edges. ///
/// # Errors
/// Fails if the file cannot be read or decoded, is not square, or its edge
/// length is 0 or above [`MAX_MASTER`].
fn load_master(path: &Path) -> Result<Image, Box<dyn Error>> {
let bytes = fs::read(path)?;
let mut decoder = png::Decoder::new(Cursor::new(bytes));
decoder.set_transformations(png::Transformations::normalize_to_color8());
let mut reader = decoder.read_info()?;
let (width, height) = (reader.info().width, reader.info().height);
if width != height {
return Err(format!("not square ({width}x{height})").into());
}
if width == 0 || width > MAX_MASTER {
return Err(format!("edge length {width} outside 1..={MAX_MASTER}").into());
}
let mut buf = vec![0; reader.output_buffer_size().ok_or("image too large")?];
let frame = reader.next_frame(&mut buf)?;
if frame.bit_depth != png::BitDepth::Eight {
return Err("unsupported bit depth".into());
}
let data = buf.get(..frame.buffer_size()).ok_or("short frame")?;
let rgba: Vec<u8> = match frame.color_type {
png::ColorType::Rgba => data.to_vec(),
png::ColorType::Rgb => data
.as_chunks::<3>()
.0
.iter()
.flat_map(|&[r, g, b]| [r, g, b, 255])
.collect(),
png::ColorType::GrayscaleAlpha => data
.as_chunks::<2>()
.0
.iter()
.flat_map(|&[v, a]| [v, v, v, a])
.collect(),
png::ColorType::Grayscale => data.iter().flat_map(|&v| [v, v, v, 255]).collect(),
png::ColorType::Indexed => return Err("palette not expanded".into()),
};
let expected = (width as usize) * (width as usize) * 4;
if rgba.len() != expected {
return Err(format!("pixel data has {} bytes, expected {expected}", rgba.len()).into());
}
Ok(Image { size: width, rgba })
}
/// Resamples an image to `size`×`size` with an area-averaging box filter on
/// premultiplied alpha, which keeps edges clean when shrinking a lot (720 px
/// to 16 px). Returns a copy when the size already matches.
fn resize(src: &Image, size: u32) -> Image {
if src.size == size {
return Image {
size,
rgba: src.rgba.clone(),
};
}
let taps = box_taps(src.size, size);
let (src_n, dst_n) = (src.size as usize, size as usize);
let mut rows = vec![[0.0f64; 4]; dst_n * src_n];
for y in 0..src_n {
for (x, row_taps) in taps.iter().enumerate() {
let mut acc = [0.0f64; 4];
for &(i, w) in row_taps {
let at = (y * src_n + i) * 4;
if let Some(&[r, g, b, a]) = src.rgba.get(at..at + 4) {
let a = f64::from(a) / 255.0;
acc[0] += f64::from(r) * a * w;
acc[1] += f64::from(g) * a * w;
acc[2] += f64::from(b) * a * w;
acc[3] += a * w;
}
}
if let Some(cell) = rows.get_mut(y * dst_n + x) {
*cell = acc;
}
}
}
let mut rgba = Vec::with_capacity(dst_n * dst_n * 4);
for col_taps in &taps {
for x in 0..dst_n {
let mut acc = [0.0f64; 4];
for &(j, w) in col_taps {
if let Some(cell) = rows.get(j * dst_n + x) {
for (sum, value) in acc.iter_mut().zip(cell) {
*sum += value * w;
}
}
}
let [r, g, b, a] = acc;
let channel = |c: f64| {
if a > 0.0 {
(c / a).round().clamp(0.0, 255.0) as u8
} else {
0
}
};
rgba.extend_from_slice(&[
channel(r),
channel(g),
channel(b),
(a * 255.0).round().clamp(0.0, 255.0) as u8,
]);
}
}
Image { size, rgba }
}
/// Box-filter taps for scaling `src` samples to `dst`: for each output
/// sample, the source indices it covers and their weights, which sum to 1.
fn box_taps(src: u32, dst: u32) -> Vec<Vec<(usize, f64)>> {
let scale = f64::from(src) / f64::from(dst);
(0..dst)
.map(|o| {
let start = f64::from(o) * scale;
let end = start + scale;
let first = start.floor() as u32;
let last = (end.ceil() as u32).min(src);
(first..last)
.filter_map(|i| {
let lo = start.max(f64::from(i));
let hi = end.min(f64::from(i) + 1.0);
(hi > lo).then(|| (i as usize, (hi - lo) / scale))
})
.collect()
})
.collect()
}
/// Draws the placeholder icon as RGBA pixels, row by row, with 4×4
/// supersampling for smooth edges.
fn draw_icon() -> Vec<u8> { fn draw_icon() -> Vec<u8> {
let body = [0x6b, 0x4a, 0x32]; let body = [0x6b, 0x4a, 0x32];
let stone = [0xd9, 0xd2, 0xc5]; let stone = [0xd9, 0xd2, 0xc5];
@ -100,31 +271,42 @@ fn in_stone(x: f64, y: f64) -> bool {
((x - 0.5) / 0.26).powi(2) + ((y - 0.6) / 0.18).powi(2) <= 1.0 ((x - 0.5) / 0.26).powi(2) + ((y - 0.6) / 0.18).powi(2) <= 1.0
} }
/// Encodes RGBA pixels as PNG. /// Encodes an image as RGBA PNG.
/// ///
/// # Errors /// # Errors
/// Fails if the encoder rejects the data. /// Fails if the encoder rejects the data.
fn encode_png(pixels: &[u8], size: u32) -> Result<Vec<u8>, png::EncodingError> { fn encode_png(image: &Image) -> Result<Vec<u8>, png::EncodingError> {
let mut out = Vec::new(); let mut out = Vec::new();
{ {
let mut encoder = png::Encoder::new(&mut out, size, size); let mut encoder = png::Encoder::new(&mut out, image.size, image.size);
encoder.set_color(png::ColorType::Rgba); encoder.set_color(png::ColorType::Rgba);
encoder.set_depth(png::BitDepth::Eight); encoder.set_depth(png::BitDepth::Eight);
let mut writer = encoder.write_header()?; let mut writer = encoder.write_header()?;
writer.write_image_data(pixels)?; writer.write_image_data(&image.rgba)?;
} }
Ok(out) Ok(out)
} }
/// Wraps a 256×256 PNG in an ICO container with a single entry, which every /// Builds an ICO container from PNG-encoded entries of the given edge
/// Windows version since Vista reads. /// lengths, which every Windows version since Vista reads. An edge length of
fn ico_from_png(png: &[u8]) -> Vec<u8> { /// 256 is stored as 0, as the format requires.
let len = u32::try_from(png.len()).unwrap_or(u32::MAX); fn ico(entries: &[(u32, Vec<u8>)]) -> Vec<u8> {
let mut ico = Vec::with_capacity(22 + png.len()); let count = u16::try_from(entries.len()).unwrap_or(u16::MAX);
ico.extend_from_slice(&[0, 0, 1, 0, 1, 0]); let mut offset = 6 + 16 * entries.len();
ico.extend_from_slice(&[0, 0, 0, 0, 1, 0, 32, 0]); let mut ico = Vec::with_capacity(offset + entries.iter().map(|(_, p)| p.len()).sum::<usize>());
ico.extend_from_slice(&len.to_le_bytes()); ico.extend_from_slice(&[0, 0, 1, 0]);
ico.extend_from_slice(&22u32.to_le_bytes()); ico.extend_from_slice(&count.to_le_bytes());
ico.extend_from_slice(png); for (size, png) in entries {
let edge = u8::try_from(*size).unwrap_or(0);
let len = u32::try_from(png.len()).unwrap_or(u32::MAX);
let at = u32::try_from(offset).unwrap_or(u32::MAX);
ico.extend_from_slice(&[edge, edge, 0, 0, 1, 0, 32, 0]);
ico.extend_from_slice(&len.to_le_bytes());
ico.extend_from_slice(&at.to_le_bytes());
offset += png.len();
}
for (_, png) in entries {
ico.extend_from_slice(png);
}
ico ico
} }

BIN
assets/app-icon/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 KiB

View file

@ -1,6 +1,6 @@
# Architecture # Architecture
> **Status:** M0 decisions recorded, M1 workspace, desktop bridge, tabs and editor, message catalog, engine construction, settings, themes, the recovery journal, notifications, UI commands and the palette documented · **Last updated:** 2026-10-16 > **Status:** M0 decisions recorded, M1 workspace, desktop bridge, tabs and editor, message catalog, engine construction, settings, themes, the recovery journal, notifications, UI commands, the palette and the app icon documented · **Last updated:** 2026-10-16
## Overview ## Overview
@ -193,12 +193,13 @@ Watched directories: the VFS watcher is non-recursive, so `project.children` wat
| Clippy panic lints | `unwrap_used`, `expect_used`, `panic`, `unreachable`, `todo`, `unimplemented`, `indexing_slicing`, `string_slice` are denied workspace-wide; `clippy.toml` allows them in `#[test]`/`#[cfg(test)]`; integration tests in `tests/` and `testkit` allow them at crate level. `missing_docs` is denied too, to back the doc-comment code style. `unsafe_code` is denied; a crate that needs it allows it locally with a doc comment saying why. | AGENTS.md › Never crash. | | Clippy panic lints | `unwrap_used`, `expect_used`, `panic`, `unreachable`, `todo`, `unimplemented`, `indexing_slicing`, `string_slice` are denied workspace-wide; `clippy.toml` allows them in `#[test]`/`#[cfg(test)]`; integration tests in `tests/` and `testkit` allow them at crate level. `missing_docs` is denied too, to back the doc-comment code style. `unsafe_code` is denied; a crate that needs it allows it locally with a doc comment saying why. | AGENTS.md › Never crash. |
| Desktop dev mode | Plain `cargo build`/`cargo run -p lutra-desktop` is a Tauri dev build that loads the Vite dev server. `cargo xtask dev [-- ARGS]` starts both. A self-contained build embeds `ui/dist` through the `bundled-ui` feature. | Keeps `cargo build --workspace` independent of the frontend build. | | Desktop dev mode | Plain `cargo build`/`cargo run -p lutra-desktop` is a Tauri dev build that loads the Vite dev server. `cargo xtask dev [-- ARGS]` starts both. A self-contained build embeds `ui/dist` through the `bundled-ui` feature. | Keeps `cargo build --workspace` independent of the frontend build. |
| App identifier | `dev.lutra.desktop` is a placeholder. The final reverse-DNS identifier depends on the project's domain and hosting, which are the owner's decision (execution plan §4); bundling stays off until then. | Tauri requires an identifier to build. | | App identifier | `dev.lutra.desktop` is a placeholder. The final reverse-DNS identifier depends on the project's domain and hosting, which are the owner's decision (execution plan §4); bundling stays off until then. | Tauri requires an identifier to build. |
| App icon | A placeholder (rounded otter-brown square with a pale stone) is generated by `apps/lutra-desktop/build.rs` into the gitignored `apps/lutra-desktop/icons/`. | The real icon is the owner's to commission; ASSETS.md allows generated-in-code art. | | App icon | `apps/lutra-desktop/build.rs` downscales the owner's master `assets/app-icon/icon.png` (720 px, see ASSETS.md) with an area-averaging box filter into the gitignored `apps/lutra-desktop/icons/`: `icon.png` (256 px window icon) and a multi-size `icon.ico` (16, 32, 48, 64, 128, 256 px, PNG entries). If the master is missing or unreadable, the build prints a cargo warning and uses the placeholder generated in code (rounded otter-brown square with a pale stone). | The icon is the owner's (M1.14); decoding uses the `png` build dependency already present, so no new dependency. The fallback keeps a checkout without the asset buildable and never fails the build over an icon. |
## Revision history ## Revision history
| Date | Change | Summary | | Date | Change | Summary |
|---|---|---| |---|---|---|
| 2026-10-16 | minor | M1.14: app icon from the owner's master, multi-size ICO, placeholder as fallback |
| 2026-10-16 | minor | M1.8: UI commands (`ui.registerCommands`, `uiCommand`, `ui` in listCommands), global keymap, command palette | | 2026-10-16 | minor | M1.8: UI commands (`ui.registerCommands`, `uiCommand`, `ui` in listCommands), global keymap, command palette |
| 2026-10-16 | minor | M1.12: notifications (host emission, early-event replay, toast store and stack, deferred engine_ready) | | 2026-10-16 | minor | M1.12: notifications (host emission, early-event replay, toast store and stack, deferred engine_ready) |
| 2026-10-16 | minor | M1.13: open buffers pin their parent directory in the watcher, `bufferFocused`, truncated listing row | | 2026-10-16 | minor | M1.13: open buffers pin their parent directory in the watcher, `bufferFocused`, truncated listing row |

BIN
docs/images/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB