Gtk2::Notify(3)

πŸ“¦
version 0.05 Β· 2 versions
, in fedora 43

🌸 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 -init option, it wants one extra argument: the application name you're gonna use. literally equivalent to Gtk2::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 : default undef : readable / writable) β€” the application icon to use for this notification, either as a filename or an icon theme-compliant name.
  • 'app-name' (string : default undef : readable / writable) β€” the application name to use for this notification.
  • 'body' (string : default undef : 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 : default undef : readable / writable / construct) β€” the icon filename or icon theme-compliant name.
  • 'id' (integer : default 0 : readable / writable / construct) β€” the notification ID.
  • 'summary' (string : default undef : 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 (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