Skip to content

fix(shell_integration): set window title on startup#12569

Merged
fdncred merged 4 commits intonushell:mainfrom
TheLostLambda:main
Apr 19, 2024
Merged

fix(shell_integration): set window title on startup#12569
fdncred merged 4 commits intonushell:mainfrom
TheLostLambda:main

Conversation

@TheLostLambda
Copy link
Copy Markdown
Contributor

Should close #10833 — though I'd imagine that should have already been closed.

Description

Very minor tweak, but it was quite noticeable when using Zellij which relies on OSC 2 to set pane titles. Before the change:
image

Note that the default Pane #1 is still showing for the untouched shell, but running a command like htop or ls correctly sets the title during / afterwards.

After this PR:
image

There are now no-longer any unset titles — even if the shell hasn't been touched.

As an aside: I feel quite strongly that (at least OSC 2) shell integration should be enabled by default, as it is for every other Linux shell I've used, but I'm not sure which issues that caused that the default config refers to? Which terminals are broken by shell integration, and could some of the shell integrations be turned on by default after splitting things into sub-options as suggested in #11301 ?

User-Facing Changes

You'll just have shell integrations working from right after the shell has been launched, instead of needing to run something first.

Tests + Formatting

Not quite sure how to test this one? Are there any other tests that currently exist for shell integration? I couldn't quite track them down...

After Submitting

Let me know if you think this needs any user-facing docs changes!

}

if shell_integration {
do_shell_integration(System::host_name(), engine_state, &mut unique_stack);
Copy link
Copy Markdown
Contributor

@fdncred fdncred Apr 18, 2024

Choose a reason for hiding this comment

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

  1. I'd rather get this host_name() once and use pass it through. Seems like that minor refactor would help.
  2. I also think do_shell_integration() should be named something else since it's only part of the shell integration. Not you're fault, of course, but you are renaming it here. Maybe shell_integration_osc_7_633_2()?, which leads us to another PR which could separate those.

I'm up for other names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Both good comments that address things that were bugging me too whilst I was writing this PR — I'll have a quick think about if any other name would be better, but otherwise I'll make these changes ASAP!

@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Apr 18, 2024

Other than my comment above, I think is ok. You're really just running the "do_shell_integration" sooner in order to give OSC2 functionality. I see this PR as a first step toward separating the shell_integration functions.

@TheLostLambda
Copy link
Copy Markdown
Contributor Author

Hopefully this is what you were after, @fdncred ?

Copy link
Copy Markdown
Contributor

@fdncred fdncred left a comment

Choose a reason for hiding this comment

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

Thanks. I think it looks good. Just need to fix the clippy warnings.

@TheLostLambda
Copy link
Copy Markdown
Contributor Author

Yup! That's my bad, but a good sign that the refactor opens the door to simplify things even more with a clippy lint!

I'll sort that out now!

@TheLostLambda
Copy link
Copy Markdown
Contributor Author

Ready for workflow approval!

@fdncred fdncred merged commit 351bff8 into nushell:main Apr 19, 2024
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Apr 19, 2024

Thanks

@hustcer hustcer added this to the v0.93.0 milestone Apr 19, 2024
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.

a feature like auto title in zsh

3 participants