Layers/README.md

171 lines
4.6 KiB
Markdown

# Layers
A Photoshop-style logical-layer panel for KiCad 10. Group items into named logical layers,
hide them as a unit, rename/colour/lock/annotate, run set ops (merge/subtract/intersect),
snap to grid, snapshot and restore — all live against an open `pcbnew` session over KiCad's
IPC API.
Rendering of in-panel board previews is powered by [Siphon](https://git.else-if.org/jess/Siphon),
a pure-Rust KiCad-board-to-vectors crate. No shell-outs, no `kicad-cli`.
## Install
Every platform installs into KiCad 10's 3rd-party plugin directory. After install, open
KiCad's **Plugin and Content Manager** and rescan, or relaunch KiCad; the Layers toolbar
button appears in `pcbnew`.
### macOS
Requires Xcode Command-Line Tools, Rust (`rustup`), and `rsvg-convert` (optional; only used
to regenerate icons from `resources/Layers.svg`).
```sh
git clone https://git.else-if.org/jess/Layers
cd Layers
./scripts/install.sh
```
Installs to `~/Documents/KiCad/10.0/plugins/com.jesshunter.layers/`.
### Windows (10 / 11, ARM64 or x86_64)
This path uses **MSYS2 + MinGW** instead of full Visual Studio Build Tools — smaller
footprint, works the same on ARM64 and x86_64.
#### 1. Install MSYS2
Download and run the installer from <https://www.msys2.org>. Accept the defaults
(`C:\msys64`). When it finishes, launch the **MSYS2** shell it drops on your Start menu.
#### 2. Install the toolchain for your CPU
In the MSYS2 shell:
```sh
# ARM64 (Snapdragon X, Surface Pro 11, etc.)
pacman -Syu
pacman -S --needed \
mingw-w64-clang-aarch64-toolchain \
mingw-w64-clang-aarch64-cmake \
mingw-w64-clang-aarch64-ninja \
git
# x86_64 (Intel / AMD)
pacman -Syu
pacman -S --needed \
mingw-w64-ucrt-x86_64-toolchain \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninja \
git
```
(You can close + reopen the shell after the first `pacman -Syu` if it asks you to.)
#### 3. Install Rust + the GNU target
In **PowerShell** (not MSYS2):
```powershell
# Install rustup
winget install --id Rustlang.Rustup
# or: irm https://win.rustup.rs/x86_64 | iex
# After rustup finishes, add the matching GNU target:
# ARM64:
rustup target add aarch64-pc-windows-gnullvm
# x86_64:
rustup target add x86_64-pc-windows-gnu
```
#### 4. Add MinGW to your user PATH
Rust's GNU target calls out to the MinGW linker, so that directory needs to be on
PATH. Run this **once** in PowerShell (elevated shell not required):
```powershell
# ARM64
[Environment]::SetEnvironmentVariable(
"Path",
[Environment]::GetEnvironmentVariable("Path", "User") + ";C:\msys64\clangarm64\bin",
"User"
)
# x86_64
[Environment]::SetEnvironmentVariable(
"Path",
[Environment]::GetEnvironmentVariable("Path", "User") + ";C:\msys64\ucrt64\bin",
"User"
)
```
Close and reopen every PowerShell / cmd window after this so they pick up the change.
#### 5. Build + install
```bat
git clone https://git.else-if.org/jess/Layers
cd Layers
install.bat
```
Installs to `%APPDATA%\kicad\10.0\3rdparty\plugins\com.jesshunter.layers\`.
Optional: `winget install GNOME.librsvg` gives you `rsvg-convert` for regenerating icons
from `resources/Layers.svg`. Not required to build.
### Linux — Debian / Ubuntu / Pop!_OS (apt)
```sh
sudo apt update
sudo apt install -y \
build-essential pkg-config curl git \
libgtk-3-dev libxkbcommon-dev libwayland-dev \
libvulkan-dev mesa-vulkan-drivers \
librsvg2-bin
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
git clone https://git.else-if.org/jess/Layers
cd Layers
./scripts/install-linux.sh
```
Installs to `~/.local/share/kicad/10.0/3rdparty/plugins/com.jesshunter.layers/`.
### Linux — Arch / Manjaro (pacman)
```sh
sudo pacman -Syu --needed \
base-devel pkgconf curl git \
gtk3 libxkbcommon wayland \
vulkan-icd-loader vulkan-headers \
librsvg
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
git clone https://git.else-if.org/jess/Layers
cd Layers
./scripts/install-linux.sh
```
Installs to `~/.local/share/kicad/10.0/3rdparty/plugins/com.jesshunter.layers/`.
## Configuration
`resources/colors.toml` in the installed plugin directory controls every UI colour and the
window-fade alphas. Edit to taste and restart the plugin to pick up the change.
The plugin writes settings and state to:
| Platform | Path |
|---|---|
| macOS | `~/Library/Application Support/com.jesshunter.layers/` |
| Linux | `$XDG_DATA_HOME/com.jesshunter.layers/` (typically `~/.local/share/com.jesshunter.layers/`) |
| Windows | `%APPDATA%\com.jesshunter.layers\` |
## Licence
Unlicensed — see `LICENCE`.
Written by [pszsh](https://else-if.org).