Gtk2::Clipboard(3)
π NAME π
okay so bestie, meet Gtk2::Clipboard β it's the wrapper for GtkClipboard. that's it, that's the whole vibe. it's how you talk to the clipboard. the cut-and-paste one. the one that holds your stuff. iconic behavior fr fr.
this page lives in the User Contributed Perl Documentation section of the manual, and yes the page itself is Gtk2::Clipboard(3), we're all very aware. π«Ά
π HIERARCHY π
the family tree, and it's giving inheritance:
Glib::Object
+----Gtk2::Clipboard
so it's a Glib::Object at heart, and Gtk2::Clipboard is the glow-up. β¨
π METHODS π
okay this is the main character section, buckle up. π
π $clipboard->set_can_store (...)
...β a (list) ofGtk2::TargetEntry's. give it as many as your heart desires.
Since: gtk+ 2.6
π $clipboard->clear
just. wipes it. clears the clipboard. no args, no drama, no notes. π§Ή
π display = $clipboard->get_display
hands you the display back. that's the whole thing.
Since: gtk+ 2.2
π clipboard = Gtk2::Clipboard->get_for_display ($display, $selection)
the class-method girlies, we love to see it:
$displayβ aGtk2::Gdk::Display$selectionβ aGtk2::Gdk::Atom
Since: gtk+ 2.2
π clipboard = Gtk2::Clipboard->get ($selection)
$selectionβ aGtk2::Gdk::Atom
another class method! grab the clipboard for that selection. slay.
π $clipboard->set_image ($pixbuf)
$pixbufβ aGtk2::Gdk::Pixbuf
drop an image on the clipboard. pictures?? on MY clipboard?? it's more likely than you think. πΈ
Since: gtk+ 2.6
π object = $clipboard->get_owner
who owns this clipboard rn?? this tells you. mystery solved. π
π $clipboard->request_contents ($target, $callback, $user_data=undef)
$targetβ aGtk2::Gdk::Atom$callbackβ (scalar)$user_dataβ (scalar), defaults toundef
π $clipboard->request_image ($callback, $user_data=undef)
$callbackβ (scalar)$user_dataβ (scalar), defaults toundef
Since: gtk+ 2.6
π $clipboard->request_rich_text ($buffer, $callback, $user_data=undef)
$bufferβ aGtk2::TextBuffer$callbackβ (scalar)$user_dataβ (scalar), defaults toundef
rich text bestie, we're fancy now. π
Since: gtk+ 2.10
π $clipboard->request_targets ($callback, $user_data=undef)
$callbackβ (scalar)$user_dataβ (scalar), defaults toundef
Since: gtk+ 2.4
π $clipboard->request_text ($callback, $user_data=undef)
$callbackβ (scalar)$user_dataβ (scalar), defaults toundef
π $clipboard->request_uris ($func, $data=undef)
$funcβ (scalar)$dataβ (scalar), defaults toundef
note the arg names on this one β $func and $data, not $callback and $user_data. she's different like that. π
Since: gtk+ 2.14
π $clipboard->store
store it. that's the method. that's what it does.
Since: gtk+ 2.6
π $clipboard->set_text ($text)
$textβ (string)
plain old text onto the clipboard. the classic. the original recipe. π
π selectiondata or undef = $clipboard->wait_for_contents ($target)
$targetβ aGtk2::Gdk::Atom
returns selectiondata, or undef if there's nothing. so check before you use it, bestie!! π
π pixbuf or undef = $clipboard->wait_for_image
pixbuf, or undef. again with the undef jumpscare.
Since: gtk+ 2.6
π list = $clipboard->wait_for_rich_text ($buffer)
$bufferβ aGtk2::TextBuffer
Since: gtk+ 2.10
π list = $clipboard->wait_for_targets
Returns a list of GdkAtom's. plural. multiple atoms. a whole group chat of atoms. π
Since: gtk+ 2.4
π string = $clipboard->wait_for_text
just gives you the string. no undef disclaimer here, so live your truth.
π scalar = $clipboard->wait_for_uris
Since: gtk+ 2.14
π boolean = $clipboard->wait_is_image_available
true or false, is there an image waiting for you. vibe check, but for images. πΌοΈ
Since: gtk+ 2.6
π boolean = $clipboard->wait_is_rich_text_available ($buffer)
$bufferβ aGtk2::TextBuffer
Since: gtk+ 2.10
π boolean = $clipboard->wait_is_target_available ($target)
$targetβ aGtk2::Gdk::Atom
Since: gtk+ 2.6
π boolean = $clipboard->wait_is_text_available
is there text?? boolean says yes or no. the suspense, honestly.
π boolean = $clipboard->wait_is_uris_available
Since: gtk+ 2.14
π boolean = $clipboard->set_with_data ($get_func, $clear_func, $user_data, ...)
the full lineup, no skipping:
$get_funcβ (scalar)$clear_funcβ (scalar)$user_dataβ (scalar)...β a (list) ofGtk2::TargetEntry's
π boolean = $clipboard->set_with_owner ($get_func, $clear_func, $owner, ...)
same energy, but with an owner this time:
$get_funcβ (scalar)$clear_funcβ (scalar)$ownerβ aGlib::Object...β a (list) ofGtk2::TargetEntry's
β¨ SIGNALS β¨
owner-changeβ signature is (Gtk2::Clipboard,Gtk2::Gdk::Event)
so when the clipboard owner changes, you get a whole event about it. main character notification energy. π
π SEE ALSO π
go read these too, they're part of the lore:
Gtk2Glib::Object
π COPYRIGHT π
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
and that's the whole page, bestie!! this was documented by the perl crew, perl v5.42.0, dated 2025-07-25 β go forth and paste responsibly π
β¨π¦
π¦ where this page comes from
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms