From b09d2936c366d3c628fe7b64313445b81f40fcb3 Mon Sep 17 00:00:00 2001 From: ansub Date: Wed, 25 Feb 2026 22:40:41 +0530 Subject: [PATCH 1/2] docs: make README beginner-first with quickstart and troubleshooting --- README.md | 178 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 175ee2c..7a4fcc5 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,45 @@ Boo - Banner (1) -Boo helps you make your terminal look and feel better in minutes — without manually editing config files. +# Boo -## What You Get - -- Beautiful ready-to-use themes (plus easy custom theme creation) -- Better defaults for Ghostty + Zsh setup -- A clean startup panel and optional splash art -- Simple commands to change opacity, theme, prompt, and mode -- Create your own theme in seconds with `boo theme create` -- Quick troubleshooting with `boo doctor` -- Safe install/upgrade/uninstall flow with backups +Boo helps you make Ghostty + Zsh look good in minutes without hand-editing config files. -## Great for beginners +## Start Here (2 to 5 minutes) -If you're new to terminal setup, Boo gives you a polished setup fast with one command and easy controls: +Copy and run these commands in order: ```bash +curl -fsSL https://boo.ansub.co/install.sh | bash +source ~/.zshrc +boo doctor boo theme fallout boo opacity glass ``` +Expected result: + +- `boo doctor` runs checks and tells you if anything needs fixing. +- `boo theme fallout` changes your color theme. +- `boo opacity glass` updates background transparency. + +If theme or opacity does not change right away, jump to [If Something Looks Wrong](#if-something-looks-wrong). + +## What You Get + +- Ready-to-use themes and easy custom theme creation +- Better Ghostty + Zsh defaults +- Startup panel plus optional splash art +- Simple commands for theme, opacity, prompt, and mode +- Built-in troubleshooting with `boo doctor` +- Safe install/upgrade/uninstall flow with backups + +## Prerequisites + +- macOS (tested) +- [Ghostty](https://ghostty.org/) +- `zsh` +- [oh-my-posh](https://ohmyposh.dev/) (optional, only needed for `boo prompt set omp`) + ## Install ```bash @@ -28,81 +47,96 @@ curl -fsSL https://boo.ansub.co/install.sh | bash source ~/.zshrc ``` -Open a new Ghostty window, then run: +Safety notes: + +- Installer creates timestamped backups before replacing files. +- `boo uninstall` can restore your previous Ghostty config when a backup exists. + +## Verify It Worked ```bash boo doctor +boo status +``` + +Expected result: + +- `boo doctor` shows mostly successful checks, or tells you exactly what to run next. +- `boo status` shows your current theme, mode, splash, prompt, and opacity. + +## First Customization (3 commands) + +```bash boo theme fallout +boo opacity glass +boo prompt set native ``` -## If changes don't apply immediately +Optional preview: -- Press `Cmd+Shift+,` in Ghostty, or -- Run `boo reload --unsafe` +```bash +boo preview all +``` -## Requirements +## If Something Looks Wrong -- macOS (tested) -- [Ghostty](https://ghostty.org/) -- `zsh` -- [oh-my-posh](https://ohmyposh.dev/) (optional) +### `boo: command not found` -## First 5 Minutes +```bash +source ~/.zshrc +``` + +Then open a new Ghostty window and run: ```bash boo doctor -boo status -boo theme fallout -boo opacity glass -boo reload --unsafe ``` -## Common Commands +### Theme or opacity did not apply + +- Press `Cmd+Shift+,` in Ghostty. +- Or run `boo reload --unsafe`. +- If opacity still does not change on macOS, fully restart Ghostty. -### Themes (change your terminal colors) -Switch themes, preview them, and manage your custom themes. +### `boo doctor` reports issues + +```bash +boo doctor fix +boo doctor +``` + +## Common Tasks + +### Themes ```bash boo theme list boo theme abyss -boo crimson # shorthand +boo crimson boo preview all boo preview abyss --plain ``` -### Create themes (make your own look) -Generate a new theme from an accent color, or create one manually. +### Create your own theme ```bash -# Direct mode (one command) +# One command boo theme create --name synthwave --accent '#ff3ea5' -# Iterative mode (guided prompts) +# Guided prompts boo theme create +# Delete a custom theme boo theme delete synthwave ``` -You can also create a theme file directly in `~/.config/boo/themes/.theme`: +You can also create `~/.config/boo/themes/.theme` manually, then run: -```ini -description=my custom theme -accent=#ff6a00 -bg=#0a0400 -fg=#ffb870 -cursor=#ff6a00 -cursor_text=#000000 -selection_bg=#2a1800 -selection_fg=#ffd4a0 -pal_0=#0a0400 -... -pal_15=#ffe8cc +```bash +boo theme ``` -Then run `boo theme `. - -### Prompt (how your shell prompt looks) -Choose between Boo's built-in prompt and oh-my-posh. +### Prompt backend ```bash boo prompt @@ -110,16 +144,14 @@ boo prompt set native boo prompt set omp ``` -### Mode (what info is shown on startup) -Control how much detail Boo shows when terminal opens. +### Startup mode ```bash boo mode full boo mode public ``` -### Splash art (startup visual) -Pick the startup art, use your own, or disable it. +### Splash art ```bash boo splash list @@ -129,50 +161,50 @@ boo splash none boo splash reset ``` -### Reload + doctor (apply and troubleshoot) -Reload terminal config and run health checks when something feels off. +### Health + reload ```bash -boo reload -boo reload --unsafe boo doctor boo doctor fix +boo reload +boo reload --unsafe ``` -### Uninstall (remove Boo cleanly) +## Uninstall / Restore ```bash boo uninstall -# or non-interactive +# non-interactive boo uninstall --yes ``` +Expected result: + +- Boo-managed setup is removed. +- Previous Ghostty config is restored when available. + ## Theme Intent - `abyss`: deep indigo with violet-magenta accents (default) - `clay`: warm cream light mode with earthy terracotta accents - `crimson`: high-contrast red mode -- `fallout`: RobCo phosphor CRT — warm amber-lime on near-black +- `fallout`: RobCo phosphor CRT, warm amber-lime on near-black - `lunar`: desaturated monochrome noir -- `moss`: damp forest floor — muted earthy green -- `rust`: oxidized metal — brutalist copper - -## Roadmap +- `moss`: damp forest floor, muted earthy green +- `rust`: oxidized metal, brutalist copper -- Font controls (`boo font`) are planned and will return in an upcoming release. -- More quality-of-life improvements for first-time setup. -## Reload Behavior +## Advanced Notes - `boo reload`: safe guidance only (no key injection, no window/session changes) -- `boo reload --unsafe`: tries to trigger Ghostty `reload_config` via detected comma-based keybind (`Cmd+Shift+,` or `Cmd+,`) +- `boo reload --unsafe`: tries to trigger Ghostty `reload_config` via comma-based keybind (`Cmd+Shift+,` or `Cmd+,`) - Theme changes auto-run safe reload - Opacity changes auto-run unsafe reload - On macOS, `background-opacity` can still require a full Ghostty restart -## Notes +## Roadmap -- Installer creates timestamped backups when replacing files. -- `boo uninstall` restores your original Ghostty config when available, otherwise removes Boo-managed config. +- Font controls (`boo font`) are planned and will return in an upcoming release. +- More quality-of-life improvements for first-time setup. ## License From 4a9e15f9e97a754e013e9e2abbfb4af8b6cdb03a Mon Sep 17 00:00:00 2001 From: ansub Date: Thu, 26 Feb 2026 14:17:22 +0530 Subject: [PATCH 2/2] fix(prompt): isolate oh-my-posh config by theme --- bin/boo | 49 ++++++++++++++++++++++++++++++++++++------------- shell/boo.zsh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 14 deletions(-) diff --git a/bin/boo b/bin/boo index e9abd90..fcbf71f 100755 --- a/bin/boo +++ b/bin/boo @@ -24,7 +24,8 @@ GHOSTTY_CONFIG_MAC="${HOME}/Library/Application Support/com.mitchellh.ghostty/co GHOSTTY_ORIGINAL_BACKUP_PRIMARY="${HOME}/.config/boo/backups/ghostty-config-primary.original" GHOSTTY_ORIGINAL_BACKUP_MAC="${HOME}/.config/boo/backups/ghostty-config-mac.original" BOO_GHOSTTY_MARKER="# Boo managed Ghostty config" -OMP_ACTIVE_CONFIG="${HOME}/.config/ohmyposh/boo.omp.json" +OMP_LEGACY_CONFIG="${HOME}/.config/ohmyposh/boo.omp.json" +OMP_CONFIG_DIR="${HOME}/.config/ohmyposh" OMP_PRESET_DIR="${HOME}/.config/boo/ohmyposh" DEFAULT_OPACITY="0.92" DEFAULT_THEME="abyss" @@ -323,6 +324,12 @@ write_theme_file() { printf '%s\n' "$theme" > "$THEME_FILE" } +omp_config_for_theme() { + local theme="$1" + theme_name_is_safe "$theme" || return 1 + printf '%s\n' "${OMP_CONFIG_DIR}/boo.${theme}.omp.json" +} + read_prompt_backend() { local backend if [[ -f "$PROMPT_FILE" ]]; then @@ -1097,7 +1104,10 @@ print_preview_all_row() { write_theme_env_file() { local theme="$1" - local accent panel + local accent panel omp_config + if ! omp_config="$(omp_config_for_theme "$theme")"; then + omp_config="$OMP_LEGACY_CONFIG" + fi if load_theme "$theme"; then accent="$_T_accent" panel="$_T_panel_rgb" @@ -1111,6 +1121,7 @@ write_theme_env_file() { export BOO_THEME="${theme}" export BOO_ACCENT_COLOR="${accent}" export BOO_PANEL_COLOR_RGB="${panel}" +export BOO_OMP_CONFIG="${omp_config}" EOF } @@ -1119,6 +1130,7 @@ apply_prompt_theme() { local tmp local base_preset="" local first_preset + local omp_active_config="" local accent chip_cloud_bg go_fg az_fg gcp_fg tf_fg sysinfo_fg local frame ink muted @@ -1130,6 +1142,9 @@ apply_prompt_theme() { if ! load_theme "$theme"; then return 1 fi + if ! omp_active_config="$(omp_config_for_theme "$theme")"; then + return 1 + fi accent="$_T_accent" frame="${_T_ui_dim:-$(blend_color "$_T_bg" "$_T_fg" 430)}" @@ -1173,8 +1188,10 @@ apply_prompt_theme() { git_dirty_tpl="{{ if or (.Working.Changed) (.Staging.Changed) }}${git_dirty_bg}{{ end }}" git_diverged_tpl="{{ if and (gt .Ahead 0) (gt .Behind 0) }}${git_diverged_bg}{{ end }}" - if [[ ! -f "$OMP_ACTIVE_CONFIG" ]]; then - if [[ -f "${OMP_PRESET_DIR}/abyss.omp.json" ]]; then + if [[ ! -f "$omp_active_config" ]]; then + if [[ -f "${OMP_PRESET_DIR}/${theme}.omp.json" ]]; then + base_preset="${OMP_PRESET_DIR}/${theme}.omp.json" + elif [[ -f "${OMP_PRESET_DIR}/abyss.omp.json" ]]; then base_preset="${OMP_PRESET_DIR}/abyss.omp.json" else for first_preset in "$OMP_PRESET_DIR"/*.omp.json; do @@ -1190,11 +1207,13 @@ apply_prompt_theme() { return 1 fi - mkdir -p "$(dirname "$OMP_ACTIVE_CONFIG")" - cp "$base_preset" "$OMP_ACTIVE_CONFIG" + mkdir -p "$(dirname "$omp_active_config")" + cp "$base_preset" "$omp_active_config" fi if ! command -v jq >/dev/null 2>&1; then + mkdir -p "$(dirname "$OMP_LEGACY_CONFIG")" + cp "$omp_active_config" "$OMP_LEGACY_CONFIG" 2>/dev/null || true return 0 fi @@ -1273,12 +1292,14 @@ apply_prompt_theme() { | (.blocks[].segments[] | select(.type=="git").background_templates[0]) = $git_dirty_tpl | (.blocks[].segments[] | select(.type=="git").background_templates[1]) = $git_diverged_tpl ' \ - "$OMP_ACTIVE_CONFIG" > "$tmp"; then + "$omp_active_config" > "$tmp"; then rm -f "$tmp" - printf 'Failed to patch prompt config: %s\n' "$OMP_ACTIVE_CONFIG" >&2 + printf 'Failed to patch prompt config: %s\n' "$omp_active_config" >&2 return 1 fi - mv "$tmp" "$OMP_ACTIVE_CONFIG" + mv "$tmp" "$omp_active_config" + mkdir -p "$(dirname "$OMP_LEGACY_CONFIG")" + cp "$omp_active_config" "$OMP_LEGACY_CONFIG" 2>/dev/null || true return 0 } @@ -2582,11 +2603,13 @@ cmd_uninstall() { removed_any=1 fi - if [[ -f "$OMP_ACTIVE_CONFIG" ]]; then - rm -f "$OMP_ACTIVE_CONFIG" - printf 'Removed prompt config: %s\n' "$OMP_ACTIVE_CONFIG" + local omp_file + for omp_file in "$OMP_LEGACY_CONFIG" "${OMP_CONFIG_DIR}"/boo.*.omp.json; do + [[ -e "$omp_file" ]] || continue + rm -f "$omp_file" + printf 'Removed prompt config: %s\n' "$omp_file" removed_any=1 - fi + done # Reset Ghostty config to original/default before removing Boo state files. local ghostty_paths=("$GHOSTTY_CONFIG_PRIMARY" "$GHOSTTY_CONFIG_MAC") diff --git a/shell/boo.zsh b/shell/boo.zsh index 83db072..b1139f6 100644 --- a/shell/boo.zsh +++ b/shell/boo.zsh @@ -2,6 +2,7 @@ BOO_PROMPT_FILE="$HOME/.config/boo/prompt" BOO_DEFAULT_PROMPT_BACKEND="native" +BOO_OMP_CONFIG_LEGACY="$HOME/.config/ohmyposh/boo.omp.json" BOO_SPLASH_FILE="$HOME/.config/boo/splash.zsh" BOO_CUSTOM_SPLASH_FILE="$HOME/.config/boo/custom-splash.txt" BOO_ART_DIR="$HOME/.config/boo/art" @@ -48,6 +49,49 @@ boo_effective_prompt_backend() { printf '%s\n' "$configured" } +boo_omp_config_for_theme() { + local theme="${1:-}" + if [[ -z "$theme" ]]; then + printf '%s\n' "$BOO_OMP_CONFIG_LEGACY" + return + fi + printf '%s\n' "$HOME/.config/ohmyposh/boo.${theme}.omp.json" +} + +boo_resolve_omp_config() { + local explicit="${BOO_OMP_CONFIG:-}" + local themed="" + + if [[ -n "$explicit" && -f "$explicit" ]]; then + printf '%s\n' "$explicit" + return + fi + + if [[ -n "${BOO_THEME:-}" ]]; then + themed="$(boo_omp_config_for_theme "$BOO_THEME")" + if [[ -f "$themed" ]]; then + printf '%s\n' "$themed" + return + fi + fi + + if [[ -f "$BOO_OMP_CONFIG_LEGACY" ]]; then + printf '%s\n' "$BOO_OMP_CONFIG_LEGACY" + return + fi + + if [[ -n "$explicit" ]]; then + printf '%s\n' "$explicit" + return + fi + if [[ -n "$themed" ]]; then + printf '%s\n' "$themed" + return + fi + + printf '%s\n' "$BOO_OMP_CONFIG_LEGACY" +} + boo_apply_highlight_colors() { local accent="${BOO_ACCENT_COLOR:-#a882ff}" if [[ -n ${ZSH_HIGHLIGHT_STYLES+x} ]]; then @@ -102,9 +146,12 @@ boo_apply_native_prompt() { } boo_apply_omp_prompt() { + local omp_config boo_remove_native_prompt_hooks if command -v oh-my-posh >/dev/null 2>&1; then - eval "$(oh-my-posh init zsh --config ~/.config/ohmyposh/boo.omp.json)" + omp_config="$(boo_resolve_omp_config)" + [[ -f "$omp_config" ]] || return 1 + eval "$(oh-my-posh init zsh --config "$omp_config")" return 0 fi return 1