Skip to content

Commit

Permalink
Updated zbus to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyCoolSlug committed Aug 6, 2024
1 parent 6a734b8 commit 1838c1a
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 33 deletions.
175 changes: 153 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ksni = { git = "https://github.com/talonvoice/ksni.git", branch = "zbus" }
rust-ini = "0.21.0"
#rand = "0.8.5"
shell-words = "1.1.0"
zbus = "3.14.1"
zbus = "4.4.0"

# Under Windows and MacOS, we use tao's tray feature
[target.'cfg(target_os = "windows")'.dependencies]
Expand Down
17 changes: 7 additions & 10 deletions daemon/src/platform/linux/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
sleep, of if we've just woken up. From there, we can throw the relevant Sleep Event across
and handle it.
We should also consider holding a delay inhibitor in order to keep the system awake form long
enough to actually perform actions on the GoXLR. So when we see PrepareForSleep(true), perform
sleep actions then drop the inhibitor, and when we see PrepareForSleep(false), perform wake
actions and grab a new inhibitor. NOTE: The inhibitors used *SHOULD* be delay ones, the util
should not completely block sleeps from happening.
We also implement Sleep inhibitors so we can prevent the sleep from occurring until we've
confirmed that our sleep actions have been performed.
Refs:
https://www.freedesktop.org/wiki/Software/systemd/logind/
Expand All @@ -23,12 +20,12 @@ use tokio::select;
use tokio::sync::{mpsc, oneshot};
use zbus::export::futures_util::StreamExt;
use zbus::zvariant::{OwnedFd, OwnedObjectPath, OwnedValue};
use zbus::{dbus_proxy, Connection};
use zbus::{proxy, Connection};

use crate::events::EventTriggers;
use crate::shutdown::Shutdown;

#[dbus_proxy(
#[proxy(
interface = "org.freedesktop.login1.Manager",
default_service = "org.freedesktop.login1",
default_path = "/org/freedesktop/login1"
Expand All @@ -41,16 +38,16 @@ trait Manager {
fn get_session(&self, session_id: &str) -> zbus::Result<OwnedObjectPath>;

/// The Sleep Signal Sent to us from DBus
#[dbus_proxy(signal)]
#[zbus(signal)]
fn prepare_for_sleep(sleep: bool) -> Result<()>;
}

#[dbus_proxy(
#[proxy(
interface = "org.freedesktop.DBus.Properties",
default_service = "org.freedesktop.login1"
)]
trait Session {
#[dbus_proxy(signal)]
#[zbus(signal)]
fn properties_changed(
interface: String,
changed: HashMap<String, OwnedValue>,
Expand Down

0 comments on commit 1838c1a

Please sign in to comment.