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

Add env var DISABLE_AUTO_TITLE #383

Closed
wants to merge 1 commit into from

Conversation

veggiemonk
Copy link
Contributor

Using iterm2 on Mac.
This PR allows the user to set the title of the window/tab

Copy link
Collaborator

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about this change. Pure isn't associated with OMZ in any way, so it feels a bit weird to support one of their settings.

There are two problems (more or less) with this approach:

  1. Undocumented behavior, a feature in Pure can be disabled by an environment variable completely unrelated to Pure
  2. The setting can only be enabled by setting the string explicitly to true which ties Pure to the (current) implementation in OMZ, other Pure settings can be toggled via 1/0 so this setting introduces an inconsistency as well

Could you also provide a bit more info about your use case? E.g. what problem are we fixing here. You want to be able to set the title, but why, what's the benefit? Etc.

Btw, I'd add that I'm aware that disabling the title can be useful. Personally I've run into title issues while using Pure over a serial console 😅.

pure.zsh Outdated
@@ -56,6 +56,11 @@ prompt_pure_set_title() {
# emacs terminal does not support settings the title
(( ${+EMACS} )) && return

# respect oh-my-zsh disable auto title
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid quoting the variable inside [[ ]], it's not required.

@veggiemonk
Copy link
Contributor Author

veggiemonk commented Mar 12, 2018

Hi @mafredri,

You're totally right about the OMZ support. I don't think it makes sense to support every framework out there.

On the other hand it took me quite a while to figure out why the title wouldn't change even if I set it manually. Hence this PR. I thought it made total sense to have that option in Pure. And it doesn't hurt that it has the same name as the OMZ framework. 😄

My use case is that with new macbook, the touch bar displays all the tab of terminal. it allows to change tab as quick as a keystroke (touchstroke ?). But if the title is a long PATH, it is basically useless because that's the only thing on the touch bar.

I'll make the change to the PR. Let me know what you think and no hard feelings if this don't get merged. I've used Pure for a long time and it just made sense to contribute back.

@veggiemonk veggiemonk changed the title Respect oh-my-zsh DISABLE_AUTO_TITLE Add env var DISABLE_AUTO_TITLE Mar 12, 2018
@@ -56,6 +56,11 @@ prompt_pure_set_title() {
# emacs terminal does not support settings the title
(( ${+EMACS} )) && return

# disable auto title
if "$DISABLE_AUTO_TITLE" == true; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still requires the [[ ]] around it.

@mafredri
Copy link
Collaborator

@veggiemonk sorry for the delay! At the very least, for this to make sense in Pure, it also needs to accept 1 as a value (to match other Pure options). And it needs to be added to the readme.

Btw, there's another way to bypass setting the title:

# First, load Pure.
prompt pure

# Then, replace the set title function with an empty one.
prompt_pure_set_title() {}

@sindresorhus do you have any preference on this?

@veggiemonk
Copy link
Contributor Author

@mafredri Well, the solution you gave is much better than this PR. It should be added to the README though because I spent some time looking for that and I didn't even think about it.

Since most env var starts with PURE, having one that does not break the consistency.

@mafredri
Copy link
Collaborator

mafredri commented May 7, 2018

I've added this to the Wiki: Disable Pure terminal title updates. I don't want to add it to the readme since that would sanction such practices and they could be considered supported. The user should be aware that this can break at any moment and we don't officially support it 😄.

@mafredri mafredri closed this May 7, 2018
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

Successfully merging this pull request may close these issues.

2 participants