Skip to content

Add Omarchy support with conditional tool management - #16

Open
CS-5 wants to merge 1 commit into
mainfrom
claude/dotfiles-omarchy-compat-bxjjrl
Open

Add Omarchy support with conditional tool management#16
CS-5 wants to merge 1 commit into
mainfrom
claude/dotfiles-omarchy-compat-bxjjrl

Conversation

@CS-5

@CS-5 CS-5 commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

This PR adds comprehensive support for Omarchy, an opinionated Arch/Hyprland setup that owns significant portions of $HOME. The dotfiles now detect Omarchy environments and adapt their behavior across package management, tool configuration, shell setup, and update workflows to avoid conflicts with Omarchy's own systems.

Key Changes

Environment Detection & Configuration

  • Added isOmarchy data flag to .chezmoi.toml.tmpl that detects /usr/share/omarchy or /etc/omarchy.conf (dev channel)
  • Added IS_OMARCHY detection to install.sh with matching logic
  • Updated AGENTS.md with comprehensive Omarchy documentation including behavior table

Tool Management (mise)

  • Migrated mise config from ~/.config/mise/config.toml to conf.d/10-dotfiles.toml drop-in to avoid conflicts with mise use -g (used by Omarchy's lazy tool stubs)
  • Added one-time migration scripts (run_once_before_00-migrate-mise-config.sh.tmpl and .ps1.tmpl) to move pre-existing dotfiles-owned config aside
  • Conditionally excluded tools Omarchy already provides: starship, lazygit, lazydocker, fd, fzf, jq, ripgrep, zoxide, usage, herdr, gh, hunk
  • Updated mise install/completion scripts to reference new config location

Shell & Login Configuration

  • Completely rewrote dot_bashrc.tmpl for Omarchy: sources Omarchy's env-bootstrap and rc, execs fish for interactive terminals instead of using chsh
  • Added guards to fish conf.d files (mise.fish, starship.fish, zoxide.fish) to skip re-activation when Omarchy's omarchy-fish already activated them
  • Conditionally dropped fzf.fish from fundle on Omarchy (vendored by omarchy-fish)
  • Updated config.fish to allow fish_vi_key_bindings override from Omarchy

Package Management & Updates

  • Modified install.sh to use omarchy-pkg-add instead of pacman -Syu on Omarchy, plus omarchy-fish and ttf-firacode-nerd
  • Updated update script to hand off system package and mise self-update steps to omarchy-update -y on Omarchy (runs last to own reboot prompt)
  • Updated clean script to use paccache -rk2 on Omarchy instead of pacman -Sc (preserves two package versions for downgrade path)
  • Added error tolerance to run_after_mise-update.sh.tmpl for package-manager builds that disable self-update

Terminal Configuration

  • Converted ghostty/config to template (ghostty/config.tmpl) with Omarchy theme system support via ~/.local/state/omarchy/current/theme/ghostty.conf

Documentation

  • Expanded AGENTS.md with detailed Omarchy section covering login shell, bashrc, bootstrap packages, fish, mise config, and mise self-update behavior
  • Updated README.md to mention Omarchy support and link to detailed documentation

Implementation Details

  • The conf.d drop-in approach for mise leverages precedence rules: conf.d is lowest precedence, so config.toml (written by mise use -g) wins for duplicate tools, avoiding shadowing issues
  • Shell activation guards use function existence checks (functions -q) rather than just binary checks, since Omarchy's vendor_conf.d activations are per-shell state
  • Omarchy detection happens at chezmoi init time (like isDc and identity), so post-install Omarchy setup requires re-init
  • All Omarchy-specific behavior is gated by the isOmarchy flag, maintaining clean separation and allowing easy testing via render.sh --data '{"isOmarchy":true}'

https://claude.ai/code/session_01CXzpqB5fEr7ASNjLz7AjKT

Omarchy owns a large part of $HOME plus its own mise, package-update
entrypoint, and login shell, and several of these dotfiles collided with
it hard enough to break. Add an `isOmarchy` data flag (a
/usr/share/omarchy directory or, on the dev channel, /etc/omarchy.conf)
and defer to Omarchy wherever it already provides something.

Fixes outright breakage:

- install.sh no longer chsh's to fish there. SDDM, /etc/profile.d, and
  the uwsm session are bash scripts, and chsh'ing to fish breaks the
  graphical login. ~/.bashrc execs fish for interactive terminals
  instead, which is what omarchy-setup-fish does -- but chezmoi owns
  ~/.bashrc, so that command must not be run.
- install.sh's bootstrap step and `update` both ran `pacman -Syu`, which
  Omarchy's 00-omarchy-update-guard.hook libalpm hook aborts. The former
  now uses omarchy-pkg-add; the latter hands the whole system-package
  step to `omarchy-update -y`, which also covers mise itself and mise's
  tools. It runs last because it owns the reboot prompt.
- `mise self-update` is tolerated rather than fatal. Omarchy installs
  mise-bin, which ships mise's self-update marker and exits nonzero, so
  every `chezmoi apply` was failing on that script. Same fix covers
  Arch's mise and Homebrew.
- `clean` trims the package cache with `paccache -rk2` instead of
  emptying it with `pacman -Sc`: Omarchy treats the cache as its only
  offline downgrade path and keeps two versions per package.

Splits mise config ownership:

- The tool config moves from ~/.config/mise/config.toml to a
  conf.d/10-dotfiles.toml drop-in. Omarchy provisions its lazy tool
  stubs with `mise use -g`, which writes config.toml, so chezmoi owning
  that file made the two clobber each other on every apply. mise
  structurally refuses to write into conf.d. Note the precedence
  trade-off: config.toml outranks conf.d.
- A run_once script moves a pre-existing dotfiles-owned config.toml
  aside (config.toml outranks conf.d, so a leftover copy would keep
  winning). It recognises the old file by its minimum_release_age line
  so a `mise use -g` config survives untouched.
- Tools Omarchy already ships are dropped there: starship, lazygit,
  lazydocker, fd, fzf, jq, ripgrep, zoxide, usage and herdr as pacman
  packages, gh and hunk as Omarchy's ~/.local/bin mise stubs. A
  duplicate herdr is the worst of these -- Omarchy has a migration that
  deletes mise copies because a stale client shadows /usr/bin/herdr with
  an older wire protocol.

Shell and terminal integration:

- ~/.bashrc sources Omarchy's default/bash/env-bootstrap above the
  interactivity guard (OMARCHY_PATH and the PATH entries non-interactive
  shells and the uwsm session need), then default/bash/rc, and skips our
  duplicate starship/mise/zoxide/mcfly activations and history settings.
- install.sh installs omarchy-fish and ttf-firacode-nerd. omarchy-fish
  vendors fzf.fish, so the fundle copy is dropped to stop the two
  fighting over the same keybindings; conf.d/{mise,zoxide,starship}.fish
  now check for the function their activation defines so they don't
  spawn a redundant subprocess on every shell start.
- The ghostty config becomes a template that follows Omarchy's theme
  system (config-file = ?".../current/theme/ghostty.conf") instead of
  pinning a theme, so the terminal stays in sync with the rest of the
  desktop. font-family stays unquoted on purpose: omarchy-font-set only
  rewrites a quoted one, which keeps chezmoi the source of truth.

Renders are byte-identical to before on non-Omarchy hosts. Verified with
chezmoi init --apply into a throwaway HOME both with and without a
/usr/share/omarchy present, including the config.toml migration in both
directions, `update`/`clean` branch selection against command stubs, the
bash-to-fish handoff guards, and the fish activation guards under real
fish.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXzpqB5fEr7ASNjLz7AjKT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant