diff options
Diffstat (limited to 'src/dbus/gnome_shell_screenshot.rs')
| -rw-r--r-- | src/dbus/gnome_shell_screenshot.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/dbus/gnome_shell_screenshot.rs b/src/dbus/gnome_shell_screenshot.rs index fad3649b..fbf3bc1f 100644 --- a/src/dbus/gnome_shell_screenshot.rs +++ b/src/dbus/gnome_shell_screenshot.rs @@ -1,7 +1,10 @@ use std::path::PathBuf; use smithay::reexports::calloop; -use zbus::{dbus_interface, fdo}; +use zbus::dbus_interface; +use zbus::fdo::{self, RequestNameFlags}; + +use super::Start; pub struct Screenshot { to_niri: calloop::channel::Sender<ScreenshotToNiri>, @@ -55,3 +58,18 @@ impl Screenshot { Self { to_niri, from_niri } } } + +impl Start for Screenshot { + fn start(self) -> anyhow::Result<zbus::blocking::Connection> { + let conn = zbus::blocking::Connection::session()?; + let flags = RequestNameFlags::AllowReplacement + | RequestNameFlags::ReplaceExisting + | RequestNameFlags::DoNotQueue; + + conn.object_server() + .at("/org/gnome/Shell/Screenshot", self)?; + conn.request_name_with_flags("org.gnome.Shell.Screenshot", flags)?; + + Ok(conn) + } +} |
