Gtk2::Notify(3)
πΈ Gtk2::Notify π
okay bestie, gather round, because we're talking about Gtk2::Notify β the Perl interface to libnotify. yes, that libnotify. the one that pops those little toast notifications on your desktop. it's giving main character energy and honestly? iconic. π
β¨ HIERARCHY β¨
the family tree, and it's a short one:
Glib::Object
+----Gtk2::Notify
so it inherits from Glib::Object and that's the whole bloodline. no cap. π
π¦ SYNOPSIS π¦
here's the vibe, copy-paste it and go:
use Gtk2::Notify -init, "app_name";
my $notification = Gtk2::Notify->new(
$summary,
$message,
$icon,
$attach_widget
);
$notification->show;
π INITIALISATION π
use Gtk2::Notify qw/-init app_name/;
-initβ so if you import Gtk2::Notify with the-initoption, it wants one extra argument: the application name you're gonna use. literally equivalent toGtk2::Notify->init($app_name). same thing, different font. β¨
π METHODS π
this is the good part. buckle up. π«Ά
notify = Gtk2::Notify->new ($summary, $body=undef, $icon=undef)
makes you a brand new notification, slay.
$summary(string)$body(string)$icon(string)
$notification->add_action ($action, $label, $callback, $userdata=undef)
adds an action button, because notifications with buttons >>>
$action(string)$label(string)$callback(scalar)$userdata(scalar)
string = Gtk2::Notify->get_app_name
hands you back the app name as a string. periodt.
$notification->set_category ($category)
$category(string)
$notification->clear_actions
yeets all the actions. gone. π
$notification->clear_hints
same energy but for hints.
notify = $notification->close
closes the notification, and gives you a notify back.
$notification->set_hint_byte_array ($key, $value)
$key(string)$value((unknown))
$notification->set_hint_byte ($key, $value)
$key(string)$value(Glib::UChar)
$notification->set_hint_double ($key, $value)
$key(string)$value(double)
$notification->set_hint_int32 ($key, $value)
$key(string)$value(integer)
$notification->set_hint ($key, $value)
$key(string)$value(scalar)
$notification->set_hint_string ($key, $value)
$key(string)$value(string)
$notification->set_icon_from_pixbuf ($icon)
$icon(Gtk2::Gdk::Pixbuf)
boolean = Gtk2::Notify->init ($app_name)
$app_name(string)
boolean = Gtk2::Notify->is_initted
tells you whether we've been initted yet. yes the spelling is is_initted, no we are not fixing it, it's canon. π
list = Gtk2::Notify->get_server_caps
gives you a list of what the server can do. the vibe check, basically.
(notify, name, vendor, version, spec_version) = Gtk2::Notify->get_server_info
returns a whole little squad of values: notify, name, vendor, version, and spec_version. five for the price of one, we love a bundle. π
notify = $notification->show
the moment. this is what actually makes the notification appear. showtime bestie. β
$notification->set_timeout ($timeout)
$timeout(integer)
Gtk2::Notify->uninit
packs it all up and goes home.
boolean = $notification->update ($summary, $message=undef, $icon=undef)
$summary(string)$message(string)$icon(string)
$notification->set_urgency ($urgency)
$urgency(Gtk2::Notify::NotifyUrgency)
π PROPERTIES π
every property, in all its glory, no skips:
'app-icon'(string: defaultundef: readable / writable) β the application icon to use for this notification, either as a filename or an icon theme-compliant name.'app-name'(string: defaultundef: readable / writable) β the application name to use for this notification.'body'(string: defaultundef: readable / writable / construct) β the message body text.'closed-reason'(integer: default-1: readable) β the reason code for why the notification was closed.'icon-name'(string: defaultundef: readable / writable / construct) β the icon filename or icon theme-compliant name.'id'(integer: default0: readable / writable / construct) β the notification ID.'summary'(string: defaultundef: readable / writable / construct) β the summary text.
π₯ SIGNALS π₯
closed(Gtk2::Notify)
that's the one. it fires when the notification gets closed. iykyk.
π ENUMS AND FLAGS π
enum Gtk2::Notify::NotifyUrgency
'low'/'NOTIFY_URGENCY_LOW''normal'/'NOTIFY_URGENCY_NORMAL''critical'/'NOTIFY_URGENCY_CRITICAL'
low, normal, critical β the whole urgency spectrum. pick your fighter. π
π BUGS π
found a bug or want a feature? please report it to bug-gtk2-notify at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Gtk2-Notify. i will be notified, and then you'll automatically be notified of progress on your bug as i make changes. so like, a whole notification chain. very on brand for this module honestly. π¦
π SUPPORT π
you can find documentation for this module with the perldoc command:
perldoc Gtk2::Notify
you can also look for information at:
- AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Gtk2-Notify
- CPAN Ratings
http://cpanratings.perl.org/d/Gtk2-Notify
- RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Gtk2-Notify
- Search CPAN
http://search.cpan.org/dist/Gtk2-Notify
π SEE ALSO π
Gtk2::Notify, Glib::Object
π COPYRIGHT π
Copyright (C) 2006-2008 by Florian Ragwitz
and that's the whole page bestie, we ate and left no crumbs π this lil masterpiece was brought to you by perl v5.42.0 on 2025-07-25, mwah, go forth and notify β¨π
π¦ where this page comes from
- fedora 43: perl-Gtk2-Notify 0.05-58.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms