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 @@ -308,6 +308,10 @@

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

## `umu`

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

## `vscode`

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

# Base on pzq

OMB_PROMPT_CONDAENV_FORMAT='(%s)'
OMB_PROMPT_VIRTUALENV_FORMAT='(%s)'
OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=true}

# ----------------------------------------------------------------- COLOR CONF
D_DEFAULT_COLOR="$_omb_prompt_white"
D_INTERMEDIATE_COLOR="$_omb_prompt_bold_white"
D_NUMBER_COLOR="$_omb_prompt_bold_navy"
D_USER_COLOR="$_omb_prompt_teal"
D_SUPERUSER_COLOR="$_omb_prompt_brown"
D_MACHINE_COLOR="$_omb_prompt_green"
D_DIR_COLOR="$_omb_prompt_bold_olive"
D_GIT_DEFAULT_COLOR="$_omb_prompt_white"
D_GIT_BRANCH_COLOR="$_omb_prompt_teal"
D_GIT_PROMPT_COLOR="$_omb_prompt_brown"
D_SCM_COLOR="$_omb_prompt_bold_olive"
D_BRANCH_COLOR="$_omb_prompt_teal"
D_CHANGES_COLOR="$_omb_prompt_white"
D_TIME_COLOR="$_omb_prompt_white"
D_DOLLOR_COLOR="$_omb_prompt_bold_brown"
D_CMDFAIL_COLOR="$_omb_prompt_brown"
D_VIMSHELL_COLOR="$_omb_prompt_teal"

# ------------------------------------------------------------------ FUNCTIONS
case $TERM in
xterm*)
TITLEBAR='\[\e]0;\w\e\\\]'
;;
*)
TITLEBAR=""
;;
esac

function is_vim_shell {
if [[ ${VIMRUNTIME-} ]]; then
_omb_util_print "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}vim shell${D_DEFAULT_COLOR} "
fi
}

function mitsuhikos_lastcommandfailed {
local status=$?
if ((status != 0)); then
_omb_util_print " ${D_DEFAULT_COLOR}C:${D_CMDFAIL_COLOR}$code ${D_DEFAULT_COLOR}"
fi
Comment on lines +44 to +48

Choose a reason for hiding this comment

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

Action required

1. Exit code uses $code 🐞 Bug ✓ Correctness

mitsuhikos_lastcommandfailed stores the last status in status but prints $code (undefined), so
the failure code is blank/misleading in the prompt.
Agent Prompt
## Issue description
`mitsuhikos_lastcommandfailed` prints an undefined variable (`$code`) instead of the captured exit status, so the prompt won’t display the failing command’s return code.

## Issue Context
This function is used to build `LAST_COMMAND_FAILED` for the prompt.

## Fix Focus Areas
- themes/umu/umu.theme.sh[44-49]

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

}

# vcprompt for scm instead of oh-my-bash default
function demula_vcprompt {
if [[ ${VCPROMPT_EXECUTABLE-} ]]; then
local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
$VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT"
fi
}

# checks if the plugin is installed before calling battery_charge
function safe_battery_charge {
if _omb_util_function_exists battery_charge; then
battery_charge
fi
}

function prompt_git {
local branchName=''

# Check if the current directory is in a Git repository.
if _omb_prompt_git rev-parse --is-inside-work-tree &>/dev/null; then
# Get the short symbolic ref.
# If HEAD isn’t a symbolic ref, get the short SHA for the latest commit
# Otherwise, just give up.
branchName=$(
_omb_prompt_git symbolic-ref --quiet --short HEAD 2> /dev/null ||
_omb_prompt_git rev-parse --short HEAD 2> /dev/null ||
_omb_util_print '(unknown)');

_omb_util_print "${D_GIT_DEFAULT_COLOR}on ${D_GIT_BRANCH_COLOR}${branchName} "
else
return
fi
}

function limited_pwd {
# Max length of PWD to display
local MAX_PWD_LENGTH=20

# Replace $HOME with ~ if possible
local RELATIVE_PWD=${PWD/#$HOME/\~}

local offset=$((${#RELATIVE_PWD}-MAX_PWD_LENGTH))

if ((offset > 0)); then
local truncated_symbol='...'
local TRUNCATED_PWD=${RELATIVE_PWD:offset:MAX_PWD_LENGTH}
_omb_util_put "${truncated_symbol}/${TRUNCATED_PWD#*/}"
else
_omb_util_put "${RELATIVE_PWD}"
fi
}

# -------------------------------------------------------------- PROMPT OUTPUT
function _omb_theme_PROMPT_COMMAND {
local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed)
local SAVE_CURSOR='\[\e7'
local RESTORE_CURSOR='\e8\]'
local MOVE_CURSOR_RIGHTMOST='\e['${COLUMNS:-9999}'C'
local MOVE_CURSOR_5_LEFT='\e[5D'
local THEME_CLOCK_FORMAT="%Y-%m-%dT%H:%M:%S.%N%:::z"
# Replace $HOME with ~ if possible
local RELATIVE_PWD=${PWD/#$HOME/\~}

local python_venv
_omb_prompt_get_python_venv

PS1=${TITLEBAR}$python_venv$'\n'
if [[ $OSTYPE == linux-gnu ]]; then
PS1+="${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}"
PS1+="$(safe_battery_charge)${RESTORE_CURSOR}"
PS1+="${D_NUMBER_COLOR}# ${D_USER_COLOR}\u ${D_DEFAULT_COLOR}"
Comment on lines +106 to +121

Choose a reason for hiding this comment

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

Action required

2. Battery output inside [] 🐞 Bug ⛯ Reliability

On Linux, the theme opens a Bash non-printing escape block (\[ ... \]) and inserts
battery_charge output before closing it; since battery_charge prints visible glyphs, Bash will
miscompute prompt length leading to wrapping/cursor glitches.
Agent Prompt
## Issue description
The prompt currently wraps visible battery glyph output inside a Bash non-printing escape block (`\[ ... \]`), which breaks Bash’s prompt-width calculation and can cause wrapping/cursor positioning issues.

## Issue Context
`SAVE_CURSOR` begins `\[` but is only closed in `RESTORE_CURSOR` after battery output is appended.

## Fix Focus Areas
- themes/umu/umu.theme.sh[106-121]

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

else
PS1+="${D_NUMBER_COLOR}# ${D_USER_COLOR}\u ${D_DEFAULT_COLOR}"
fi
PS1+="@ ${D_MACHINE_COLOR}\h ${D_DEFAULT_COLOR}"
PS1+="${D_DIR_COLOR}${RELATIVE_PWD} ${D_INTERMEDIATE_COLOR}"
PS1+=$(prompt_git)
PS1+=${D_TIME_COLOR}[$(clock_prompt)]
PS1+=${LAST_COMMAND_FAILED}
PS1+=$(demula_vcprompt)
PS1+=$(is_vim_shell)
if [[ $OSTYPE != linux-gnu ]]; then
PS1+=$(safe_battery_charge)
fi
PS1+=$'\n'"${D_DOLLOR_COLOR}$ ${D_DEFAULT_COLOR}"

PS2="${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
}

# Runs prompt (this bypasses oh-my-bash $PROMPT setting)
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND