Skip to content

Commit 63ebf65

Browse files
committed
Merge branch 'fix-minimal-gh'
2 parents d9a68f9 + 4803ef8 commit 63ebf65

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

themes/minimal-gh/minimal-gh.theme.sh

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,32 @@
1414
#
1515

1616
function _omb_theme_PROMPT_COMMAND() {
17-
1817
# Obtenemos IP segun el sistema operativo
1918
local IP
2019
case $OSTYPE in
21-
linux-gnu)
22-
IP=$(hostname -I | awk '{print $1}')
23-
;;
24-
darwin*)
25-
IP=$(ifconfig en0 | awk '$1=="inet" {print $2}')
26-
;;
27-
*)
28-
IP="127.0.0.1" # Default to localhost if OS is not recognized
29-
;;
20+
linux-gnu)
21+
# 2025-09-21 hostname is not a part of GNU/Linux. In fact, Arch Linux
22+
# does not include "hostname" by default.
23+
# https://www.reddit.com/r/arch/comments/1nlv59f/bash_hostname_commend_not_found/
24+
{ IP=$(ip addr 2>/dev/null | awk '$1 == "inet" {sub(/\/.*/, "", $2); if ($2 == "127.0.0.1") next; print $2; exit}'); [[ $IP ]]; } ||
25+
{ IP=$(ip addr 2>/dev/null | awk '$1 == "inet6" {sub(/\/.*/, "", $2); if ($2 == "::1") next; print $2; exit}'); [[ $IP ]]; } ||
26+
IP=$(hostname -I 2>/dev/null | awk '{print $1}')
27+
;;
28+
darwin*)
29+
IP=$(ifconfig en0 | awk '$1=="inet" {print $2}')
30+
;;
3031
esac
32+
[[ $IP ]] || IP="127.0.0.1" # Default to localhost if OS is not recognized
3133

3234
local HORA=$(date +%H)
33-
local MERIDIANO
34-
if (( 10#$HORA > 12 )); then
35-
MERIDIANO="pm";
36-
else
37-
MERIDIANO="am";
38-
fi
39-
40-
PS1="\n${_omb_prompt_gray}\T${MERIDIANO} ${_omb_prompt_green}\u@$IP ${_omb_prompt_gray}\h ${_omb_prompt_olive}\${PWD} $(scm_prompt_info)\n${_omb_prompt_gray}\$ ${_omb_prompt_white}"
41-
35+
local MERIDIANO
36+
if ((10#$HORA > 12)); then
37+
MERIDIANO="pm";
38+
else
39+
MERIDIANO="am";
40+
fi
41+
42+
PS1="\n${_omb_prompt_gray}\T${MERIDIANO} ${_omb_prompt_green}\u@$IP ${_omb_prompt_gray}\h ${_omb_prompt_olive}\${PWD} $(scm_prompt_info)\n${_omb_prompt_gray}\$ ${_omb_prompt_normal}"
4243
}
4344

4445
SCM_THEME_PROMPT_DIRTY=" ${_omb_prompt_brown}"

0 commit comments

Comments
 (0)