-
Notifications
You must be signed in to change notification settings - Fork 28
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 reload config ability #43
Conversation
Thanks for the pull request Avimitin! I have looked into hotwatch and notify crates and there is an issue open for this. We can merge this as a workaround in the meanwhile and we can remove this command later. |
daemon/src/ipc_server.rs
Outdated
@@ -120,6 +120,13 @@ fn handle_message(buffer: &mut String, ustream: UnixStream, wpaperd: &mut Wpaper | |||
|
|||
IpcResponse::Ok | |||
}), | |||
|
|||
IpcMessage::ReloadConfig => { | |||
wpaperd.reload_config().map(|_| IpcResponse::Ok)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to call map here, as we don't use Result:::Ok(IpcResponse).
daemon/src/ipc_server.rs
Outdated
IpcMessage::ReloadConfig => { | ||
wpaperd.reload_config().map(|_| IpcResponse::Ok)?; | ||
// Force update | ||
wpaperd.surfaces.iter_mut().for_each(|sur| sur.next_image()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to call this function. When there is a message on the IPC, the main loop will wake up and check if the config has changed, applying all the modification needed.
daemon/src/wpaperd.rs
Outdated
Ok(config) => { | ||
if config != *wallpaper_config { | ||
*wallpaper_config = config; | ||
println!("Configuration updated"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more consistent to use the logging library here, by calling info!
.
daemon/src/wpaperd.rs
Outdated
*wallpaper_config = config; | ||
println!("Configuration updated"); | ||
} else { | ||
println!("Configuration unchanged"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we need to print this message, knowing when the configuration has changed for now should be enough.
321b4ff
to
99dd7f3
Compare
I've force push new changed, please review the code again. Besides those requested changes, I've also add a new function to |
99dd7f3
to
5992850
Compare
Signed-off-by: Avimitin <[email protected]>
5992850
to
655b8f1
Compare
Thank you for the PR! |
This PR implements a new IPC command to force wpaperd to reload config. The original proposal for this PR is that the file watcher does not watch the symlink content change, so if the config is symlinked to another file, wpaperd will never know the config has changed.