Damson icon

Damson

A Material You code editor in Rust with 462 languages built in, and motion at the centre of how it works.

![The editor](docs/screenshots/01-editor.png) ## What's different - **Scrolling preview that pops out.** Press the rail and it widens over the code while lines near the pointer swell like a lens, and a card of real, readable code bursts out and follows you on a spring. Drag to scroll. Hold **Shift** to only peek: let go and you're back where you were. - **Terminal baked in.** A full terminal (alacritty's emulator) grows out of the Terminal button, and its prompt icon morphs into a hide chevron. The cursor glides between cells. - **Everything is on springs.** Scrolling, the caret, the current-line bubble, tabs, panels and menus all use Material 3 Expressive's spring tokens. Settings has Off, Calm, Bouncy and Jelly. - **Icons that morph between states**, and only where a button really has two: sun and moon, run and stop, `+` and `−` for staging, maximize and restore. One-shot actions like Save stay still. - **Jelly tabs** whose indicator edges are separate springs, so it stretches as it moves. - **Your own top bar.** Settings > Toolbar puts any of the app's commands beside the `+` button, up to 8. - **One box for everything.** `Ctrl+Shift+P`: type for files, `>` commands, `:` line, `@` symbol, `!` run. ![The preview lens](docs/screenshots/03-preview-lens.png) ## Syntax highlighting Syntax definitions for 462 languages are built into the binary, so nothing needs to be installed for code colours. Folding and comment tokens come from the same definitions. Drop your own `.xml` definition into `~/.local/share/org.kde.syntax-highlighting/syntax/` and it adds to or replaces a built-in one by name. 59 of about 7,100 regexes in those definitions use PCRE features the Rust engine doesn't have, such as recursion. Those single rules are skipped, so a few constructs in some languages stay uncoloured. Files with no name get their language from the text, updating as you type or paste: a shebang, a modeline (`kate: hl`, `vim: ft=`, `-*- mode -*-`), a header, or failing that how the code reads. An untitled tab takes the name that fits, like `Untitled.py`, and the save dialog starts with it. Picking a language from the status bar overrides this. A file with an extension no definition claims, like `.txt`, stays plain. ## Also included Multi-cursor (`Ctrl+Alt+Up/Down`, `Alt+J`, Ctrl+click, Alt+drag for a block), folding, bookmarks, word wrap, bracket pairing and matching, split view, zen mode (`F11`), find and replace with regex, search in files, outline, a git panel (stage, commit, pull, push, diffs, changed lines in the gutter and preview), hot exit (unsaved text survives a crash or quit), and language servers for completion, hover, go to definition and diagnostics when they're installed (`clangd`, `rust-analyzer`, `pylsp`, `gopls`, `typescript-language-server`, `bash-language-server`, `lua-language-server`). Completions appear as you type and with `Ctrl+Space`. With no working language server they come from words in the file. On rustup, `~/.cargo/bin/rust-analyzer` is only a placeholder until you run `rustup component add rust-analyzer`, and a project's first completions wait while it indexes. Colours follow your desktop (Caelestia's scheme or the KDE accent), or a colour you pick, and change live. ## Discord Damson can show what you're editing on Discord: file, project, a language icon and time spent, or Idling after five minutes. It speaks Discord's local socket directly. Settings > Discord has switches to hide the file or project name. Quitting, or switching it off, clears the status and disconnects straight away. Discord takes the app name from the application ID, so you need your own: make an application named Damson at [discord.com/developers/applications](https://discord.com/developers/applications) and paste its Application ID into Settings. To get the small Damson icon, upload a PNG of `packaging/damson.svg` under Rich Presence named `damson`. Language pictures load by URL from the [zed-discord-presence](https://github.com/xhyrom/zed-discord-presence) project; none of its code is used here (it's GPL-3). ## Taskbar actions Right-clicking Damson in a launcher that reads desktop actions offers New Window, New File, Open Folder and New Terminal. Windows opened this way stay out of your saved session, so their unsaved changes are not recovered. ![Light mode](docs/screenshots/12-other-mode.png) ## Not done yet Vi mode, spell checking, snippets, and reopening a file with a chosen encoding. Long lines are not virtualised. It runs one window per launch. Linux only for now. ## Install a release Downloads are on the [Releases page](https://astar76.com/git/astar76/Damson/releases) (Linux x86_64); check them against `SHA256SUMS-`. The Linux builds are made on Arch Linux and need a recent glibc (the version is named in the packages and checked by the installer), so they run on Arch and other up-to-date distributions; on older ones, build from source. - **Arch Linux:** `sudo pacman -U Damson--arch-x86_64.pkg.tar.zst` (package `damson-bin`; remove it with `sudo pacman -R damson-bin`). `packaging/arch/PKGBUILD` builds the same package from the release. - **Debian, Ubuntu and other apt systems:** `sudo apt install ./Damson--amd64.deb`. - **Nix:** `nix profile install git+https://astar76.com/git/astar76/Damson` (this repo is a flake), or `callPackage ./packaging/nix { }`. - **Any distribution:** unpack `Damson--Linux-x86_64.tar.gz` and run `sh install.sh` inside (your home, `~/.local`, no root) or `sh install.sh --system` (`/usr/local`). `sh uninstall.sh` removes it; `--purge` also deletes settings and data. `installer.sh` from this repo does the same next to a downloaded tar.gz or AppImage. - **AppImage:** `chmod +x Damson--x86_64.AppImage` and run it. System libraries are not bundled. ## Install from source You need Rust and a C compiler to build. Nothing else is needed at runtime except the usual graphics and windowing libraries. From a clone: ```bash ./install.sh ``` That builds in a temporary folder, installs to `/usr/local` (asking for sudo only to copy the files), and deletes the build afterwards. A rebuild starts from scratch, so it takes a few minutes each time. | Option | What it does | |---|---| | `--user` | Install to `~/.local`, with no sudo | | `--prefix DIR` | Install under `DIR` | | `--keep-build` | Build in `target/` and keep it, for quicker rebuilds | | `--uninstall` | Remove it (add `--user` or `--prefix` if that's where it went) | | `--uninstall --purge` | Also delete settings and recovery copies | Installed files: the program in `bin/`, the launcher in `share/applications/`, icons in `share/icons/hicolor/` (SVG, and PNGs from 16 to 512), AppStream data in `share/metainfo/`, and the licence and README under `share/`. An older copy in `~/.local` is removed by a system install, because it comes first on `PATH` and would hide the new one. For packaging, `DESTDIR` is honoured: `DESTDIR=/path/to/pkg ./install.sh --prefix /usr`. ## Tests ```bash cargo test --lib cargo test --test syntax_all -- --nocapture DAMSON_SHOTS=/tmp/shots cargo test --test shots -- --test-threads=1 cargo test --test features -- --test-threads=1 --nocapture ``` `shots` drives the real app with no window, using real input events, and saves a screenshot of each screen. `features` runs the features against real tools: `clangd`, a shell, `nano`, a git repository. `DAMSON_SMOKE=/some/dir damson` runs the real window for 120 frames, saves `window.png` and `status.txt`, then quits. ## Licence Damson's code is MIT. Rubik is under the SIL Open Font License; the icons are Material Symbols (Apache 2.0). The syntax definitions in `assets/syntax` are from KDE's KSyntaxHighlighting and keep their own licences, listed file by file in `assets/syntax/LICENSES.md`. Most are MIT or LGPL, and some are GPL, so check those before distributing builds. `tools/vendor_syntax.py` refreshes them from a newer KSyntaxHighlighting.