# sip
[slurp]: https://github.com/emersion/slurp
Interactive Wayland screen-region selector with [slurp]-compatible output and a
small footprint. `sip` draws a `wlr-layer-shell` overlay on every output, lets
the user drag out a rectangle (or, alternatively, pick from a set of predefined
boxes), and reports the result. It is usable both as a library and through the
bundled `sip` binary. With its goal to be a modern slurp replacement, Sip
features:
- **Pure-Rust rendering.** Fills, borders, crosshairs, and the dimensions
readout are drawn with `tiny-skia`; glyphs come from `fontdue`, with fonts
discovered via `fontdb`. There is no cairo/pango dependency :)
- **Dependency on odern protocols only.** Logical geometry comes from
`xdg-output`; the crosshair cursor uses `cursor-shape-v1`. Backwards
compatibility with compositors lacking these is explicitly not a goal.
- **Event-driven.** A single `wayland-client` event queue drives per-output
overlays, seat input (pointer, keyboard via xkb, touch), and frame-callback
damage tracking.
and retains full feature (but not API!) parity with slurp. See supported
features:
| Drag-to-select region | Supported |
| Single-point selection (`-p`) | Supported |
| Predefined choice boxes (stdin) | Supported |
| Box per output (`-o`) | Supported |
| Restrict to boxes (`-r`) | Supported |
| Fixed aspect ratio (`-a`) | Supported |
| Shift = 1:1 aspect | Supported |
| Space = move anchor | Supported |
| Escape = cancel | Supported |
| Fullscreen crosshairs (`-x`) | Supported |
| Dimensions readout (`-d`) | Supported |
| Themeable colors / border weight | Supported |
| Format string output (`-f`) | Supported |
| Multi-output, fractional scale | Supported |
| Touch input | Supported |
| Single-instance lock | Supported |
## Library usage
```rust
let selection = sip::select_region(sip::SelectOptions::default())?;
println!("{},{} {}x{}", selection.rect.x, selection.rect.y,
selection.rect.width, selection.rect.height);
```
## Building
The crate links `libxkbcommon` and `libwayland-client`; everything else is pure
Rust.
```sh
# Build in release mode
$ cargo build --release
```
## License
[provided here]: https://interoperable-europe.ec.europa.eu/sites/default/files/custom-page/attachment/eupl_v1.2_en.pdf
This project is made available under European Union Public Licence (EUPL)
version 1.2. See [LICENSE](LICENSE) for more details on the exact conditions. An
online copy is [provided here].