Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions themes/THEMES.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@

[![](sexy/sexy-dark.png)](sexy/sexy-dark.png)

## `shxll`

[![](shxll/shxll-dark.png)](shxll/shxll-dark.png)

## `simple`

[![](simple/simple-dark.png)](simple/simple-dark.png)
Expand Down
Binary file added themes/shxll/shxll-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 147 additions & 0 deletions themes/shxll/shxll.theme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#! bash oh-my-bash.module

SHXLL_CHAR="λ"

__omb_theme_cmd_started=0
__omb_theme_cmd_start=0
__omb_theme_cmd_armed=1
__omb_theme_prev_debug_trap=""

__omb_theme_last_clock=""
__omb_theme_force_clock=1

__omb_theme_in_prompt=0
__omb_theme_last_venv=""
__omb_theme_cached_venv=""

__omb_theme_prev_debug_trap_src="$(trap -p DEBUG)"
if [[ $__omb_theme_prev_debug_trap_src =~ ^trap\ --\ \'(.*)\'\ DEBUG$ ]]; then
__omb_theme_prev_debug_trap="${BASH_REMATCH[1]}"
fi
unset __omb_theme_prev_debug_trap_src

_omb_theme_now() {
if [[ -n ${EPOCHREALTIME-} ]]; then
local sec frac
sec=${EPOCHREALTIME%%[.,]*}
frac=${EPOCHREALTIME#*[.,]}
frac=${frac:0:3}
printf '%s%03d' "$sec" "$((10#${frac:-0}))"
else
printf '%(%s%3N)T' -1x
fi
}

_omb_theme_print_clock() {
local clock_now
clock_now=$(date +%H:%M)

if [[ $__omb_theme_force_clock -eq 1 || $clock_now != $__omb_theme_last_clock ]]; then
printf '\033[90m⌞ %s ⌟\033[0m\n' "$clock_now"
__omb_theme_last_clock="$clock_now"
fi
Comment on lines +23 to +42
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Unsupported printf time format 🐞 Bug ☼ Reliability

_omb_theme_now / _omb_theme_print_clock use the Bash printf '%(... )T' time formatter, which
is not available on older Bash versions that Oh My Bash explicitly supports (>= 3.2). On those
systems, the theme will emit printf errors and the prompt can break.
Agent Prompt
### Issue description
The theme uses Bash `printf '%(... )T'` time formatting as a fallback for timing and for the clock. This is not supported on Bash versions that OMB supports (>= 3.2), so the prompt can error/break.

### Issue Context
OMB’s entrypoint explicitly supports Bash 3.2+, so themes must not depend on `printf '%(... )T'`.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[25-44]
- oh-my-bash.sh[13-22]

### Implementation notes
- Keep the fast path using `EPOCHREALTIME` when present.
- Replace the `printf '%(... )T'` fallback with a portable method (e.g., seconds-only using `$SECONDS` or `date +%s`), and gate millisecond precision behind feature detection.
- Similarly replace `printf -v clock_now '%(%H:%M)T' -1` with `clock_now=$(date +%H:%M)` (or equivalent) to support Bash 3.2/macOS.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


__omb_theme_force_clock=0
}

_omb_theme_debug_trap() {
[[ $__omb_theme_in_prompt -eq 1 ]] && return

if [[ $BASH_COMMAND == clear || $BASH_COMMAND == reset || $BASH_COMMAND == cls ]]; then
__omb_theme_force_clock=1
fi

if [[ $__omb_theme_cmd_armed -eq 1 && $__omb_theme_cmd_started -eq 0 ]]; then
__omb_theme_cmd_start=$(_omb_theme_now)
__omb_theme_cmd_started=1
__omb_theme_cmd_armed=0
fi

if [[ -n $__omb_theme_prev_debug_trap ]]; then
eval -- "$__omb_theme_prev_debug_trap"
fi
}

trap '_omb_theme_debug_trap' DEBUG

_omb_theme_shxll_way_prompt_scm() {
local CHAR branch dirty color
CHAR=$(scm_char)

if [[ $CHAR != "$SCM_NONE_CHAR" ]]; then
branch=$(git_clean_branch)
dirty=$(git status --porcelain 2>/dev/null)

if [[ -n "$dirty" ]]; then
color="${_omb_prompt_yellow}"
else
color="${_omb_prompt_blue}"
fi

printf '%s' " ϟ ${color}${branch}${_omb_prompt_normal}"
fi
}
Comment on lines +67 to +83
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Scm segment goes stale 🐞 Bug ≡ Correctness

_omb_theme_shxll_way_prompt_scm caches the git segment solely by PWD and also calls scm_char
without refreshing SCM, so the prompt can show outdated or incorrect SCM info (e.g., after `git
checkout/dirty changes, or after cd` to a non-repo). This can mislead users because the prompt
won’t reflect current repo state.
Agent Prompt
### Issue description
The SCM segment logic can become stale/incorrect because it caches output purely by `PWD` and it uses `scm_char` without ensuring SCM state is refreshed for the current directory.

### Issue Context
Users commonly change git state (checkout, add, commit) without changing directories, so a PWD-only cache makes the prompt wrong. Also, `scm_prompt_char` only runs `scm` when the global `SCM` is empty; this theme doesn’t otherwise refresh `SCM` per prompt.

### Fix Focus Areas
- themes/shxll/shxll.theme.sh[69-94]
- lib/omb-prompt-base.sh[120-138]

### Implementation notes
- Either remove the PWD cache entirely, or include additional cache keys (e.g., git HEAD + dirty flag) so the segment updates when state changes.
- Ensure SCM state is refreshed per prompt: call `scm` (or `scm_prompt_vars` / `scm_prompt_info`) before checking SCM.
- Prefer using OMB’s existing SCM helpers (`scm_prompt_vars` / `scm_prompt_info`) instead of directly calling `git status` so behavior is consistent across themes.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


_omb_theme_get_venv() {
local venv=${VIRTUAL_ENV-}
if [[ $venv == "$__omb_theme_last_venv" ]]; then
printf '%s' "$__omb_theme_cached_venv"
return
fi

local out=""
_omb_prompt_get_python_venv
out=$python_venv

__omb_theme_last_venv=$venv
__omb_theme_cached_venv=$out
printf '%s' "$out"
}

function _omb_theme_PROMPT_COMMAND {
local exit_code=$?
local scm_segment=""
local python_venv=""
local ps_username=""
local ps_path=""
local ps_user_mark=""
local status=""
local time_str=""

__omb_theme_in_prompt=1

_omb_theme_print_clock

if [[ $__omb_theme_cmd_started -eq 1 ]]; then
local now elapsed_ms
now=$(_omb_theme_now)
elapsed_ms=$((now - __omb_theme_cmd_start))

if ((elapsed_ms > 500)); then
time_str="${_omb_prompt_gray}${elapsed_ms}ms${_omb_prompt_normal} "
fi
fi

__omb_theme_cmd_started=0

python_venv=$(_omb_theme_get_venv)
scm_segment=$(_omb_theme_shxll_way_prompt_scm)

ps_username="${_omb_prompt_purple}\u${_omb_prompt_normal}"
ps_path="${_omb_prompt_green}\w${_omb_prompt_normal}"
ps_user_mark="${_omb_prompt_red}${SHXLL_CHAR}${_omb_prompt_normal}"

if [[ $exit_code -ne 0 ]]; then
status="${_omb_prompt_red}(${exit_code})${_omb_prompt_normal} "
fi

PS1="$python_venv$ps_username:$ps_path$scm_segment $time_str$status$ps_user_mark "

__omb_theme_cmd_armed=1
__omb_theme_in_prompt=0
}

OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:-false}
OMB_PROMPT_VIRTUALENV_FORMAT="${_omb_prompt_olive}(%s)${_omb_prompt_reset_color} "

_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND