From 8b80ec0988e6e679ab64e0f8b4e5fcae0560cc89 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Mon, 12 Oct 2026 21:11:39 +0200 Subject: [PATCH] fix(gtk): show the "Copied to clipboard" toast again The surface's `clipboard-write` signal carries the clipboard kind as a u32 (0 = standard), but the window handler decoded it with glib::EnumValue::from_value, which always returns None for a u32. The "standard clipboard" check therefore always failed and no "Copied to clipboard" / "Cleared clipboard" toast was ever shown (app-notifications = clipboard-copy), neither for keybind copies nor for OSC 52 writes. The handler now takes the u32 directly. Test Plan: - run `printf '\e]52;c;aGVsbG8=\a'`: toast appears, pixel-identical to Ghostty 1.3.1 --- crates/ghostty-apprt-gtk/src/class/window.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/ghostty-apprt-gtk/src/class/window.rs b/crates/ghostty-apprt-gtk/src/class/window.rs index 8596490..7d1e90f 100644 --- a/crates/ghostty-apprt-gtk/src/class/window.rs +++ b/crates/ghostty-apprt-gtk/src/class/window.rs @@ -1126,8 +1126,8 @@ impl Window { glib::closure_local!( #[weak(rename_to = win)] self, - move |_surface: &Surface, clipboard: glib::Value, text: &str| { - win.surface_clipboard_write(&clipboard, text); + move |_surface: &Surface, clipboard: u32, text: &str| { + win.surface_clipboard_write(clipboard, text); } ), )); @@ -1518,11 +1518,10 @@ impl Window { tab_view.close_page(&page); } - fn surface_clipboard_write(&self, clipboard: &glib::Value, text: &str) { - // We only toast for the standard clipboard. - let is_standard = glib::EnumValue::from_value(clipboard) - .is_some_and(|(_, v)| v.value() == 0 || v.nick() == "standard"); - if !is_standard { + fn surface_clipboard_write(&self, clipboard: u32, text: &str) { + // We only toast for the standard clipboard (encoded as 0 by the + // surface's `clipboard-write` signal). + if clipboard != 0 { return; }