Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change Shell Prompt #419

Open
kevinah95 opened this issue Dec 7, 2023 · 18 comments
Open

How can I change Shell Prompt #419

kevinah95 opened this issue Dec 7, 2023 · 18 comments
Assignees
Labels
enhancement New feature or request

Comments

@kevinah95
Copy link

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 kevinah95 added the enhancement New feature or request label Dec 7, 2023
@ocervell
Copy link

ocervell commented Jan 31, 2024

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.

@edoardottt
Copy link

+1, interested on this feature

@maaslalani
Copy link
Member

maaslalani commented Jan 31, 2024

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
Copy link

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

@maaslalani
Copy link
Member

maaslalani commented Jan 31, 2024

Currently the prompt is hardcoded in, so it should be using that prompt:

vhs/shell.go

Line 23 in ed89b8b

Env: []string{"PS1=\\[\\e[38;2;90;86;224m\\]> \\[\\e[0m\\]", "BASH_SILENCE_DEPRECATION_WARNING=1"},

and the default shell is bash.

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

@ocervell
Copy link

ocervell commented Jan 31, 2024

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
Copy link
Member

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@maaslalani
Copy link
Member

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
Copy link

kovmir commented Mar 13, 2024

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

@edoardottt
Copy link

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

@kovmir
Copy link

kovmir commented Mar 13, 2024

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

Would this help you?

@ocervell
Copy link

ocervell commented Apr 4, 2024

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

@Delta456
Copy link
Contributor

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

@maaslalani
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants