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 config reload support #722

Merged
merged 6 commits into from
Feb 11, 2024
Merged

Conversation

MartinPit
Copy link
Contributor

@MartinPit MartinPit commented Jan 16, 2024

Btop is now able to respond to SIGUSR2 signal and apply any changes made to config file, which were made while it has been running. Also added a key bind to do so manually.

This changes addresses my needs but also resolves #683.

  • By supplying SIGUSR2 signal the config is reloaded from disk
  • Pressing ctrl+r in app also does the same
  • Help menu extended with ctrl+r entry

@imwints
Copy link
Contributor

imwints commented Jan 17, 2024

SIGUSR1 is already used to interrupt the key polling (? something like that).

@MartinPit
Copy link
Contributor Author

SIGUSR1 is already used to interrupt the key polling (? something like that).

I don't think it is, because the line is currently commented out, no?

@imwints
Copy link
Contributor

imwints commented Jan 17, 2024

That is not commented out, this is just a comment what the signal is used for.

We have a couple of places in the code which will send SIGUSR1 to the process. This will now always reload the config.

@MartinPit
Copy link
Contributor Author

Oh, my bad then. Would it be fine if instead it would be switched to SIGUSR2?

@imwints
Copy link
Contributor

imwints commented Jan 17, 2024

I guess so. Have you thought about making this a key bind instead?

@MartinPit
Copy link
Contributor Author

MartinPit commented Jan 17, 2024

I feel like a signal would be better, as I and also the author of #683 would like to use it as a part of an automated script when switching desktop themes. But, there is also an option of making both signal handler and a key bind.

@MartinPit MartinPit marked this pull request as draft January 17, 2024 12:47
@MartinPit MartinPit marked this pull request as ready for review January 17, 2024 16:34
@MartinPit
Copy link
Contributor Author

Edited with suggested changes.

@aristocratos
Copy link
Owner

Thanks for contributing!

@aristocratos aristocratos merged commit 97e78eb into aristocratos:main Feb 11, 2024
52 checks passed
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.

[REQUEST] Reload config from disk using signal
3 participants