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

[feature request] reload config. #11

Closed
cinghiopinghio opened this issue Mar 9, 2022 · 1 comment
Closed

[feature request] reload config. #11

cinghiopinghio opened this issue Mar 9, 2022 · 1 comment

Comments

@cinghiopinghio
Copy link
Contributor

It would be cool to be able to reload the configuration (especially in an automated way or with a remote command), in particular this is my use case:

I managed to start dodo with a theme that match the current wm theme. At some point i want to change to dark or light theme. As of now I need to first change theme and then close and reopen dodo to make it follow the changes.

In astroid there was not such issue since, using gtk, it was automagically following the gtk theme.

@cinghiopinghio
Copy link
Contributor Author

Sorry for the noise, this is a non issue.
After researching unix signals in python I got something like:

def refresh(*args):
    """Reload."""
    import sys

    import dodo

    # this is necessary because the config dir is not in the path
    sys.path.append(os.path.expanduser("~/.config/dodo"))  #
    from palette import compute_palette  # isort:skip

    # this compute the palette given the system theme
    dodo.settings.theme = compute_palette()
    # I need to apply the theme twice or only half theme is updated (to be investigated)
    dodo.themes.apply_theme(dodo.settings.theme)
    dodo.themes.apply_theme(dodo.settings.theme)

signal.signal(signal.SIGUSR1, refresh)

now I only have to send:

pkill -SIGUSR1 dodo

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

No branches or pull requests

1 participant