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

[REQUEST] Reload config from disk using signal #683

Closed
Hubro opened this issue Dec 11, 2023 · 4 comments · Fixed by #722
Closed

[REQUEST] Reload config from disk using signal #683

Hubro opened this issue Dec 11, 2023 · 4 comments · Fixed by #722
Assignees
Labels
enhancement New feature or request

Comments

@Hubro
Copy link

Hubro commented Dec 11, 2023

Is your feature request related to a problem? Please describe.

I want to automate switching between light and dark mode on all my applications. btop is ****ing awesome, so I constantly have it open on all my PCs.

Currently I don't see any good way of automatically switching between light and dark themes in btop without doing it manually through the UI.

Describe the solution you'd like

It would be nice if I could send a signal (SIGHUP or SIGUSR1) to btop to make it reload the configuration from disk. That way I could write a darkman script that toggles the btop theme in the config file and runs pkill -USR1 btop and presto!

Describe alternatives you've considered

Wrapper script that restarts btop any time the config file changes. Not ideal, since all state is lost.

Additional context

I'm hopelessly addicted to home automation and the lack of this feature is causing me considerable anguish.

@Hubro Hubro added the enhancement New feature or request label Dec 11, 2023
@sahinakkaya
Copy link

Came here for the exact same reason (darkman). It would be really cool to change theme on the fly.

@MartinPit
Copy link
Contributor

Just opened a pull request resolving your exact problem.

@imwints
Copy link
Contributor

imwints commented Jan 17, 2024

Describe alternatives you've considered

Wrapper script that restarts btop any time the config file changes. Not ideal, since all state is lost.

Why lost? I don't see why you couldn't save the state. Btop writes it's config before exiting. When you intercept SIGUSR with the script you could move the new config out of the way, let btop write its state and then copy the new file back and start btop with the new state. You could even just sed only a single config line, like the theme, and any other config change would persist. Or am I missing something?

@Hubro
Copy link
Author

Hubro commented Jan 17, 2024

By state I mean the graphs and such, not the config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants