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

Custom terminal title for Bottom #4

Closed

Conversation

RaresCon
Copy link

@RaresCon RaresCon commented Jan 21, 2023

Description

A description of the change, what it does, and why it was made. If relevant (such as any change that modifies the UI), please provide screenshots of the changes:

Added an option to change the terminal name. The user can use --title, followed by the desired name for the terminal, or use title_to_hostname field (true/false) in the config file to force the name of the terminal to be the name of the host machine. Otherwise, if no option is used, the default name of the terminal will be now "Bottom". It also works while using SSH.

Windows example

WSL/Ubuntu example

Arch example

Option example

Hostname example

Issue

If applicable, what issue does this address?

#ClementTsang#277

Testing

If relevant, please state how this was tested. All changes must be tested to work:

Tested it on multiple platforms. I also used SSH on all of them.

If this is a code change, please also indicate which platforms were tested:

  • Windows
  • macOS
  • Linux

Checklist

If relevant, ensure the following have been met:

  • Areas your change affects have been linted using rustfmt (cargo fmt)
  • The change has been tested and doesn't appear to cause any unintended breakage
  • Documentation has been added/updated if needed (README.md, help menu, doc pages, etc.)
  • The pull request passes the provided CI pipeline
  • There are no merge conflicts
  • If relevant, new tests were added (don't worry too much about coverage)

RaresCon and others added 6 commits January 11, 2023 14:59
For bottom to know that there are no batteries on the system,
I added the battery::Manager to the options.rs file because
here is the first moment bottom verifies battery configuration
by reading the config file, which may or may not contain the
battery field, but for a better UX, it doesn't matter what bottom
finds in the config file now, if it doesn't retrieve battery data,
it just ignores the battery widget all together.
If needed, it can be adjusted so that if the config file contains
the battery field, it will still show the widget.
I guarded the options.rs in two places for battery module that can be missing in the feature list.
I added a new option in terminal and in the config
file to be able to change the terminal title with
any custom one. The user can now add `--title` and
the custom title after it or add the `title_to_hostname`
field in the config file to set the terminal's name
to hostname. If there is no option found, then
the name of the terminal will be set to "Bottom".
@alexandruradovici
Copy link

alexandruradovici commented Jan 23, 2023

It builds on macOS, but does not seem to change the title. Might be a macOS problem.

Tried on a different terminal app, it works.

@alexandruradovici alexandruradovici added the needs-rebase The pull request needs to be rebased due to conflicts with master. label Jan 23, 2023
@RaresCon
Copy link
Author

I will test it on macOS as well. Is the rebase needed for the Cargo.toml that has conflicts with master? If so, I added a new crate, gethostname, which is used to get the hostname.

@alexandruradovici
Copy link

I will test it on macOS as well. Is the rebase needed for the Cargo.toml that has conflicts with master? If so, I added a new crate, gethostname, which is used to get the hostname.

Yes, due to Cargo.toml.

@RaresCon
Copy link
Author

Done, there are no more conflicts.

@alexandruradovici alexandruradovici removed the needs-rebase The pull request needs to be rebased due to conflicts with master. label Jan 23, 2023
@alexandruradovici
Copy link

Send the pull request and post a link to it.

@RaresCon
Copy link
Author

ClementTsang#999

the name of the terminal, it will be set as before
to its path.

This behaviour will happen when an error happens
inside the `get_use_terminal_name` function as well.
@alexandruradovici alexandruradovici added the upstream This pull request was opened in the upstream reposiotry label Jan 24, 2023
I removed the custom title option for terminal and made it use
the hostname when `--title` is used. The title always contains `btm` now.
If `--title` or `title_has_hostname = true` (in config file) is not present,
then the terminal has the previous behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream This pull request was opened in the upstream reposiotry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants