aristocratos / btop

A monitor of resources
Apache License 2.0
21.38k stars 656 forks source link

Add config reload support #722

Closed MartinPit closed 9 months ago

MartinPit commented 10 months ago

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.

imwints commented 10 months ago

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

MartinPit commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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

imwints commented 10 months ago

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

MartinPit commented 10 months ago

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 commented 10 months ago

Edited with suggested changes.

aristocratos commented 9 months ago

Thanks for contributing!