

PS1 generator - jerogarcia
http://xta.github.io/HalloweenBash/
Not really mine but i liked it
======
josh_blum
Pretty awesome, just a couple of suggestions:

1\. Items shouldn't disappear from the selection (I can only add one (space)
for some reason).

2\. Allow grouping of items. For example, if you want to have [time] you
should be able to drag the "[", "time", and "]" as a group instead of
individually.

------
qrohlf
Very cool!

Feature suggestion: It would be great to be able to change the colors of the
individual components a la [https://github.com/twolfson/sexy-bash-
prompt](https://github.com/twolfson/sexy-bash-prompt)

~~~
scott_karana
Seconded. The basic layout of $PS1 is straightforward enough, but it's the
ugly colour escapes that always hurt maintainability of mine at least. :)

------
JoshTriplett
Nice!

I'd love to see support for the terminal window title here, too. Add an
additional container for the titlebar contents, and prefix
\\[\e]0;$titlebar_contents\a\\] to the prompt when TERM is xterm _, rxvt_ , or
screen*.

Also, colors should be draggable into the prompt, since they can change
between different parts of the prompt.

"Last command error when not successful" is nice as well; just add this to
your prompt (includes color and whitespace):

    
    
        $(e="$?";[ "$e" -ne 0 ] && echo -n "\[\e[01;31m\]($e) ")
    

On my system, I also have some extra logic to only show the username and
hostname if either $SSH_CONNECTION is set or the username is not my usual
username (usually because it's either root, some user I've sudoed to, or an
unusual username because I'm on a system with mandated username conventions).
Thus, on my personal system, my initial prompt is "~$ ", taking up very little
room. Unfortunately "not my usual username" isn't portable to different users
(though you could check for the presence of SUDO_USER), but checking
SSH_CONNECTION is.

~~~
stormbrew
I have this bit of magic in mine to map return codes to some semblance of a
string version of them:

    
    
        LED=$(perl -le "\$!+=${LE};print \$!" 2>/dev/null || echo "unknown error")
    

It's not perfect but I haven't found a more reliable way to map exit status'
to something like the right meaning.

------
ender7
Please add "cursor: default;" or "cursor: move;" to the draggable items.
Draggable things should not use the text selection cursor. :)

~~~
helfire
Just a pull request away:
[https://github.com/xta/HalloweenBash/blob/master/assets/prof...](https://github.com/xta/HalloweenBash/blob/master/assets/profile.css)

~~~
nolanl
Done:
[https://github.com/xta/HalloweenBash/pull/12](https://github.com/xta/HalloweenBash/pull/12)

------
egwynn
It should probably emit the example PS1 with single quotes instead of double
quotes.

This:

    
    
      export PS1="\h:\W\$(parse_git_branch) \u$ "
    

will execute parse_git_branch only once (at the time PS1 is set) but this:

    
    
      export PS1='\h:\W\$(parse_git_branch) \u$ '
    

will execute it every time the prompt every time.

~~~
egwynn
Also, I'd like to offer some words of caution to those who want lots of
"external" (i.e. not bash-native) data in their PS1 string. Running outside
programs can be expensive. For personal workstation use, things like the above
are great. However, if you administer a remote (perhaps resource-constrained)
server and you find yourself trying to rescue it from swap-death (or a
partially busted HDD), you may not want to be 1) forking subprocesses, 2)
allocating file descriptors, and 3) doing disk IO _every time_ you hit the
enter key. Build responsible prompt strings everyone.

~~~
icebraining
If you're actually trying to rescue a server, you can just do "export PS1='#'"
once to disable it for the current session.

------
hadem
You might also be interested in this PS1 generator. Seems to have a few more
options.

[http://omar.io/ps1gen/](http://omar.io/ps1gen/)

------
pclark
I kept dragging the elements into the terminal window thinking that was how I
construct it.

~~~
asciimo
Me, too. When I figured it out I felt silly. Maybe emphasize the construction
area and deemphasize the preview? Could the preview be static, and to the
right of the construction area and palettes?

------
xxtjaxx
1\. Better know what you are doing when you fiddle with your shellprompt.
Nothing is more agitating than having an unresponsive prompt because you
entered a larger git repository. ( _cough_ linux kernel _cough_ )

2\. Here is a color map which escape will make your prompt look which way.
[https://github.com/andreas-marschke/misc-
tools/blob/master/s...](https://github.com/andreas-marschke/misc-
tools/blob/master/sh/color_shell/colorPrompt.sh)

3\. You can find my prompt setup here: [https://github.com/andreas-
marschke/dotfiles](https://github.com/andreas-marschke/dotfiles)

It's split up across profile,bashrc,bash_alias,bash_export

4\. As was requested in the comments here you can use $TERM variable to
determine your terminal name. Since most popular terminal emulators try to be
what they are supposed to be "dumb vt100s" you'll get xterm or (if you use a
multiplexer like tmux,screen) "screen" as $TERM. IMHO its not of much use
therefore.

5.[https://github.com/Lokaltog/powerline](https://github.com/Lokaltog/powerline)
<< Mean to test this out. Its more for vim users.

------
D9u
[https://news.ycombinator.com/item?id=6155556](https://news.ycombinator.com/item?id=6155556)

[http://blog.twistedcode.org/2008/03/customizing-your-bash-
pr...](http://blog.twistedcode.org/2008/03/customizing-your-bash-prompt.html)

[http://www.bbs-software.com/blog/2013/08/03/%EF%A3%BF-in-
you...](http://www.bbs-software.com/blog/2013/08/03/%EF%A3%BF-in-your-system-
prompt/)

------
sethammons
This is pretty neat. One issue: I put a lot of info in my ps1, so I need more
than two space tokens. They should regenerate as you pull them up. Also, I
want different colors on different tokens. I also like my git branch to be a
different color between master, staging, integration (or other feature
branches). I use the ps1_set from RVM, but take out the ruby version.

------
robinson-wall
This just uses a literal dollar sign to mark the end of the prompt by default.
That means if, like me, you don't put the username in your PS1 - instead
relying on $ changing to a # when you run `sudo -s' nothing will happen.

I would suggest adding a "$/#" bubble which adds "\$" to the PS1 string.

------
prezjordan
If you're not opposed to using JS in your prompt (it runs fast, promise!)
check out impromptu [0]. I've been using it for a few months now and it's
amazing.

[0]:
[https://github.com/impromptu/impromptu](https://github.com/impromptu/impromptu)

~~~
rodw
You're probably not the maintainer, but Impromptu's README _really_ should do
a better job of explaining what it does and why I'd want to use it.

It sounds interesting, or at least I can imagine something interesting based
on that description, but the only concrete information readily available seems
to be that Impromptu requires Node.js and Redis. Those are fairly onerous
requirements for a shell prompt, so some description of the actual features is
probably warranted.

------
keeperofdakeys
If anyone wanted a full list of available options, you can look at the man
page for your shell, under PROMPTING (you can type /PROMPTING to search for
it). Any other bash variable, or user defined variable will also work.

------
RandallBrown
There's a bug where if you drag everything out of your configuration, you
can't drag anything back in again.

Neat though.

I'm on Firefox v22.

~~~
spetsnaz
Same happened to me with chromium.

------
petarb
Wow this is great, props for making the first drag-n-drop $PS1 generator

~~~
hk__2
Not the first: [http://omar.io/ps1gen/](http://omar.io/ps1gen/)

------
snake_plissken
just confusing enough to thwart those pesky North Korean hackers:

export PS1="\\[\e[30;0m\\]\w^$ \v\h\u\W\u:\\[\e[0m\\]"

