Skip to content

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

omarchy-bin

Core-only static C (musl-gcc) rewrites of Omarchy's 24/7 daemons, hot-path IPC/keybinds, and local hardware/stability fixes.

Why?

Why not?

I opened btop, saw a bash script + gdbus + socat + systemd-inhibit + Python casually eating 4–31 MB of my RAM each just to sit there doing nothing, and took it personally lol.

So I rewrote the things that actually stay resident or fire on every keypress in C and statically linked them with musl-gcc.

Core-Only Philosophy

This repo intentionally does not try to rewrite all ~680 upstream scripts in /usr/share/omarchy/bin/.

Rewriting rare one-shot scripts (install, remove, theme, refresh, restart, agent, menu toggles, etc.) buys almost zero RAM or latency while creating endless maintenance churn every time omarchy update lands. Instead, omarchy-bin focuses strictly on three things:

  1. 24/7 background daemons & their direct helpers — where replacing bash/python3/gdbus/socat/systemd-inhibit saves ~86+ MB of resident memory and eliminates idle wakeups.
  2. High-frequency hot-path IPC & keybinds — shell IPC (omarchy-shell), volume/brightness keys, OSD/notifications, and monitor hotplug/clamshell handling (plus their direct inner callees so hot paths stay 100% static C without falling back to bash+jq mid-call).
  3. Intentional local fixes & custom helpers ([OMARCHY-CUSTOM-KEEP]) — hardware/driver workarounds (like the NVIDIA half-unplugged HDMI ghost watchdog and external USB SSD HintSystem automounting), crash/race hardenings, and custom Hyprland/shell helpers.

Everything else (~645 upstream scripts) falls straight through PATH to stock /usr/share/omarchy/bin/ untouched, keeping omarchy update effortless.

Results (the petty flex)

Live measured metrics (PSS from /proc/<pid>/smaps_rollup, 0 wakeups idle except the NVIDIA HDMI DDC probe):

Daemon Stock Omarchy omarchy-bin (static musl)
omarchy-idle-screensaver (screensaver.py) ~31.5 MB (python3 + PyGObject + Gio/GLib) ~104 KB PSS (1 proc, raw session D-Bus, 0 wakeups)
omarchy-hyprland-monitor-watch (docked) ~18.2 MB (2× bash + socat + gdbus) ~164 KB PSS (1 proc, .socket2 + netlink + raw system D-Bus, ~0.16–0.29% CPU)
omarchy-drive-automount ~13.3 MB (3 procs: bash + gdbus) ~88 KB PSS (1 proc, raw system D-Bus InterfacesAdded, 0 wakeups)
omarchy-system-sleep-monitor ~12.0 MB (3 procs: systemd-inhibit + bash + dbus-monitor) ~84 KB PSS (1 proc, raw system D-Bus Inhibit, 0 wakeups)
omarchy-crash-watch (omarchy-crash-watch.service) ~7.6 MB (2× bash + jq per event) ~160 KB PSS (pure C JSON parser, 0 wakeups)
omarchy-launch-shell ~4.0 MB (bash supervisor) ~92 KB PSS (static C supervisor, 0 wakeups)
omarchy-hyprland-monitor-clamshell ~110 ms (bash + awk + sed + jq) ~5 ms (pure C, no jq/awk/sed)

~86+ MB of idle bash/Python/gdbus/socat overhead squished down to ~692 KB PSS across all 6 resident daemons. Worth it? Probably not. Satisfying? Extremely.

Kept Core Tools (39 total: 34 src/ + 5 custom/)

  • src/ holds standalone 1-to-1 .c rewrites matching /usr/share/omarchy/bin/ scripts, plus shared src/common.h and src/json.h.
  • custom/ holds non-/usr/share/omarchy/bin/ C tools (shell plugin service rewrites and custom Hyprland helpers).

1. 24/7 Daemons & Direct Daemon Helpers (11)

  • src/: omarchy-launch-shell, omarchy-hyprland-monitor-watch, omarchy-drive-automount, omarchy-system-sleep-monitor, omarchy-system-sleep-lock, omarchy-crash-watch, omarchy-notification-wait
  • custom/: omarchy-idle-screensaver, omarchy-clipboard-capture, omarchy-clipboard-persist, omarchy-clipboard-sweep

2. Custom-Keep Tools & Local Fixes (5)

  • src/: omarchy, omarchy-hyprland-monitor-internal, omarchy-hyprland-monitor-internal-mirror, omarchy-hyprland-workspace-layout-toggle
  • custom/: full-width-toggle

