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

do you need to dynamically title xterm windows by default? #475

Open
mightymiff opened this issue Jun 10, 2019 · 3 comments
Open

do you need to dynamically title xterm windows by default? #475

mightymiff opened this issue Jun 10, 2019 · 3 comments

Comments

@mightymiff
Copy link

mightymiff commented Jun 10, 2019

Thanks for sharing your work with us. I have been using your prompts in all of my terminals for the last year.

Your plugin dynamically alters the xterm title in a way that is very, very difficult to debug when one tries to manually rename terminal windows. The title is impossible to change and all conceivable ways (except for one) to alter it using echo,xdotool,wmctrl,etc., execute and fail silently.

I'd urge you to not do this by default. I do not have viewable titles on any of my windows, so I suppose whatever default behavior you were going for originally is lost on me, but I spent hours and hours and hours trying to narrow down this problem. The only way I figured it out (eventually) was by trying some rather exotic way to rename the terminal window and having it fail violently trap ‘echo -ne “\e]0;window-title-here07″‘ DEBUG.

@sindresorhus
Copy link
Owner

Your plugin dynamically alters the xterm title in a way that is very, very difficult to debug when one tries to manually rename terminal windows. The title is impossible to change and all conceivable ways (except for one) to alter it using echo,xdotool,wmctrl,etc., execute and fail silently.

Are you sure this is a problem with Pure and not just you terminal?

Please include some info like zsh version, OS, terminal, etc.

@mightymiff
Copy link
Author

Not a problem with my terminal, though I do admit that xdotool is a bit buggy when trying to rename windows based on PID.

Running:
Ubuntu 18.04/19/04
zsh 5.5.1
urxvt v9.22

I don't use other terminals, so am not sure of behavior elsewhere.

Here is the problematic code in pure.plugin.zsh (I am showing lines 79-81)

	# Set title atomically in one print statement so that it works
	# when XTRACE is enabled.
	print -n $opts $'\e]0;'${hostname}${2}$'\a'

Predictably, the prompt_pure_set_title() function interferes with all efforts to rename the terminal window. As I said, I do not have viewable titles, but set the name of my terminal windows once when I start a session so I can have hotkey navigation to programs and ssh terminal windows and what not.

@mafredri
Copy link
Collaborator

mafredri commented Jun 11, 2019

I understand your frustration, and while I don't think we can disable it on any terminal per-default (as anyone with xterm / urxvt might be running in a WM / DE with titles), we could introduce an option for it, it has come up a few times.

Typically we have recommended replacing the function with a no-op:

prompt pure
prompt_pure_set_title() {}

But it's hack-ish and not officially supported (e.g. function name could change).

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

3 participants