fix: overhaul fish_right_prompt — exit code, dim time, remove docker dep

This commit is contained in:
2026-06-12 00:41:53 -04:00
parent 4c77f3b0af
commit b5513ccbde
+17 -19
View File
@@ -1,34 +1,32 @@
# Copyright (C) 2026 Rootiest # Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
#
# SYNOPSIS # SYNOPSIS
# fish_right_prompt # fish_right_prompt
# #
# DESCRIPTION # DESCRIPTION
# Renders the right-side prompt showing the active Docker context (in blue, # Renders the right-side prompt. Shows a red ✘ with the exit code when the
# when non-default) and the current timestamp. # last command failed (hidden on success), followed by the current time in
# Catppuccin Overlay0 (dim). Rendered regardless of C3 state so it pairs
# correctly with both the starship and the Catppuccin fallback left prompt.
#
# RETURNS
# 0 Always
# #
# EXAMPLE # EXAMPLE
# # Rendered automatically by Fish shell; not called directly. # # Rendered automatically by fish; not called directly.
function fish_right_prompt --description 'Execute fish_right_prompt' function fish_right_prompt --description 'Execute fish_right_prompt'
# Opinionated guard (C3): no right prompt when overrides are disabled. set -l last_status $status
__fish_config_op_enabled __fish_config_op_overrides; or return
# 1. Docker Context in Blue # Failed command: red ✘ + exit code; hidden when 0
set -l docker_ctx (docker context show 2>/dev/null) if test $last_status -ne 0
if test -n "$docker_ctx"; and test "$docker_ctx" != default set_color '#f38ba8'
set_color blue echo -n "$last_status "
echo -n "󰡨 $docker_ctx "
set_color normal set_color normal
end end
# 2. Timestamp Logic with Fallback # Timestamp — Catppuccin Overlay0 (dim)
set_color brblack set_color '#6c7086'
if type -q __bobthefish_timestamp date +%X
__bobthefish_timestamp
else
# Manual fallback format: Wed Feb 11 15:04:28 2026
date "+%a %b %d %H:%M:%S %Y"
end
set_color normal set_color normal
end end