-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reload configuration on dbus suspend/resume events
- Loading branch information
1 parent
072556c
commit b702d29
Showing
11 changed files
with
629 additions
and
101 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "lact-cli" | ||
version = "0.3.1" | ||
version = "0.3.2" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "lact-client" | ||
version = "0.3.1" | ||
version = "0.3.2" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crate::server::handler::Handler; | ||
use futures::StreamExt; | ||
use tracing::{error, info}; | ||
use zbus::{Connection, Proxy}; | ||
|
||
pub async fn listen_events(handler: Handler) { | ||
match connect_proxy().await { | ||
// Note: despite the name, the events get triggered both on suspend and resume | ||
Ok(proxy) => match proxy.receive_signal("PrepareForSleep").await { | ||
Ok(mut stream) => { | ||
while stream.next().await.is_some() { | ||
info!("suspend/resume event detected, reloading config"); | ||
handler.load_config().await; | ||
} | ||
} | ||
Err(err) => error!("could not subscribe to suspend events: {err:#}"), | ||
}, | ||
Err(err) => { | ||
error!("could not connect to dbus proxy: {err:#}"); | ||
} | ||
} | ||
error!("suspend/resume events will not be handled."); | ||
} | ||
|
||
async fn connect_proxy() -> anyhow::Result<Proxy<'static>> { | ||
let conn = Connection::system().await?; | ||
let proxy = Proxy::new_owned( | ||
conn, | ||
"org.freedesktop.login1", | ||
"/org/freedesktop/login1", | ||
"org.freedesktop.login1.Manager", | ||
) | ||
.await?; | ||
Ok(proxy) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "lact-gui" | ||
version = "0.3.1" | ||
version = "0.3.2" | ||
authors = ["Ilya Zlobintsev <[email protected]>"] | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "lact-schema" | ||
version = "0.3.1" | ||
version = "0.3.2" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "lact" | ||
version = "0.3.1" | ||
version = "0.3.2" | ||
edition = "2021" | ||
|
||
[features] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters