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

Hide the terminals part of the running sessions status bar item by default #16846

Merged
merged 5 commits into from
Jan 24, 2025

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Oct 9, 2024

References

Fixes #11547

As discussed in #11547, this status bar item is probably not very useful in practice. And hiding it by default would leave more space for other items.

Code changes

  • Add a setting to allow for hiding the "Running Sessions" status bar item
  • Hide the terminal part of the status bar item if there is no terminal running
  • Update UI tests snapshots

User-facing changes

  • The status bar item does not show the terminal icon and number if there is not terminal currently running
  • The item can be hidden entirely from the status bar via the Settings Editor
jupyterlab-autohide-terminal-status-bar.mov

Backwards-incompatible changes

None

@jtpio jtpio added this to the 4.4.0 milestone Oct 9, 2024
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@SylvainCorlay
Copy link
Member

Awesome!

@jtpio jtpio force-pushed the hide-running-sessions-status-bar-item branch from 4d6d388 to e190d63 Compare January 20, 2025 14:18
@jtpio jtpio force-pushed the hide-running-sessions-status-bar-item branch from be76add to d3f2c34 Compare January 20, 2025 15:47
@jtpio
Copy link
Member Author

jtpio commented Jan 20, 2025

Following @krassowski's comment in #11547 (comment) :

What about auto-hiding the terminals part when there are no running terminals? This would reduce the terminals + kernels item by half for many users.

This PR was updated to:

  • auto hide the terminals part of the status item if there is not terminal currently running
  • keep the setting, but enabled by default to not change the current behavior

And the UI tests snapshots updated accordingly.

Marking it as ready so it can be considered for 4.4.0.

@jtpio jtpio marked this pull request as ready for review January 20, 2025 17:15
@jtpio jtpio changed the title Hide the running sessions status bar item by default Hide the terminals part of the running sessions status bar item by default Jan 22, 2025
const showStatusBarItem = settings.get('showStatusBarItem')
.composite as boolean;
if (showStatusBarItem) {
disposable = registerItem();
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it register the item multiple times once we add more settings? I think it needs a guard to check if the disposable is defined and not disposed

Copy link
Member Author

@jtpio jtpio Jan 23, 2025

Choose a reason for hiding this comment

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

It looks like that would be the case. Maybe we can indeed add such guard to anticipate the case where new settings would be added 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Or maybe we can just dispose the item, and recreate it if showStatusBarItem is true.

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Some minor improvement suggestions

<terminalIcon.react verticalAlign="middle" stylesheet="statusBar" />
</GroupItem>
) : (
<div></div>
Copy link
Member

Choose a reason for hiding this comment

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

Can we return null or otherwise at least an empty fragment (<></>) here? See https://react.dev/learn/conditional-rendering#conditionally-returning-nothing-with-null

Suggested change
<div></div>
null

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like the use of GroupItem prevents this:

Type 'Element | null' is not assignable to type 'Element | (Element & string)'.
  Type 'null' is not assignable to type 'Element | (Element & string)'.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for checking, I've opened #17212

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Thank you @jtpio!

@jtpio
Copy link
Member Author

jtpio commented Jan 24, 2025

Thanks @krassowski for the review!

@jtpio jtpio merged commit ae74a82 into jupyterlab:main Jan 24, 2025
84 checks passed
@jtpio jtpio deleted the hide-running-sessions-status-bar-item branch January 24, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Status bar is overpopulated with information already on the screen
3 participants