charmbracelet / vhs

Your CLI home video recorder 📼
MIT License
14.93k stars 248 forks source link

How can I change Shell Prompt #419

Open kevinah95 opened 9 months ago

kevinah95 commented 9 months ago

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

ocervell commented 8 months ago

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

Tried:

edoardottt commented 8 months ago

+1, interested on this feature

maaslalani commented 8 months ago

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.

ocervell commented 8 months ago

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

maaslalani commented 8 months ago

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?

ocervell commented 8 months ago

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
maaslalani commented 8 months ago

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.

ocervell commented 8 months ago

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
edoardottt commented 7 months ago

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
ocervell commented 7 months ago

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 commented 7 months ago

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

maaslalani commented 7 months ago

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!

kovmir commented 6 months ago

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

edoardottt commented 6 months ago

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

kovmir commented 6 months ago

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

Would this help you?

ocervell commented 5 months ago

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

Delta456 commented 5 months ago

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

maaslalani commented 5 months ago

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