Skip to content

Commit 501c18a

Browse files
authored
themes/minimal-gh: Add IP and hostname (#693)
1 parent a59433a commit 501c18a

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed
63.5 KB
Loading

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@
1515

1616
function _omb_theme_PROMPT_COMMAND() {
1717

18-
local TITLEBAR
19-
case $TERM in
20-
xterm* | screen)
21-
TITLEBAR=$'\1\e]0;'$USER@${HOSTNAME%%.*}:${PWD/#$HOME/~}$'\e\\\2' ;;
22-
*)
23-
TITLEBAR= ;;
24-
esac
18+
# Obtenemos IP segun el sistema operativo
19+
local IP
20+
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+
;;
30+
esac
2531

2632
local HORA=$(date +%H)
2733
local MERIDIANO
@@ -31,7 +37,7 @@ function _omb_theme_PROMPT_COMMAND() {
3137
MERIDIANO="am";
3238
fi
3339

34-
PS1=$TITLEBAR"\n${_omb_prompt_gray}\T${MERIDIANO} ${_omb_prompt_green}\u ${_omb_prompt_olive}\${PWD} $(scm_prompt_info)\n${_omb_prompt_gray}\$ ${_omb_prompt_white}"
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}"
3541

3642
}
3743

0 commit comments

Comments
 (0)