diff --git a/Cargo.lock b/Cargo.lock index e8d9635..0988e1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,7 +130,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix", + "rustix 0.38.44", "slab", "tracing", "windows-sys 0.59.0", @@ -321,7 +321,7 @@ dependencies = [ "bitflags 2.9.0", "log", "polling", - "rustix", + "rustix 0.38.44", "slab", "thiserror 1.0.69", ] @@ -333,7 +333,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop", - "rustix", + "rustix 0.38.44", "wayland-backend", "wayland-client", ] @@ -394,9 +394,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.29" +version = "4.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acebd8ad879283633b343856142139f2da2317c96b05b4dd6181c61e2480184" +checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944" dependencies = [ "clap_builder", "clap_derive", @@ -404,9 +404,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.29" +version = "4.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ba32cbda51c7e1dfd49acc1457ba1a7dec5b64fe360e828acb13ca8dc9c2f9" +checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9" dependencies = [ "anstream", "anstyle", @@ -476,9 +476,9 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colpetto" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc03b5723fbb502f5f7bc5dbc48b04880a22bb0a887bd3da5271fa4811c1e2bc" +checksum = "a9bac489a5240c777561cb744407f9fd4b42c5218241ad39c28c6396dcf08c9f" dependencies = [ "cc", "devil", @@ -533,30 +533,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" -dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "memoffset 0.8.0", - "scopeguard", -] - [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -784,12 +760,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "feeef44e73baff3a26d371801df019877a9866a8c493d315ab00177843314f35" -[[package]] -name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - [[package]] name = "endi" version = "1.1.0" @@ -1859,10 +1829,9 @@ dependencies = [ "mpd-utils", "mpris", "notify", - "pkg-config", "regex", "reqwest", - "rustix", + "rustix 1.0.5", "schemars", "serde", "serde_json", @@ -1966,7 +1935,7 @@ version = "2.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "441092fb2d05962d74246a00c1b2f8c87c60fb6b38a5cc42227c229a702c0ce5" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.9.0", "libc", "libpulse-sys", "num-derive", @@ -2004,6 +1973,12 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" + [[package]] name = "litemap" version = "0.7.5" @@ -2262,8 +2237,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", - "quote 1.0.38", - "syn 1.0.109", + "quote 1.0.39", + "syn 2.0.99", ] [[package]] @@ -2281,7 +2256,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daeaf60f25471d26948a1c2f840e3f7d86f4109e3af4e8e4b5cd70c39690d925" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", ] [[package]] @@ -2507,7 +2482,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix", + "rustix 0.38.44", "tracing", "windows-sys 0.59.0", ] @@ -2782,7 +2757,20 @@ dependencies = [ "bitflags 2.9.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +dependencies = [ + "bitflags 2.9.0", + "errno", + "libc", + "linux-raw-sys 0.9.3", "windows-sys 0.59.0", ] @@ -2825,6 +2813,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + [[package]] name = "ryu" version = "1.0.19" @@ -2873,18 +2867,6 @@ dependencies = [ "syn 2.0.99", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - [[package]] name = "security-framework" version = "2.11.1" @@ -3065,7 +3047,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix", + "rustix 0.38.44", "thiserror 1.0.69", "wayland-backend", "wayland-client", @@ -3284,7 +3266,7 @@ dependencies = [ "fastrand", "getrandom 0.3.1", "once_cell", - "rustix", + "rustix 0.38.44", "windows-sys 0.59.0", ] @@ -3867,7 +3849,7 @@ checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf" dependencies = [ "cc", "downcast-rs", - "rustix", + "rustix 0.38.44", "smallvec", "wayland-sys", ] @@ -3879,7 +3861,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f" dependencies = [ "bitflags 2.9.0", - "rustix", + "rustix 0.38.44", "wayland-backend", "wayland-scanner", ] @@ -3901,7 +3883,7 @@ version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a93029cbb6650748881a00e4922b076092a6a08c11e7fbdb923f064b23968c5d" dependencies = [ - "rustix", + "rustix 0.38.44", "wayland-client", "xcursor", ] diff --git a/Cargo.toml b/Cargo.toml index 0af73b5..4d43d18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -178,7 +178,7 @@ futures-lite = { version = "2.6.0", optional = true } # network_manager, upower, zbus = { version = "5.5.0", default-features = false, features = ["tokio"], optional = true } # network_manager, notifications, upower swayipc-async = { version = "2.0.4", optional = true } # workspaces, keyboard hyprland = { version = "0.4.0-alpha.3", features = ["silent"], optional = true } # workspaces, keyboard -rustix = { version = "0.38.43", default-features = false, features = ["fs", "pipe"], optional = true } # clipboard, input +rustix = { version = "1.0.5", default-features = false, features = ["std", "fs", "pipe", "event"], optional = true } # clipboard, input # schema schemars = { version = "0.8.22", optional = true } @@ -188,7 +188,3 @@ clap = { version = "4.5.34", features = ["derive"] } clap_complete = "4.5.47" serde = { version = "1.0.219", features = ["derive"] } serde_json = "1.0.140" -pkg-config = "0.3.31" # specify version to fix dep resolution issue - -#[patch.crates-io] -#system-tray = { path = "../system-tray" } \ No newline at end of file diff --git a/src/clients/wayland/wlr_data_control/mod.rs b/src/clients/wayland/wlr_data_control/mod.rs index ff285b8..877a9bc 100644 --- a/src/clients/wayland/wlr_data_control/mod.rs +++ b/src/clients/wayland/wlr_data_control/mod.rs @@ -11,18 +11,19 @@ use crate::{Ironbar, lock, spawn, try_send}; use color_eyre::Result; use device::DataControlDevice; use glib::Bytes; +use rustix::buffer::spare_capacity; use rustix::event::epoll; use rustix::event::epoll::CreateFlags; +use rustix::fs::Timespec; use rustix::pipe::{fcntl_getpipe_size, fcntl_setpipe_size}; use smithay_client_toolkit::data_device_manager::WritePipe; use std::cmp::min; -use std::ffi::c_int; use std::fmt::{Debug, Formatter}; use std::fs::File; use std::io::{ErrorKind, Write}; -use std::os::fd::RawFd; use std::os::fd::{AsFd, BorrowedFd, OwnedFd}; use std::sync::Arc; +use std::time::Duration; use std::{fs, io}; use tokio::io::AsyncReadExt; use tokio::sync::broadcast; @@ -157,7 +158,7 @@ impl Environment { let source = self .data_control_device_manager_state - .create_copy_paste_source(&self.queue_handle, [INTERNAL_MIME_TYPE, &item.mime_type]); + .create_copy_paste_source(&self.queue_handle, [&item.mime_type, INTERNAL_MIME_TYPE]); source.set_selection(&device.device); self.copy_paste_sources.push(source); @@ -311,12 +312,16 @@ impl DataControlSourceHandler for Environment { epoll::EventFlags::OUT, )?; - let mut events = epoll::EventVec::with_capacity(16); + let mut events = Vec::with_capacity(16); while !bytes.is_empty() { let chunk = &bytes[..min(pipe_size, bytes.len())]; - epoll::wait(&epoll, &mut events, 100u16 as c_int)?; + epoll::wait( + &epoll, + spare_capacity(&mut events), + Some(&Timespec::try_from(Duration::from_millis(100))?), + )?; match file.write(chunk) { Ok(written) => { @@ -332,7 +337,7 @@ impl DataControlSourceHandler for Environment { debug!("Done writing"); } else { - error!("Failed to find source"); + error!("Failed to find source (mime: '{mime}')"); } } diff --git a/src/clients/wayland/wlr_data_control/offer.rs b/src/clients/wayland/wlr_data_control/offer.rs index cddd076..255c406 100644 --- a/src/clients/wayland/wlr_data_control/offer.rs +++ b/src/clients/wayland/wlr_data_control/offer.rs @@ -1,6 +1,6 @@ use super::manager::DataControlDeviceManagerState; use crate::lock; -use rustix::pipe::{pipe_with, PipeFlags}; +use rustix::pipe::{PipeFlags, pipe_with}; use smithay_client_toolkit::data_device_manager::data_offer::DataOfferError; use std::ops::DerefMut; use std::os::fd::AsFd;