vhs icon indicating copy to clipboard operation
vhs copied to clipboard

How can I change Shell Prompt

Open kevinah95 opened this issue 1 year ago • 18 comments

Is your feature request related to a problem? Please describe. I want to change the shell prompt.

Describe the solution you'd like I'd like to have the chance to change the start symbol of the shell prompt, for example:

λ Commands with lambda at start
λ pwd
Σ Commands with sigma at start
Σ pwd

Describe alternatives you've considered Add a config variable like:

Set Prompt λ or Set Shell Prompt λ

Additional context Example:

hacienda

kevinah95 avatar Dec 07 '23 05:12 kevinah95

Any pointers here ? My bash prompt always start with bash-5.0$ and I can't change it...

Tried:

  • setting Set Shell "bash --norc --noprofile" to no effect
  • exporting PS1 in hide mode:
Hide
Type "export PS1='$ '" Sleep 50ms Enter
Sleep 1s
Show

but this still shows the line bash-5.0$ export PS1='$ '" on top of the gif.

ocervell avatar Jan 31 '24 14:01 ocervell

+1, interested on this feature

edoardottt avatar Jan 31 '24 14:01 edoardottt

Hey there! Thank you for the issue, I believe we should probably add some sort of setting for the PROMPT or allow setting environments (or both!):

Proposed solution:

Set Prompt "> "

Or:

Env PROMPT "> "

I'm leaning towards the Env solution as it provides other environment to be set, and it is a more flexible solution.

maaslalani avatar Jan 31 '24 14:01 maaslalani

Both sound like a good solution. Still wondering how to this day all the examples gif are starting with a blue arrow ...

ocervell avatar Jan 31 '24 15:01 ocervell

Currently the prompt is hardcoded in, so it should be using that prompt: https://github.com/charmbracelet/vhs/blob/ed89b8b81081828548896e30dbe3770921f5e92c/shell.go#L23

and the default shell is bash.

What version of VHS and ttyd are you using and which operating system?

maaslalani avatar Jan 31 '24 15:01 maaslalani

Weird, for me the default shell is bash-5.0$ ...

Running latest version of VHS with Ubuntu 20.04.6 LTS running in a Vagrant VM:

vagrant@ubuntu2004:~/secator$ vhs -v
vhs version v0.7.1 (537d03a)

vagrant@ubuntu2004:~/secator$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

vagrant@ubuntu2004:~/secator$ ttyd -v
ttyd version 1.7.4-68521f5

ocervell avatar Jan 31 '24 15:01 ocervell

I see, @ocervell do you have anything in your ~/.login / ~/.bash_login out of curiosity?

We use a --login shell and I'm wondering if perhaps the prompt is being overridden there. If that's the conflict then we can perhaps override with VHS by setting the prompt after that.

maaslalani avatar Jan 31 '24 15:01 maaslalani

Nope, the files don't even exist on my machine.

We have this in the ~/.bashrc:

if [ "$ASCIINEMA_REC" == "1" ]; then
    PS1='\$ '
elif [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

ocervell avatar Jan 31 '24 15:01 ocervell

I'm facing the same issue as @ocervell.

vhs version v0.7.1

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 23.10
Release:	23.10
Codename:	mantic

ttyd version 1.7.4-68521f5

edoardottt avatar Feb 03 '24 15:02 edoardottt

I saw the bash-5.2$ prompt on https://github.com/edoardottt/images/blob/main/pphack/pphack.gif ... @maaslalani any other ideas to help working it out ?

ocervell avatar Feb 12 '24 09:02 ocervell

Any update ? I've switched to asciinema at the moment just because of this issue but I really like vhs otherwise ...

ocervell avatar Feb 29 '24 18:02 ocervell

Hey @ocervell, no update so far, I haven't looked into this issue yet. This is definitely something we'll have to solve though as changing the prompt is quite important!

maaslalani avatar Feb 29 '24 18:02 maaslalani

Set Shell to fish, it somehow magically works. The prompt looks like the one in README.md of this repository.

kovmir avatar Mar 13 '24 08:03 kovmir

thanks for the suggestion @kovmir , however it doesn't solve the problem for me

edoardottt avatar Mar 13 '24 08:03 edoardottt

thanks for the suggestion @kovmir , however it doesn't solve the problem for me

Would this help you?

kovmir avatar Mar 13 '24 08:03 kovmir

@kovmir changing the shell to fish worked for me on my VMWare Debian VM, but not on my Vagrant Debian VM. Weird.

ocervell avatar Apr 04 '24 08:04 ocervell

Hi, I can work on this issue because I also need this.

Delta456 avatar Apr 18 '24 13:04 Delta456

Awesome @Delta456, thank you for the support. I've assigned you to the issue!

maaslalani avatar Apr 18 '24 14:04 maaslalani