1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

fix(wayland): panicking on compositors without protocol support

This allows Ironbar to run on a wider range of compositors, where support for the `wlr_foreign_toplevel` protocol used by focused/launcher, and the `wlr_data_control_device` protocol used by clipboard is missing
This commit is contained in:
Jake Stanger 2025-04-21 20:11:47 +01:00
parent 53317dbada
commit 963a450ff5
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
3 changed files with 36 additions and 10 deletions

View file

@ -147,6 +147,11 @@ impl Environment {
pub fn copy_to_clipboard(&mut self, item: ClipboardItem) {
debug!("Copying item to clipboard: {item:?}");
let Some(data_control_device_manager) = &self.data_control_device_manager_state else {
error!("data_control_device_manager not available, cannot copy");
return;
};
let seat = self.default_seat();
let Some(device) = self
.data_control_devices
@ -156,8 +161,7 @@ impl Environment {
return;
};
let source = self
.data_control_device_manager_state
let source = data_control_device_manager
.create_copy_paste_source(&self.queue_handle, [&item.mime_type, INTERNAL_MIME_TYPE]);
source.set_selection(&device.device);