Skip to content

CPT-Dawn/BaryCenter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BARYCENTER (Still πŸ› οΈ)

A zero-bloat, Wayland-native application launcher and command hub written in Rust.

Rust License: MIT Wayland Maintenance

Demo


Philosophy

Most application launchers are relics of the X11 era β€” ported forward with compatibility shims, dynamically linked against half of GTK, and polling the filesystem on every keystroke. Barycenter exists because the modern Wayland desktop deserves better.

Built from scratch in Rust with iced and iced_layershell, Barycenter talks directly to the Wayland compositor via the wlr-layer-shell protocol. There is no X11 fallback, no GLib main loop, and no runtime garbage collector. The binary is statically optimized with LTO and ships at ~12 MB stripped β€” compositor blur, exclusive keyboard grab, and sub-millisecond fuzzy matching included.

The architecture follows a strict modular Runner pattern: each capability (application search, calculator, system commands) is an isolated module behind a single trait. Adding a new runner is adding a file, not touching a framework.

Important

Barycenter requires a Wayland compositor that implements the wlr-layer-shell-unstable-v1 protocol. This includes Hyprland, Sway, river, and labwc. GNOME and KDE Plasma do not support this protocol natively.


Features

  • Wayland layer-shell native β€” renders on Layer::Overlay via wlr-layer-shell, no X11/XWayland dependency
  • Spawns on the active monitor β€” StartMode::Active places the window where your focus already is
  • Exclusive keyboard grab β€” KeyboardInteractivity::Exclusive captures input immediately on launch; no click-to-focus
  • Sub-millisecond fuzzy search β€” powered by nucleo-matcher, the same engine behind the Helix editor
  • Modular Runner architecture β€” pluggable Runner trait with three built-in modules:
    • AppRunner β€” parses .desktop files at startup, caches in memory, deduplicates, fuzzy-matches with scored ranking
    • CalcRunner β€” real-time math evaluation via meval; result copies to clipboard with wl-copy
    • SysRunner β€” system commands (lock, logout, reboot, shutdown, suspend, hibernate) via loginctl/systemctl
  • Embedded config bootstrap β€” a beautifully commented config.toml is baked into the binary at compile time and written to disk on first run via the XDG base directory spec
  • "Cosmic Dawn" theme β€” deep purple borders, translucent dark background with compositor blur passthrough, soft off-white text, vivid accent highlights β€” fully configurable via hex RGBA
  • Zero-polling β€” event-driven architecture; the process is idle until you type
  • Minimal dependency surface β€” no GTK, no Qt, no Electron; just iced, iced_layershell, and a handful of focused crates
  • Release-optimized β€” opt-level = 3, LTO, single codegen unit, stripped symbols

Installation

Building from Source

Requires a working Rust toolchain (1.85+ recommended). The Wayland development libraries (wayland-client, wayland-protocols) must be present on the system.

git clone https://github.com/cptdawn/BaryCenter.git
cd BaryCenter
cargo build --release

The binary is written to target/release/barycenter. Copy it to a location on your $PATH:

sudo install -Dm755 target/release/barycenter /usr/local/bin/barycenter

Arch Linux (AUR)

yay -S barycenter

Note

The AUR package name is a placeholder and will be updated once the package is published.


Configuration

Barycenter uses an embedded asset bootloader pattern:

  1. A fully commented default configuration is compiled into the binary via include_str! at build time.
  2. On first launch, if ~/.config/barycenter/config.toml does not exist, the embedded default is written to disk.
  3. On every subsequent launch, the on-disk file is read and parsed. User edits are always respected.
  4. To reset to defaults, simply delete the file β€” it will be regenerated on the next run.

Config Location

~/.config/barycenter/config.toml

Default Configuration

# ─── Window Geometry ──────────────────────────────────────────────────────────
width = 680
height = 480

# ─── Colors (hex RRGGBBAA β€” last two digits are alpha) ────────────────────────
border_color     = "#7B2FBEff"   # Vivid deep purple border
background_color = "#0D0B1Fcc"   # Near-black, translucent (compositor blur)
text_color       = "#E8E0F0ff"   # Soft off-white
accent_color     = "#A855F7ff"   # Selected result highlight

