pure icon indicating copy to clipboard operation
pure copied to clipboard

do you need to dynamically title xterm windows by default?

Open mightymiff opened this issue 5 years ago • 3 comments

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.

mightymiff avatar Jun 10 '19 11:06 mightymiff

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.

sindresorhus avatar Jun 11 '19 08:06 sindresorhus

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.

mightymiff avatar Jun 11 '19 10:06 mightymiff

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).

mafredri avatar Jun 11 '19 20:06 mafredri