5 unstable releases
Uses new Rust 2024
| new 0.5.1 | May 5, 2026 |
|---|---|
| 0.5.0 | May 4, 2026 |
| 0.4.0 | May 3, 2026 |
| 0.3.1 | Apr 29, 2026 |
| 0.3.0 | Apr 20, 2026 |
#1728 in GUI
607 downloads per month
Used in 3 crates
285KB
5.5K
SLoC
nwg-common
Shared library backing the nwg-dock,
nwg-drawer, and
nwg-notifications ports —
the macOS-style dock, app drawer, and notification daemon for
Hyprland and Sway, written in Rust.
What's in the box
- Compositor-neutral IPC abstraction. A
Compositortrait with Hyprland and Sway backends, auto-detected fromHYPRLAND_INSTANCE_SIGNATURE/SWAYSOCKenv vars. A null backend for graceful degradation on unsupported compositors (Niri, river, Openbox, etc.). Consumers callinit_or_exitorinit_or_nulland only talk to the trait from then on. .desktopfile handling. Parser with locale-awareName/Commentresolution, FreeDesktop category assignment with secondary-category mapping, icon file lookup, and user-configured preferred-app overrides.- CSS loading + hot-reload. GTK4 CssProvider loading with recursive
@importgraph resolution, cycle detection, and an in-place file watcher that survives both truncate-in-place and rename-swap save strategies. - XDG paths. Data / config / cache directory resolution following the XDG Base Directory spec.
- Application launching. Direct spawn and compositor-
execpathways, plus a shared child-reaper thread so GUI-app processes don't zombify. Handles.desktopfield codes, theme prepends, and terminal launches. - Shared pin file. Atomic save / load with case-insensitive pin / unpin
for the
~/.cache/mac-dock-pinnedfile used by the dock and drawer. - RT-signal plumbing.
SIGRTMIN+1..+6helpers with runtimeSIGRTMINquery (correct on glibc and musl), plus SIGTERM and single-instance signaling. - Single-instance lock. Per-user lock file with stale-PID recovery that
validates
/proc/<pid>/exeagainst the caller's own binary to avoid acting on recycled PIDs. - Fullscreen layer-shell backdrops. Per-monitor transparent surfaces for click-outside-to-close UI patterns, across the drawer / notifications panel / DND menu.
Stability contract
nwg-common is in 0.x. Per crates.io semver convention for 0.x
crates:
- Breaking changes ship as minor bumps (
0.3 → 0.4). - Additive changes ship as patch or minor depending on scope.
- 1.0.0 is a deliberate decision we'll make once the public API has had real-world soak time across the three binaries that depend on it. Don't expect it imminently — the point of the 0.x window is to let the surface settle.
Binaries consuming nwg-common should pin to nwg-common = "0.3" (or
whatever the current minor is) so patch bumps flow automatically while
minor bumps are opted into deliberately.
The public surface is sealed behind #![warn(missing_docs)] — every item
you can import is documented. See cargo doc --open -p nwg-common.
Pre-split history
Before v0.3.0, this crate lived inside the
mac-doc-hyprland
monorepo as nwg-dock-common at version 0.2.0. The full pre-split git
history is preserved in the monorepo; this crate's CHANGELOG.md
documents changes from v0.3.0 onward.
License
MIT. See the LICENSE file in the repo root.
Dependencies
~20–33MB
~559K SLoC