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

terminal title with current directory #84

Open
singpolyma opened this issue Apr 12, 2021 · 2 comments
Open

terminal title with current directory #84

singpolyma opened this issue Apr 12, 2021 · 2 comments

Comments

@singpolyma
Copy link

I'm currently doing this:

(define old-prompt (current-prompt-function))
(define (my-prompt #:last-return-value [last-ret #f]
                   #:last-return-index [last-ret-n 0])
	(printf "\033]0;~a\007" (path->string (current-directory)))
	(old-prompt)
)

(current-prompt-function my-prompt)
@willghatch
Copy link
Owner

Are you suggesting that the default prompt should change the terminal title bar to include the current directory?

If so, I'm interested. The most difficult part about this is that it's terminal-dependent. I think most terminal emulators support this feature, but there are multiple different codes for doing it. I think they all use OSC codes (IE \033]<some number>;<some text><string terminator>), but eg. xterm uses 0 for the OSC code while KDE Konsole (the main terminal emulator I use at the moment) uses 30 instead. I'm not sure what a good way to detect this is.

@willghatch
Copy link
Owner

Also I'll note that if you don't pass those keyword arguments on to old-prompt you will have a degraded experience, particularly when running Racket code (top level s-expressions or pipelines that end with something other than a subprocess). It's actually the prompt handler that prints results for those.

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

No branches or pull requests

2 participants