Skip to content

Building from Source

Mujtaba1i edited this page Nov 25, 2026 · 1 revision

Building from source

Archtoys is written in Rust with the Slint UI toolkit.

1. Install the build tools for your distribution

# Fedora
sudo dnf install rust cargo gcc pkgconf-pkg-config fontconfig-devel freetype-devel libX11-devel libxkbcommon-devel

# Arch
sudo pacman -S --needed rust pkgconf fontconfig libx11 libxkbcommon

# Debian / Ubuntu
sudo apt install cargo pkg-config libfontconfig1-dev libx11-dev libxcb-shm0-dev libxkbcommon-dev

If your distribution's Rust is too old, install the latest with rustup. For Text Extractor, install tesseract too (or turn it on in the app).

2. Clone, test and run

git clone https://github.com/Mujtaba1i/Archtoys.git
cd Archtoys
cargo test --locked
cargo run --release --locked

The app menu entry and the hotkeys on Wayland

On Wayland, the desktop knows an app by its .desktop file: without it there is no app icon (a generic "W" instead) and no global shortcut through the desktop. A package installs it. When you run from source with no package installed, add it for your user, pointing at your build:

mkdir -p ~/.local/share/applications ~/.local/share/icons/hicolor/256x256/apps
sed "s|^Exec=.*|Exec=$PWD/target/release/archtoys %u|" packaging/archtoys.desktop > ~/.local/share/applications/archtoys.desktop
cp packaging/archtoys-256.png ~/.local/share/icons/hicolor/256x256/apps/archtoys.png

Remove both files again before installing a package, or they take its place.

Good to know

  • Drawing: the window is drawn on the CPU (Slint's software renderer: it looks the same as OpenGL and uses about a third of the memory). To draw it with OpenGL instead, build with cargo build --release --locked --no-default-features --features opengl.
  • Color names: the names and the search index are prebuilt into data/names-index.*. After changing data/colornames.csv (or how names are normalized), run cargo test --locked write_name_index -- --ignored. A test fails until you do.
  • Search speed: target/release/archtoys --search-speed times every keystroke of a few searches. Each must stay under 5 ms.
  • Licences: the list in About Archtoys (data/third-party-licenses.html) is regenerated by every release with cargo about generate about.hbs -o data/third-party-licenses.html.
  • Contributing: CONTRIBUTING.md explains how to test and send a change.

Project layout

src/
├── main.rs             startup and wiring
├── window.rs           the window's size, with or without the pinned sidebar
├── color.rs            color formats, parsing, shades (unit-tested)
├── formats.rs          which formats are shown, their order, Auto Copy
├── names.rs            color names (CSS names + the names list)
├── name_index.rs       the names and search index, prebuilt from data/colornames.csv
├── search.rs           color search: families, typos, codes (unit-tested)
├── editor.rs           the color editor and Compare
├── freeze.rs           the frozen screen the three toys share, one window per monitor
├── picker/             the Color Picker: X11 live picker, the freeze frame, fallbacks
├── ocr/                Text Extractor: Tesseract, installing it, languages, history
├── fontfind/           the font finder: local fonts, the Google Fonts index, matching
├── ruler/              the Screen Ruler: edges, sizes, the screen's real size, history
├── update/             updates: how Archtoys was installed, the daily check, updating
├── config.rs           settings (saved safely) and autostart
├── single_instance.rs  one copy at a time, archtoys --pick / --extract / --measure / --screenshot
├── diagnostics.rs      Report a problem
├── launch.rs           starting the browser and desktop settings
├── kwin.rs             KDE Plasma: hiding the window during a pick, keeping its place
├── ui_state.rs         updating the main window
├── tray.rs             tray icon
├── verify.rs           every download checked: GitHub's hash of the file, or the font index's SHA-256
├── hunt.rs             the bug hunt's hostile input (tests only)
├── portal.rs           talking to the desktop portal
└── hotkey/             global hotkeys (portal and X11)
ui/app.slint            the main window
ui/shell.slint          the menu bar, sidebar, Home
ui/picker.slint         the Color Picker's page
ui/text.slint           Text Extractor's page
ui/ruler.slint          the Screen Ruler's page and its toolbar
ui/settings.slint       Settings and About
ui/update.slint         the update bubble and dialog
ui/freeze.slint         the frozen screen's windows
ui/common.slint         theme and shared widgets

Clone this wiki locally