diff --git a/Cargo.lock b/Cargo.lock index 39ee75f6dd..bb6877f762 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -518,6 +518,16 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" +[[package]] +name = "annotate-snippets" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccaf7e9dfbb6ab22c82e473cd1a8a7bd313c19a5b7e40970f3d89ef5a5c9e81e" +dependencies = [ + "unicode-width 0.1.14", + "yansi-term", +] + [[package]] name = "anstream" version = "0.6.18" @@ -2108,6 +2118,7 @@ version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ + "annotate-snippets", "bitflags 2.9.0", "cexpr", "clang-sys", @@ -3578,6 +3589,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "cookie-factory" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" +dependencies = [ + "futures 0.3.31", +] + [[package]] name = "copilot" version = "0.1.0" @@ -9445,6 +9465,34 @@ dependencies = [ "redox_syscall 0.5.11", ] +[[package]] +name = "libspa" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65f3a4b81b2a2d8c7f300643676202debd1b7c929dbf5c9bb89402ea11d19810" +dependencies = [ + "bitflags 2.9.0", + "cc", + "convert_case 0.6.0", + "cookie-factory", + "libc", + "libspa-sys", + "nix 0.27.1", + "nom 7.1.3", + "system-deps", +] + +[[package]] +name = "libspa-sys" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf0d9716420364790e85cbb9d3ac2c950bde16a7dd36f3209b7dfdfc4a24d01f" +dependencies = [ + "bindgen 0.69.5", + "cc", + "system-deps", +] + [[package]] name = "libsqlite3-sys" version = "0.30.1" @@ -10520,6 +10568,17 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.9.0", + "cfg-if", + "libc", +] + [[package]] name = "nix" version = "0.28.0" @@ -12210,6 +12269,34 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pipewire" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08e645ba5c45109106d56610b3ee60eb13a6f2beb8b74f8dc8186cf261788dda" +dependencies = [ + "anyhow", + "bitflags 2.9.0", + "libc", + "libspa", + "libspa-sys", + "nix 0.27.1", + "once_cell", + "pipewire-sys", + "thiserror 1.0.69", +] + +[[package]] +name = "pipewire-sys" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "849e188f90b1dda88fe2bfe1ad31fe5f158af2c98f80fb5d13726c44f3f01112" +dependencies = [ + "bindgen 0.69.5", + "libspa-sys", + "system-deps", +] + [[package]] name = "pkcs1" version = "0.7.5" @@ -14363,8 +14450,10 @@ dependencies = [ "anyhow", "cocoa 0.25.0", "core-graphics-helmer-fork", + "dbus", "log", "objc", + "pipewire", "rand 0.8.5", "screencapturekit", "screencapturekit-sys", @@ -20331,6 +20420,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +[[package]] +name = "yansi-term" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1" +dependencies = [ + "winapi", +] + [[package]] name = "yawc" version = "0.2.4" diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index 6e5a76d441..1d50b56ea5 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -50,6 +50,7 @@ wayland = [ "filedescriptor", "xkbcommon", "open", + "scap?/wayland", ] x11 = [ "blade-graphics", diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rs index 72e4477ecf..af7c545397 100644 --- a/crates/gpui/src/platform/linux/wayland/client.rs +++ b/crates/gpui/src/platform/linux/wayland/client.rs @@ -68,7 +68,6 @@ use super::{ display::WaylandDisplay, window::{ImeInput, WaylandWindowStatePtr}, }; - use crate::platform::{PlatformWindow, blade::BladeContext}; use crate::{ AnyWindowHandle, Bounds, Capslock, CursorStyle, DOUBLE_CLICK_INTERVAL, DevicePixels, DisplayId, @@ -666,7 +665,7 @@ impl LinuxClient for WaylandClient { #[cfg(feature = "screen-capture")] fn is_screen_capture_supported(&self) -> bool { - false + true } #[cfg(feature = "screen-capture")] @@ -674,17 +673,10 @@ impl LinuxClient for WaylandClient { &self, ) -> futures::channel::oneshot::Receiver>>> { - // TODO: Get screen capture working on wayland. Be sure to try window resizing as that may - // be tricky. - // - // start_scap_default_target_source() - let (sources_tx, sources_rx) = futures::channel::oneshot::channel(); - sources_tx - .send(Err(anyhow::anyhow!( - "Wayland screen capture not yet implemented." - ))) - .ok(); - sources_rx + // todo! Try window resizing as that may have unexpected results. + crate::platform::scap_screen_capture::start_scap_default_target_source( + &self.0.borrow().common.foreground_executor, + ) } fn open_window( diff --git a/script/linux b/script/linux index 029278bea3..f1e5a20eae 100755 --- a/script/linux +++ b/script/linux @@ -30,6 +30,8 @@ if [[ -n $apt ]]; then libwayland-dev libx11-xcb-dev libxkbcommon-x11-dev + libdbus-1-dev + libpipewire-0.3-dev libssl-dev libzstd-dev libvulkan1 @@ -78,6 +80,8 @@ if [[ -n $dnf ]] || [[ -n $yum ]]; then wayland-devel libxcb-devel libxkbcommon-x11-devel + dbus-devel + pipewire-devel openssl-devel libzstd-devel vulkan-loader @@ -136,6 +140,7 @@ if [[ -n $zyp ]]; then alsa-devel clang cmake + dbus-1-devel fontconfig-devel gcc gcc-c++ @@ -151,6 +156,7 @@ if [[ -n $zyp ]]; then make mold openssl-devel + pipewire-devel sqlite3-devel tar wayland-devel @@ -176,6 +182,8 @@ if [[ -n $pacman ]]; then libgit2 libxcb libxkbcommon-x11 + dbus + libpipewire openssl zstd pkgconf @@ -204,6 +212,8 @@ if [[ -n $xbps ]]; then fontconfig-devel libxcb-devel libxkbcommon-devel + dbus-devel + pipewire-devel libzstd-devel openssl-devel wayland-devel