3. Hot-Path IPC, Media Keybinds & Monitor/Clamshell Helpers (23)

  • Shell IPC, OSD & notifications: omarchy-shell, omarchy-notification-send, omarchy-osd, omarchy-i18n
  • Volume & brightness keys (+ direct callees): omarchy-audio-output-volume, omarchy-audio-output-sink, omarchy-brightness-display, omarchy-brightness-display-ddc, omarchy-hyprland-monitor-focused, omarchy-hw-display
  • Monitor hotplug & clamshell (+ direct callees): omarchy-hyprland-monitor-clamshell, omarchy-hyprland-monitor-external-active, omarchy-hyprland-monitor-modeless, omarchy-hyprland-monitor-laptop, omarchy-hyprland-monitor-identity, omarchy-hyprland-reload-guard, omarchy-hyprland-toggle, omarchy-restart-hyprctl, omarchy-hw-laptop, omarchy-hw-laptop-closed, omarchy-hw-external-monitors, omarchy-hw-clamshell, omarchy-system-lid-inhibit

Preserving Local Fixes ([OMARCHY-CUSTOM-KEEP])

Every intentional divergence from stock /usr/share/omarchy/bin/ (hardware/driver workarounds, stability hardenings, or custom behavior) is annotated in source with /* [OMARCHY-CUSTOM-KEEP: <slug>] ... */. Scan them anytime before syncing against an upstream update:

grep -rn 'OMARCHY-CUSTOM-KEEP' src/ custom/

Build & Install

Requires musl (pacman -S musl):

# Build all core binaries atomically into ~/.local/bin/
make -j$(nproc)

# Rebuild a single tool
make omarchy-drive-automount

# Revert a single tool back to stock Omarchy
rm ~/.local/bin/<tool-name>

Safe Override (No /usr/share/omarchy/ Edits)

Nothing in /usr/share/omarchy/ is touched, so omarchy update won't wipe anything.

1. Hyprland PATH override

Omarchy's default envs.lua forces /usr/share/omarchy/bin to the front of PATH. Add this to the bottom of ~/.config/hypr/hyprland.lua (after require("default.hypr.omarchy")):

-- Keep ~/.local/bin ahead of /usr/share/omarchy/bin so personal overrides
-- take precedence cleanly.
do
  local local_bin = (os.getenv("HOME") or "") .. "/.local/bin"
  local omarchy_bin = (os.getenv("OMARCHY_PATH") or "/usr/share/omarchy") .. "/bin"
  local kept = { local_bin, omarchy_bin }
  for entry in (os.getenv("PATH") or "/usr/local/bin:/usr/bin"):gmatch("[^:]+") do
    if entry ~= local_bin and entry ~= omarchy_bin then
      table.insert(kept, entry)
    end
  end
  hl.env("PATH", table.concat(kept, ":"))
end

Then reload Hyprland (or reboot for startup daemons to pick it up):

hyprctl reload

2. Systemd user drop-ins (sleep-lock, crash-watch, clock-resync)

These systemd user units hardcode /usr/bin/.... Override them with user drop-ins:

~/.config/systemd/user/omarchy-sleep-lock.service.d/override.conf:

[Service]
ExecStart=
ExecStart=%h/.local/bin/omarchy-system-sleep-monitor

~/.config/systemd/user/omarchy-crash-watch.service.d/override.conf:

[Service]
ExecStart=
ExecStart=%h/.local/bin/omarchy-crash-watch

~/.config/systemd/user/omarchy-clock-resync.service.d/override.conf:

[Service]
ExecStart=
ExecStart=%h/.local/bin/omarchy-shell -q omarchy.clock resync

Then reload and restart the services:

systemctl --user daemon-reload
systemctl --user restart omarchy-sleep-lock.service omarchy-crash-watch.service

3. Idle screensaver inhibitor (omarchy.idle plugin)

Clone the built-in idle service plugin so upgrades never overwrite it:

omarchy plugin clone omarchy.idle

Then in ~/.config/omarchy/plugins/<username>.idle/Service.qml, replace the screensaverInhibitService command:

command: [Quickshell.env("HOME") + "/.local/bin/omarchy-idle-screensaver"]

And restart the shell:

omarchy restart shell

4. Clipboard wl-paste watcher helpers (omarchy.clipboard plugin)

Clone the built-in clipboard plugin so wl-paste --watch runs static C instead of bash + perl + python3:

omarchy plugin clone omarchy.clipboard

Then in ~/.config/omarchy/plugins/<username>.clipboard/Clipboard.qml, point captureScript, persistScript, and sweepScript at ~/.local/bin/omarchy-clipboard-{capture,persist,sweep}, and restart the shell (omarchy restart shell).

5. Custom Hyprland helper: full-width-toggle (SUPER + ALT + F)

Unlike the 1-to-1 /usr/share/omarchy/bin rewrites above, full-width-toggle is a custom Hyprland helper (upstream Omarchy binds SUPER + ALT + F directly to hl.dsp.window.fullscreen({ mode = "maximized" }), which locks focus movement in scrolling mode).

Rebind it in ~/.config/hypr/bindings.lua:

o.rebind("SUPER + ALT + F", "Full width", "full-width-toggle")

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages