You are not logged in.

#1 2011-08-19 09:28:13

wisp558
Member
Registered: 2010-06-10
Posts: 17

Tired of writing your own bash prompt?

I realized a few days ago that I got tired of looking up arcane bash escape sequences just to customize my bash prompt. In the open source fashion, I wrote a gui in pyGTK that will automatically make one for you, if you just pick the things you want from a menu. It's not really done yet and there's still stuff that I need to add to it, but I thought i'd see if anyone around here had any comments, or would find it useful.

Check it out: https://github.com/wisp558/promptool

It's worth noting that I only implemented 3 of the most common bash variables, but I should fix that soon. (and the bold button is broken)

Last edited by wisp558 (2011-08-19 09:31:46)

Offline

#2 2011-08-19 09:35:35

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Tired of writing your own bash prompt?

very nice. I remember how people had cool PS1s when I first started using linux. Eventually I made aliases for all the colors (for me only understanding the colors was a bit difficult at first what with all the escape sequences) and its a bit easier now. But this could be great help to linux newbies.

Thanks


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2011-08-19 09:45:31

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Tired of writing your own bash prompt?

Agreed, great idea. I did mine many, many moons ago but wouldn't have a clue how to change it now (okay, so I like it wink). This would make me more flexible.


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#4 2011-08-19 09:45:52

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

Yeah, the way I look at it is that it's just a pain, when it doesn't have to be.

EDIT: I added a bunch of other bash variables, so it's a lot less worthless now.

Last edited by wisp558 (2011-08-19 10:15:13)

Offline

#5 2011-08-22 13:22:14

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: Tired of writing your own bash prompt?

An option for starting a newline would be great.

Offline

#6 2011-08-22 15:06:22

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

I think so too! That will be added as soon as I figure out how gtk.TextView works and implement it instead of the gtk.Entry that I'm using now. If anyone has any pointers, it will speed up the process, but otherwise it will still get done, it'll just take me a bit more time.

In other news, I updated the layout code, the whole thing should look a bit nicer and better-formatted. In the meantime, here's a screenshot:

promptool1.png

Last edited by wisp558 (2011-08-22 20:50:17)

Offline

#7 2011-08-25 12:05:43

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

Update! I've updated the tool to work with the gtk.TextView. Notable improvements are multi-line editing, and not having those stupid (?red) things everywhere! See for yourself:

promptool3.png

Offline

#8 2011-08-25 12:47:50

triplesquarednine
Member
Registered: 2011-04-12
Posts: 630

Re: Tired of writing your own bash prompt?

wow, this looks great.

i may have to check this out, when i get home wink

Offline

#9 2011-08-25 13:16:34

examon
Member
Registered: 2011-05-07
Posts: 208

Re: Tired of writing your own bash prompt?

Nice software wisp558!

Offline

#10 2011-08-25 13:39:39

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: Tired of writing your own bash prompt?

Nice! Good to see how this project develops smile . Another suggestion I have, is to add bright color (e.g.: \e[1;30m) support.

Last edited by Doomcide (2011-08-25 13:39:50)

Offline

#11 2011-08-25 13:48:24

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

Doomcide wrote:

Nice! Good to see how this project develops smile . Another suggestion I have, is to add bright color (e.g.: \e[1;30m) support.

Yeah, I plan to. Other things I'm looking at include a place to select the text color, (It'll use the last color in the prompt), background colors, underlined things and changing the whole textview background (I use a black urxvt, personally). I may even add a thing to save prompts or something. I might add an option to append the PS1 to one's ~/.bashrc, making the gui display the finished prompt rather than the terminal and more! I have plenty of ideas left!

As a note, the escape you posted is just the bold option I already have. There is a high intensity option in bash, which I will look into, although it does nothing in my terminal. Those are things like '\e[0;90m' and its  friends.

Thanks for your feedback, guys.

Offline

#12 2011-08-25 14:54:22

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Tired of writing your own bash prompt?

I just made a PKGBUILD real quick, see here

Offline

#13 2011-08-25 15:32:46

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

You should also make sure that you add the pygtk dependency. I suppose making it a shell-script thing is the way to go here. Putting the python stuff in opt sort of makes sense. I've been considering putting the stuff in helper in main.py, and maybe renaming it to be promptool.py. I was originally planning for this to be a bit more modular, but it turned out that I need hooks into the GTK interfaces for pretty much everything, so it all became centralized. When I get around to adding more shells (*coughzshcough*) It might wind up being modular again, stuff like bash.py and zsh.py and whateverelse.py with a main.py, but at the moment it doesn't make sense to, and it's a somewhat low priority, compared to a lot of the stuff I mentioned above. People who want a custom shell can probably make their own prompts, heh.  Regardless, what exactly is the promptool.sh script that you use there? Running Main.py directly should work; I set it to run /usr/bin/python2, though I should probably set it to /usr/bin/env python2.

Offline

#14 2011-08-26 09:23:26

vanvalium
Member
From: Austria
Registered: 2010-10-09
Posts: 86

Re: Tired of writing your own bash prompt?

Seems neat, any plans for a zsh version?

Offline

#15 2011-08-26 13:33:30

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

Yep, I mentioned that in my previous post. I"m currently in the business of moving, so updates are gonna slow for a few days.

Offline

#16 2011-08-26 15:24:02

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: Tired of writing your own bash prompt?

I just updated and the color-buttons don't show a color anymore, the text is colored though.

Offline

#17 2011-08-26 15:42:13

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Tired of writing your own bash prompt?

wisp558 wrote:

what exactly is the promptool.sh script that you use there?

That script only cd's into the directory where main.py and helper.py are stored and then executes main.py. In case you throw everything into one file, I'll install this into /usr/bin. But thanks mentioning pygtk as a dependency, I'll change that. In case anyone wants to adopt the package, I'll abandon it after this little update, because I don't really use it, 1st because I use zsh and 2nd because my prompt is fine wink Just wanted to share it, since I already created it.

Offline

#18 2011-08-31 08:29:17

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: Tired of writing your own bash prompt?

Is this still being developed?

Offline

#19 2011-09-16 21:55:57

trusktr
Banned
From: .earth
Registered: 2010-02-18
Posts: 907
Website

Re: Tired of writing your own bash prompt?

@Doomcide: wisp558 posted this only less than a month ago. I'm sure its still in development. wink


joe@trusktr.io - joe at true skater dot io.

Offline

#20 2011-09-27 16:46:15

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

Correct! smile

I wound up moving a month ago, and development sort of fell by the wayside. I've been working on this again, however, and I've already made one new feature, and more are sure to follow. Sorry about the wait, but this is definitely still alive.

Offline

#21 2011-09-27 16:51:48

Doomcide
Member
Registered: 2011-08-22
Posts: 221

Re: Tired of writing your own bash prompt?

No problem! I was propably a bit impatient wink

Offline

#22 2012-07-25 02:05:07

wisp558
Member
Registered: 2010-06-10
Posts: 17

Re: Tired of writing your own bash prompt?

Hey! I've come back! If you check the github, you'll see that I added basic support for zsh. I plan to add new things in the next few weeks, as well as do a code cleanup. If you saw this and despaired due to its status as vaporware, despair no further. IAlso, if you have more feature requests, I'd love to hear them.  (Also, I plan to fix the extreme bugginess of deleting whole symbols)

Offline

Board footer

Powered by FluxBB