From d2d7c655acf6a9ce10d66773410e49ef216a4211 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 28 Oct 2025 12:55:53 -0700 Subject: [PATCH] Expose `wlr-data-control-unstable-v1` to non-sandboxed clients Some users have complained about not supporting clipboard managers. But this was possible, but hidden under the `COSMIC_DATA_CONTROL_ENABLED` env var. Since the security context protocol exists now to provide a way to not expose a protocol like this to sandboxed clients, it should be safe to expose this now. --- src/state.rs | 12 ++++++------ src/wayland/handlers/data_control.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/state.rs b/src/state.rs index 513ec523..eb081db2 100644 --- a/src/state.rs +++ b/src/state.rs @@ -234,7 +234,7 @@ pub struct Common { pub output_power_state: OutputPowerState, pub presentation_state: PresentationState, pub primary_selection_state: PrimarySelectionState, - pub data_control_state: Option, + pub data_control_state: DataControlState, pub image_capture_source_state: ImageCaptureSourceState, pub screencopy_state: ScreencopyState, pub seat_state: SeatState, @@ -651,11 +651,11 @@ impl State { let idle_inhibit_manager_state = IdleInhibitManagerState::new::(dh); let idle_inhibiting_surfaces = HashSet::new(); - let data_control_state = crate::utils::env::bool_var("COSMIC_DATA_CONTROL_ENABLED") - .unwrap_or(false) - .then(|| { - DataControlState::new::(dh, Some(&primary_selection_state), |_| true) - }); + let data_control_state = DataControlState::new::( + dh, + Some(&primary_selection_state), + client_not_sandboxed, + ); let shell = Arc::new(parking_lot::RwLock::new(Shell::new(&config))); diff --git a/src/wayland/handlers/data_control.rs b/src/wayland/handlers/data_control.rs index f6132856..c17d9279 100644 --- a/src/wayland/handlers/data_control.rs +++ b/src/wayland/handlers/data_control.rs @@ -8,7 +8,7 @@ use smithay::{ impl DataControlHandler for State { fn data_control_state(&mut self) -> &mut DataControlState { - self.common.data_control_state.as_mut().unwrap() + &mut self.common.data_control_state } }