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
This commit is contained in:
ddidderr committed 2026-10-12 21:11:39 +02:00
1 parent 87dde3fafa
commit 8b80ec0988
1 file changed
+6 -7
+6 -7
View File
@@ -1126,8 +1126,8 @@ impl Window {
glib::closure_local!( glib::closure_local!(
#[weak(rename_to = win)] #[weak(rename_to = win)]
self, self,
move |_surface: &Surface, clipboard: glib::Value, text: &str| { move |_surface: &Surface, clipboard: u32, text: &str| {
win.surface_clipboard_write(&clipboard, text); win.surface_clipboard_write(clipboard, text);
} }
), ),
)); ));
@@ -1518,11 +1518,10 @@ impl Window {
tab_view.close_page(&page); tab_view.close_page(&page);
} }
fn surface_clipboard_write(&self, clipboard: &glib::Value, text: &str) { fn surface_clipboard_write(&self, clipboard: u32, text: &str) {
// We only toast for the standard clipboard. // We only toast for the standard clipboard (encoded as 0 by the
let is_standard = glib::EnumValue::from_value(clipboard) // surface's `clipboard-write` signal).
.is_some_and(|(_, v)| v.value() == 0 || v.nick() == "standard"); if clipboard != 0 {
if !is_standard {
return; return;
} }