Giter Club home page Giter Club logo

Comments (6)

chris-marsh avatar chris-marsh commented on July 22, 2024 1

I've pushed this change. Hopefully the issue is now resolved?

from pureline.

chris-marsh avatar chris-marsh commented on July 22, 2024

I've just tested with gnome-terminal and it works fine for me. Your choice of terminal app should not have any effect on bash PROMPT_COMMAND.

Can you give more detail? Do you get any error messages in your terminal? Can you cd to the directory with the pureline file and:

source ./pureline

and let use know what happens and what output you get?

from pureline.

steve-lorimer avatar steve-lorimer commented on July 22, 2024

Output of source ./pureline:

image

Notice that the title bar just has "Terminal" in it.

If I now change PROMPT_COMMAND as follows:

export PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'

Notice now that the title has changed to show username, hostname and cwd:

image

If I change directory, the title changes accordingly

image

If I undo the manual setting of PROMPT_COMMAND I did above, so that I get the pureline PROMPT_COMMAND, you can see the PS1 prompt updates (notice the sudden appearance of the red lock to signal read-only) when I change directory to /usr/local/bin, but the window's title no longer updates.

image

from pureline.

steve-lorimer avatar steve-lorimer commented on July 22, 2024

Actually, through taking you through all these steps, I realised that the title is set to STDOUT of the result of executing ${PROMT_COMMAND}, escaped between \033 and \007

So whilst pureline_ps1 sets the PS1 variable, I can also have the title set by adding a printf call at the end

function pureline_ps1 {

	...
	PS1+=...
	...

	printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"
}

Obviously the printf statement I've shown here is hardcoded, and a better approach would be to loop over your modules.

My bashfu isn't good enough to figure that out just yet.

from pureline.

chris-marsh avatar chris-marsh commented on July 22, 2024

I see the issue. I wasn't aware as I don't use window decorations. This is happening because pureline overwrites the PROMPT_COMMAND. This was an intentional change due to feedback. I might look to change this or find an alternative. Anyway ... the quick fix is to change the last line of pureline from;

PROMPT_COMMAND=pureline_ps1
to
PROMPT_COMMAND="pureline_ps1; $PROMPT_COMMAND"

This appends your default setting after pureline.

from pureline.

steve-lorimer avatar steve-lorimer commented on July 22, 2024

Thanks Chris

from pureline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.