gtk: only show clipboard toast when content isn't empty

This commit is contained in:
Leah Amelia Chen
2025-07-22 16:43:35 +00:00
parent d3f40d70e2
commit a7b7c10474

View File

@ -1259,9 +1259,13 @@ pub fn setClipboardString(
// We only toast if we are copying to the standard clipboard. // We only toast if we are copying to the standard clipboard.
if (clipboard_type == .standard and if (clipboard_type == .standard and
self.app.config.@"app-notifications".@"clipboard-copy") self.app.config.@"app-notifications".@"clipboard-copy")
{ toast: {
if (self.container.window()) |window| const window = self.container.window() orelse break :toast;
window.sendToast(i18n._("Copied to clipboard"));
if (val.len > 0)
window.sendToast(i18n._("Copied to clipboard"))
else
window.sendToast(i18n._("Cleared clipboard"));
} }
return; return;
} }