# ─── Typography ───────────────────────────────────────────────────────────────
font_family = "Inter"            # System font (fallback: iced default sans-serif)
font_size   = 22.0               # Base size for the search input (px)

# ─── Behavior ─────────────────────────────────────────────────────────────────
max_results   = 8                # Maximum visible results
border_width  = 2.0              # Window border thickness (px)
border_radius = 12.0             # Corner rounding (px)
Key Type Description
width / height u32 Window dimensions in pixels. Centered on the active monitor.
border_color String #RRGGBB or #RRGGBBAA hex color for the window border.
background_color String Window background. Set the alpha channel below ff for compositor blur passthrough.
text_color String Primary text color for input and result titles.
accent_color String Highlight color for the selected result row and badges.
font_family String Preferred font family name. Must be installed on the system.
font_size f32 Base font size in pixels. Result text scales proportionally.
max_results usize Maximum number of search results rendered at once.
border_width f32 Border thickness around the launcher window.
border_radius f32 Corner radius for the window and result row containers.

Usage

Barycenter is designed to be launched on-demand via a compositor keybind. It captures the keyboard, runs the query, and exits after execution or dismissal.

Hyprland

Add to ~/.config/hypr/hyprland.conf:

bind = $mainMod, SPACE, exec, barycenter

Sway

Add to ~/.config/sway/config:

bindsym $mod+space exec barycenter

Keyboard Shortcuts

Key Action
Any text Fuzzy search across applications, calculator, and system commands
↑ / ↓ Navigate results
Tab Move to next result
Enter Execute the selected result
Escape Dismiss the launcher

Runner Behavior

  • Applications β€” Always active. Searches .desktop entries from /usr/share/applications, /usr/local/share/applications, and ~/.local/share/applications. Deduplicates by name (user entries override system). Launches the Exec command directly.
  • Calculator β€” Activates when input contains digits and a math operator (+, -, *, /, ^, %, (). Pressing Enter on a calc result copies the value to the Wayland clipboard via wl-copy.
  • System β€” Activates on fuzzy match against keywords: lock, logout, reboot, shutdown, suspend, hibernate. Executes via loginctl / systemctl.

Runtime Dependencies

Dependency Required By Purpose
wl-copy CalcRunner Clipboard access for calculator results
loginctl SysRunner Session locking, logout
systemctl SysRunner Reboot, shutdown, suspend, hibernate

Architecture

src/
β”œβ”€β”€ main.rs           # Entrypoint: logging β†’ config boot β†’ runner init β†’ layer-shell launch
β”œβ”€β”€ config.rs         # Embedded asset bootloader, XDG path resolution, TOML parsing
β”œβ”€β”€ search.rs         # nucleo-matcher wrapper (fuzzy_score, fuzzy_rank)
β”œβ”€β”€ runner/
β”‚   β”œβ”€β”€ mod.rs        # Runner trait + RunnerResult struct
β”‚   β”œβ”€β”€ app.rs        # .desktop file parser, in-memory cache, fuzzy search, Command launch
β”‚   β”œβ”€β”€ calc.rs       # Math expression detection + meval evaluation + wl-copy clipboard
β”‚   └── sys.rs        # System command keywords + loginctl/systemctl execution
└── ui/
    β”œβ”€β”€ mod.rs        # iced application: state machine, message handling, view rendering
    └── theme.rs      # Cosmic Dawn: container, text input, scrollable, result row styles

Contributing

Contributions are welcome. Please open an issue before submitting large changes to discuss the approach.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/your-feature)
  3. Commit with clear messages
  4. Open a Pull Request against main

All code must pass cargo check, cargo clippy, and cargo fmt --check with no warnings.


License

MIT Β© 2026 Swastik Patel

About

Fast, Wayland-native Rust launcher and command hub with modular runners for application search, calculations, and system actions.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages