aboutsummaryrefslogtreecommitdiff
path: root/src/niri.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-08-27 10:29:06 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-08-27 10:29:06 +0400
commite09a6d6392e73d8410b177ed9307c15f97d14858 (patch)
treef07d122a8d982ca585ce273995e2faea25c90d32 /src/niri.rs
parenta54e048f419221be9f26310363267d63a8758abb (diff)
downloadniri-e09a6d6392e73d8410b177ed9307c15f97d14858.tar.gz
niri-e09a6d6392e73d8410b177ed9307c15f97d14858.tar.bz2
niri-e09a6d6392e73d8410b177ed9307c15f97d14858.zip
Add trivial Mutter ServiceChannel impl
Makes xdp-gnome work.
Diffstat (limited to 'src/niri.rs')
-rw-r--r--src/niri.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/niri.rs b/src/niri.rs
index b428345a..9a8dcac3 100644
--- a/src/niri.rs
+++ b/src/niri.rs
@@ -44,6 +44,7 @@ use smithay::wayland::socket::ListeningSocketSource;
use smithay::wayland::tablet_manager::TabletManagerState;
use crate::backend::Backend;
+use crate::dbus::mutter_service_channel::ServiceChannel;
use crate::frame_clock::FrameClock;
use crate::layout::{MonitorRenderElement, MonitorSet};
use crate::utils::{center, get_monotonic_time, load_default_cursor};
@@ -85,6 +86,8 @@ pub struct Niri {
pub pointer_buffer: Option<(TextureBuffer<GlesTexture>, Point<i32, Physical>)>,
pub cursor_image: CursorImageStatus,
pub dnd_icon: Option<WlSurface>,
+
+ pub zbus_conn: Option<zbus::blocking::Connection>,
}
pub struct OutputState {
@@ -151,6 +154,7 @@ impl Niri {
socket_name.to_string_lossy()
);
+ let mut zbus_conn = None;
if std::env::var_os("NOTIFY_SOCKET").is_some() {
// We're starting as a systemd service. Export our variables and tell systemd we're
// ready.
@@ -166,6 +170,20 @@ impl Niri {
warn!("error spawning shell to import environment into systemd: {err:?}");
}
+ // Set up zbus, make sure it happens before anything might want it.
+ let conn = zbus::blocking::ConnectionBuilder::session()
+ .unwrap()
+ .name("org.gnome.Mutter.ServiceChannel")
+ .unwrap()
+ .serve_at(
+ "/org/gnome/Mutter/ServiceChannel",
+ ServiceChannel::new(display_handle.clone()),
+ )
+ .unwrap()
+ .build()
+ .unwrap();
+ zbus_conn = Some(conn);
+
// Notify systemd we're ready.
if let Err(err) = sd_notify::notify(false, &[NotifyState::Ready]) {
warn!("error notifying systemd: {err:?}");
@@ -210,6 +228,8 @@ impl Niri {
pointer_buffer: None,
cursor_image: CursorImageStatus::Default,
dnd_icon: None,
+
+ zbus_conn,
}
}