1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336
|
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<article id="index">
<articleinfo>
<title>Desktop Notifications Specification</title>
<releaseinfo>Version 1.2</releaseinfo>
<date>28 October 2010</date>
<authorgroup>
<author>
<firstname>Mike</firstname>
<surname>Hearn</surname>
<affiliation>
<address>
<email>mike@navi.cx</email>
</address>
</affiliation>
</author>
<author>
<firstname>Christian</firstname>
<surname>Hammond</surname>
<affiliation>
<address>
<email>chipx86@chipx86.com</email>
</address>
</affiliation>
</author>
<author>
<firstname>William Jon</firstname>
<surname>McCann</surname>
<affiliation>
<address>
<email>jmccann@redhat.com</email>
</address>
</affiliation>
</author>
</authorgroup>
</articleinfo>
<sect1 id="introduction">
<title>Introduction</title>
<para>
This is a draft standard for a desktop notifications service,
through which applications can generate passive popups to notify
the user in an asynchronous manner of events.
</para>
<para>
This specification explicitly does not include other types of
notification presentation such as modal message boxes, window manager
decorations or window list annotations.
</para>
<para>
Example use cases include:
</para>
<itemizedlist>
<listitem><para>Messages from chat programs</para> </listitem>
<listitem><para>Scheduled alarm</para></listitem>
<listitem><para>Completed file transfer</para></listitem>
<listitem><para>New mail notification</para></listitem>
<listitem><para>Low disk space/battery warnings</para></listitem>
</itemizedlist>
</sect1>
<sect1 id="basic-design">
<title>Basic Design</title>
<para>
In order to ensure that multiple notifications can easily be
displayed at once, and to provide a convenient implementation, all
notifications are controlled by a single session-scoped service which
exposes a D-BUS interface.
</para>
<para>
On startup, a conforming implementation should take the
<literal>org.freedesktop.Notifications</literal> service on
the session bus. This service will be referred to as the "notification
server" or just "the server" in this document. It can optionally be
activated automatically by the bus process, however this is not required
and notification server clients must not assume that it is available.
</para>
<para>
The server should implement the
<literal>org.freedesktop.Notifications</literal> interface on
an object with the path <literal>"/org/freedesktop/Notifications"</literal>.
This is the only interface required by this version of the specification.
</para>
<para>
A notification has the following components:
</para>
<table>
<title>Notification Components</title>
<tgroup cols="2">
<thead>
<row>
<entry>Component</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>Application Name</entry>
<entry>
This is the optional name of the application sending the notification.
This should be the application's formal name, rather than some sort
of ID. An example would be "FredApp E-Mail Client," rather than
"fredapp-email-client."
</entry>
</row>
<row>
<entry>Replaces ID</entry>
<entry>
An optional ID of an existing notification that this
notification is intended to replace.
</entry>
</row>
<row>
<entry>Notification Icon</entry>
<entry>
The notification icon. See <xref linkend="icons-and-images-formats"/>.
</entry>
</row>
<row>
<entry>Summary</entry>
<entry>
This is a single line overview of the notification. For instance,
"You have mail" or "A friend has come online". It should generally
not be longer than 40 characters, though this is not a requirement,
and server implementations should word wrap if necessary. The summary
must be encoded using UTF-8.
</entry>
</row>
<row>
<entry>Body</entry>
<entry>
<para>
This is a multi-line body of text. Each line is a paragraph, server
implementations are free to word wrap them as they see fit.
</para>
<para>
The body may contain simple markup as specified in
<xref linkend="markup"/>. It must be encoded using UTF-8.
</para>
<para>
If the body is omitted, just the summary is displayed.
</para>
</entry>
</row>
<row>
<entry>Actions</entry>
<entry>
<para>
The actions send a request message back to the notification client
when invoked. This functionality may not be implemented by the
notification server, conforming clients should check if it is available
before using it (see the GetCapabilities message in
<xref linkend="protocol"/>). An implementation is free to ignore any
requested by the client. As an example one possible rendering of
actions would be as buttons in the notification popup.
</para>
<para>
Actions are sent over as a list of pairs. Each even element in the
list (starting at index 0) represents the identifier for the action.
Each odd element in the list is the localized string that will be
displayed to the user.
</para>
<para>
The default action (usually invoked my clicking the notification)
should have a key named <literal>"default"</literal>. The name can
be anything, though implementations are free not to display it.
</para>
</entry>
</row>
<row>
<entry>Hints</entry>
<entry>
<para>
Hints are a way to provide extra data to a notification server that
the server may be able to make use of.
</para>
<para>See <xref linkend="hints"/> for a list of available hints.</para>
</entry>
</row>
<row>
<entry>Expiration Timeout</entry>
<entry>
<para>
The timeout time in milliseconds since the display of the notification
at which the notification should automatically close.
</para>
<para>
If -1, the notification's expiration time is dependent on the
notification server's settings, and may vary for the type of
notification.
</para>
<para>
If 0, the notification never expires.
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Each notification displayed is allocated a unique ID by the server.
This is unique within the session. While the notification server is
running, the ID will not be recycled unless the capacity of a uint32 is
exceeded.
</para>
<para>
This can be used to hide the notification before the expiration timeout
is reached. It can also be used to atomically replace the notification
with another. This allows you to (for instance) modify the contents of
a notification while it's on-screen.
</para>
</sect1>
<sect1 id="backwards-compat" xreflabel="Backwards Compatibility">
<title>Backwards Compatibility</title>
<para>
Clients should try and avoid making assumptions about the presentation and
abilities of the notification server. The message content is the most
important thing.
</para>
<para>
Clients can check with the server what capabilities are supported
using the <literal>GetCapabilities</literal> message. See
<xref linkend="protocol"/>.
</para>
<para>
If a client requires a response from a passive popup, it should be
coded such that a non-focus-stealing message box can be used in the
case that the notification server does not support this feature.
</para>
</sect1>
<sect1 id="markup" xreflabel="Markup">
<title>Markup</title>
<para>
Body text may contain markup. The markup is XML-based, and consists
of a small subset of HTML along with a few additional tags.
</para>
<para>
The following tags should be supported by the notification server.
Though it is optional, it is recommended. Notification servers that do
not support these tags should filter them out.
</para>
<informaltable>
<tgroup cols="2">
<tbody valign="top">
<row>
<entry>
<sgmltag class="starttag">b</sgmltag> ...
<sgmltag class="endtag">b</sgmltag>
</entry>
<entry>Bold</entry>
</row>
<row>
<entry>
<sgmltag class="starttag">i</sgmltag> ...
<sgmltag class="endtag">i</sgmltag>
</entry>
<entry>Italic</entry>
</row>
<row>
<entry>
<sgmltag class="starttag">u</sgmltag> ...
<sgmltag class="endtag">u</sgmltag>
</entry>
<entry>Underline</entry>
</row>
<row>
<entry>
<sgmltag class="starttag">a href="..."</sgmltag> ...
<sgmltag class="endtag">a</sgmltag>
</entry>
<entry>Hyperlink</entry>
</row>
<row>
<entry>
<sgmltag class="emptytag">img src="..." alt="..."</sgmltag>
</entry>
<entry>Image</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
A full-blown HTML implementation is not required of this spec, and
notifications should never take advantage of tags that are not listed
above. As notifications are not a substitute for web browsers or complex
dialogs, advanced layout is not necessary, and may in fact limit the
number of systems that notification services can run on, due to memory
usage and screen space. Such examples are PDAs, certain cell phones, and
slow PCs or laptops with little memory.
</para>
<para>
For the same reason, a full XML or XHTML implementation using XSLT or
CSS stylesheets is not part of this specification. Information that
must be presented in a more complex form should use an application-specific
dialog, a web browser, or some other display mechanism.
</para>
<para>
The tags specified above mark up the content in a way that allows them
to be stripped out on some implementations without impacting the actual
content.
</para>
<sect2 id="hyperlinks" xreflabel="Hyperlinks">
<title>Hyperlinks</title>
<para>
Hyperlinks allow for linking one or more words to a URI. There is no
requirement to allow for images to be linked, and it is highly suggested
that implementations do not allow this, as there is no clean-looking,
standard visual indicator for a hyperlinked image.
</para>
<para>
Hyperlinked text should appear in the standard blue underline format.
</para>
<para>
Hyperlinks cannot function as a replacement for actions. They are
used to link to local directories or remote sites using standard URI
schemes.
</para>
<para>
Implementations are not required to support hyperlinks.
</para>
</sect2>
<sect2 id="images" xreflabel="Images">
<title>Images</title>
<para>
Images may be placed in the notification, but this should be done with
caution. The image should never exceed 200x100, but this should be thought
of as a maximum size. Images should always have alternative text
provided through the <literal>alt="..."</literal> attribute.
</para>
<para>
Image data cannot be embedded in the message itself. Images referenced
must always be local files.
</para>
<para>
Implementations are not required to support images.
</para>
</sect2>
</sect1>
<sect1 id="icons-and-images" xreflabel="Icons and Images">
<title>Icons and Images</title>
<para>
A notification can optionally have an associated icon and/or image.
</para>
<para>
The icon is defined by the "app_icon" parameter.
The image can be defined by the "image-path", the "image-data" hint or the
deprecated "icon_data" hint.
</para>
<sect2>
<title>Priorities</title>
<para>
An implementation which only displays one image or icon must choose which one
to display using the following order:
<orderedlist>
<listitem><para>"image-data"</para></listitem>
<listitem><para>"image-path"</para></listitem>
<listitem><para>app_icon parameter</para></listitem>
<listitem><para>for compatibility reason, "icon_data"</para></listitem>
</orderedlist>
</para>
<para>
An implementation which can display both the image and icon must show the
icon from the "app_icon" parameter and choose which image to display using
the following order:
<orderedlist>
<listitem><para>"image-data"</para></listitem>
<listitem><para>"image-path"</para></listitem>
<listitem><para>for compatibility reason, "icon_data"</para></listitem>
</orderedlist>
</para>
</sect2>
<sect2 id="icons-and-images-formats" xreflabel="Icons and Images Formats">
<title>Formats</title>
<para>
The "image-data" and "icon_data" hints should be a DBus structure
of signature (iiibiiay). The components of this structure are as follows:
<orderedlist>
<listitem><para>width (i): Width of image in pixels</para></listitem>
<listitem><para>height (i): Height of image in pixels</para></listitem>
<listitem><para>rowstride (i): Distance in bytes between row starts</para></listitem>
<listitem><para>has_alpha (b): Whether the image has an alpha channel</para></listitem>
<listitem><para>bits_per_sample (i): Must always be 8</para></listitem>
<listitem><para>channels (i): If has_alpha is TRUE, must be 4, otherwise 3</para></listitem>
<listitem><para>data (ay): The image data, in RGB byte order</para></listitem>
</orderedlist>
This image format is derived from <ulink url="http://developer.gnome.org/gdk-pixbuf/stable/">gdk-pixbuf</ulink>.
</para>
<para>
The "app_icon" parameter and "image-path" hint should be either an URI
(file:// is the only URI schema supported right now) or a name in a
freedesktop.org-compliant icon theme (not a GTK+ stock ID).
</para>
</sect2>
</sect1>
<sect1 id="categories" xreflabel="Categories">
<title>Categories</title>
<para>
Notifications can optionally have a type indicator. Although neither
client or nor server must support this, some may choose to. Those servers
implementing categories may use them to intelligently display
the notification in a certain way, or group notifications of similar
types.
</para>
<para>
Categories are in
<literal><replaceable>class.specific</replaceable></literal> form.
<literal>class</literal> specifies the generic type of notification, and
<literal>specific</literal> specifies the more specific type of
notification.
</para>
<para>
If a specific type of notification does not exist for your notification,
but the generic kind does, a notification of type
<literal><replaceable>class</replaceable></literal> is acceptable.
</para>
<para>
Third parties, when defining their own categories, should discuss
the possibility of standardizing on the hint with other parties, preferably
in a place such as the
<ulink url="http://freedesktop.org/mailman/listinfo/xdg">xdg</ulink>
mailing list at
<ulink url="http://freedesktop.org/">freedesktop.org</ulink>. If it
warrants a standard, it will be added to the table above. If no
consensus is reached, the category should be in the form of
"<literal>x-<replaceable>vendor</replaceable>.<replaceable>class</replaceable>.<replaceable>name</replaceable></literal>."
</para>
<para>
The following table lists standard notifications as defined by this spec.
More will be added in time.
</para>
<table>
<title>Categories</title>
<tgroup cols="2">
<thead>
<row>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><literal>"device"</literal></entry>
<entry>
A generic device-related notification that doesn't fit into
any other category.
</entry>
</row>
<row>
<entry><literal>"device.added"</literal></entry>
<entry>A device, such as a USB device, was added to the system.</entry>
</row>
<row>
<entry><literal>"device.error"</literal></entry>
<entry>A device had some kind of error.</entry>
</row>
<row>
<entry><literal>"device.removed"</literal></entry>
<entry>
A device, such as a USB device, was removed from the system.
</entry>
</row>
<row>
<entry><literal>"email"</literal></entry>
<entry>
A generic e-mail-related notification that doesn't fit into any
other category.
</entry>
</row>
<row>
<entry><literal>"email.arrived"</literal></entry>
<entry>A new e-mail notification.</entry>
</row>
<row>
<entry><literal>"email.bounced"</literal></entry>
<entry>A notification stating that an e-mail has bounced.</entry>
</row>
<row>
<entry><literal>"im"</literal></entry>
<entry>
A generic instant message-related notification that doesn't fit
into any other category.
</entry>
</row>
<row>
<entry><literal>"im.error"</literal></entry>
<entry>An instant message error notification.</entry>
</row>
<row>
<entry><literal>"im.received"</literal></entry>
<entry>A received instant message notification.</entry>
</row>
<row>
<entry><literal>"network"</literal></entry>
<entry>
A generic network notification that doesn't fit into any other
category.
</entry>
</row>
<row>
<entry><literal>"network.connected"</literal></entry>
<entry>
A network connection notification, such as successful sign-on to a
network service. This should not be confused with
<literal>device.added</literal> for new network devices.
</entry>
</row>
<row>
<entry><literal>"network.disconnected"</literal></entry>
<entry>
A network disconnected notification. This should not be confused with
<literal>device.removed</literal> for disconnected network devices.
</entry>
</row>
<row>
<entry><literal>"network.error"</literal></entry>
<entry>
A network-related or connection-related error.
</entry>
</row>
<row>
<entry><literal>"presence"</literal></entry>
<entry>
A generic presence change notification that doesn't fit into
any other category, such as going away or idle.
</entry>
</row>
<row>
<entry><literal>"presence.offline"</literal></entry>
<entry>An offline presence change notification.</entry>
</row>
<row>
<entry><literal>"presence.online"</literal></entry>
<entry>An online presence change notification.</entry>
</row>
<row>
<entry><literal>"transfer"</literal></entry>
<entry>
A generic file transfer or download notification that doesn't fit
into any other category.
</entry>
</row>
<row>
<entry><literal>"transfer.complete"</literal></entry>
<entry>A file transfer or download complete notification.</entry>
</row>
<row>
<entry><literal>"transfer.error"</literal></entry>
<entry>A file transfer or download error.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="urgency-levels" xreflabel="Urgency Levels">
<title>Urgency Levels</title>
<para>
Notifications have an urgency level associated with them. This defines
the importance of the notification. For example, "Joe Bob signed on"
would be a low urgency. "You have new mail" or "A USB device was unplugged"
would be a normal urgency. "Your computer is on fire" would be a critical
urgency.
</para>
<para>Urgency levels are defined as follows:</para>
<table>
<title>Urgency Levels</title>
<tgroup cols="2">
<thead>
<row>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry>0</entry>
<entry>Low</entry>
</row>
<row>
<entry>1</entry>
<entry>Normal</entry>
</row>
<row>
<entry>2</entry>
<entry>Critical</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Developers must use their own judgement when deciding the urgency of a
notification. Typically, if the majority of programs are using the same
level for a specific type of urgency, other applications should follow
them.
</para>
<para>
For low and normal urgencies, server implementations may display the
notifications how they choose. They should, however, have a sane
expiration timeout dependent on the urgency level.
</para>
<para>
Critical notifications should not automatically expire, as they are
things that the user will most likely want to know about. They should
only be closed when the user dismisses them, for example, by clicking on
the notification.
</para>
</sect1>
<sect1 id="hints" xreflabel="Hints">
<title>Hints</title>
<para>
Hints are a way to provide extra data to a notification server that
the server may be able to make use of.
</para>
<para>
Neither clients nor notification servers are required to support any
hints. Both sides should assume that hints are not passed, and should
ignore any hints they do not understand.
</para>
<para>
Third parties, when defining their own hints, should discuss the
possibility of standardizing on the hint with other parties, preferably
in a place such as the
<ulink url="http://freedesktop.org/mailman/listinfo/xdg">xdg</ulink>
mailing list at
<ulink url="http://freedesktop.org/">freedesktop.org</ulink>. If it
warrants a standard, it will be added to the table above. If no
consensus is reached, the hint name should be in the form of
<literal>"x-<replaceable>vendor</replaceable>-<replaceable>name</replaceable>."</literal>
</para>
<para>
The value type for the hint dictionary in D-BUS is of the
<literal>DBUS_TYPE_VARIANT</literal> container type. This allows different
data types (string, integer, boolean, etc.) to be used for hints. When
adding a dictionary of hints, this type must be used, rather than putting
the actual hint value in as the dictionary value.
</para>
<para>
The following table lists the standard hints as defined by this
specification. Future hints may be proposed and added to this list
over time. Once again, implementations are not required to support these.
</para>
<table>
<title>Standard Hints</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Value Type</entry>
<entry>Description</entry>
<entry>Spec Version</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><literal>"action-icons"</literal></entry>
<entry>BOOLEAN</entry>
<entry>
When set, a server that has the "action-icons" capability will
attempt to interpret any action identifier as a named icon.
The localized display name will be used to annotate the icon
for accessibility purposes. The icon name should be compliant
with the Freedesktop.org Icon Naming Specification.
</entry>
<entry>>= 1.2</entry>
</row>
<row>
<entry><literal>"category"</literal></entry>
<entry>STRING</entry>
<entry>
The type of notification this is.
</entry>
<entry/>
</row>
<row>
<entry><literal>"desktop-entry"</literal></entry>
<entry>STRING</entry>
<entry>
This specifies the name of the desktop filename representing the
calling program. This should be the same as the prefix used for the
application's .desktop file. An example would be "rhythmbox" from
"rhythmbox.desktop". This can be used by the daemon to retrieve the
correct icon for the application, for logging purposes, etc.
</entry>
<entry/>
</row>
<row>
<entry><literal>"image-data"</literal></entry>
<entry>(iiibiiay)</entry>
<entry>
This is a raw data image format which describes the width, height,
rowstride, has alpha, bits per sample, channels and image data
respectively.
</entry>
<entry>>= 1.2</entry>
</row>
<row>
<entry><literal>"image_data"</literal></entry>
<entry>(iiibiiay)</entry>
<entry>
<emphasis>Deprecated</emphasis>. Use image-data instead.
</entry>
<entry>= 1.1</entry>
</row>
<row>
<entry><literal>"image-path"</literal></entry>
<entry>STRING</entry>
<entry>
Alternative way to define the notification image. See <xref linkend="icons-and-images"/>.
</entry>
<entry>>= 1.2</entry>
</row>
<row>
<entry><literal>"image_path"</literal></entry>
<entry>STRING</entry>
<entry>
<emphasis>Deprecated</emphasis>. Use image-path instead.
</entry>
<entry>= 1.1</entry>
</row>
<row>
<entry><literal>"icon_data"</literal></entry>
<entry>(iiibiiay)</entry>
<entry>
<emphasis>Deprecated</emphasis>. Use image-data instead.
</entry>
<entry>< 1.1</entry>
</row>
<row>
<entry><literal>"resident"</literal></entry>
<entry>BOOLEAN</entry>
<entry>
When set the server will not automatically remove the
notification when an action has been invoked. The notification
will remain resident in the server until it is explicitly
removed by the user or by the sender. This hint is likely only
useful when the server has the "persistence" capability.
</entry>
<entry>>= 1.2</entry>
</row>
<row>
<entry><literal>"sound-file"</literal></entry>
<entry>STRING</entry>
<entry>
The path to a sound file to play when the notification pops up.
</entry>
<entry/>
</row>
<row>
<entry><literal>"sound-name"</literal></entry>
<entry>STRING</entry>
<entry>
A themeable named sound from the freedesktop.org
<ulink url="http://0pointer.de/public/sound-naming-spec.html">sound naming specification</ulink>
to play when the notification pops up. Similar to icon-name, only for
sounds. An example would be "message-new-instant".
</entry>
<entry/>
</row>
<row>
<entry><literal>"suppress-sound"</literal></entry>
<entry>BOOLEAN</entry>
<entry>
Causes the server to suppress playing any sounds, if it has that
ability. This is usually set when the client itself is going to
play its own sound.
</entry>
<entry/>
</row>
<row>
<entry><literal>"transient"</literal></entry>
<entry>BOOLEAN</entry>
<entry>
When set the server will treat the notification as transient
and by-pass the server's persistence capability, if it should
exist.
</entry>
<entry>>= 1.2</entry>
</row>
<row>
<entry><literal>"x"</literal></entry>
<entry>INT32</entry>
<entry>
Specifies the X location on the screen that the notification should
point to. The <literal>"y"</literal> hint must also be specified.
</entry>
<entry/>
</row>
<row>
<entry><literal>"y"</literal></entry>
<entry>INT32</entry>
<entry>
Specifies the Y location on the screen that the notification should
point to. The <literal>"x"</literal> hint must also be specified.
</entry>
<entry/>
</row>
<row>
<entry><literal>"urgency"</literal></entry>
<entry>BYTE</entry>
<entry>
The urgency level.
</entry>
<entry/>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="protocol" xreflabel="Protocol">
<title>D-BUS Protocol</title>
<para>
The following messages <emphasis>must</emphasis> be supported by all
implementations.
</para>
<sect2 id="commands">
<title>Message commands</title>
<sect3 id="command-get-capabilities">
<title><literal>org.freedesktop.Notifications.GetCapabilities</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>as
<function>org.freedesktop.Notifications.GetCapabilities</function>
</funcdef>
<void/>
</funcprototype>
</funcsynopsis>
<para>
This message takes no parameters.
</para>
<para>
It returns an array of strings. Each string describes an optional
capability implemented by the server. The following values are
defined by this spec:
</para>
<table>
<title>Server Capabilities</title>
<tgroup cols="2">
<tbody valign="top">
<row>
<entry><literal>"action-icons"</literal></entry>
<entry>
Supports using icons instead of text for displaying actions.
Using icons for actions must be enabled on a per-notification
basis using the "action-icons" hint.
</entry>
</row>
<row>
<entry><literal>"actions"</literal></entry>
<entry>
The server will provide the specified actions to the user. Even if
this cap is missing, actions may still be specified by the client,
however the server is free to ignore them.
</entry>
</row>
<row>
<entry><literal>"body"</literal></entry>
<entry>
Supports body text. Some implementations may only show the
summary (for instance, onscreen displays, marquee/scrollers)
</entry>
</row>
<row>
<entry><literal>"body-hyperlinks"</literal></entry>
<entry>
The server supports hyperlinks in the notifications.
</entry>
</row>
<row>
<entry><literal>"body-images"</literal></entry>
<entry>
The server supports images in the notifications.
</entry>
</row>
<row>
<entry><literal>"body-markup"</literal></entry>
<entry>
Supports markup in the body text. If marked up text is sent
to a server that does not give this cap, the markup will show
through as regular text so must be stripped clientside.
</entry>
</row>
<row>
<entry><literal>"icon-multi"</literal></entry>
<entry>
The server will render an animation of all the frames in a given
image array. The client may still specify multiple frames even if
this cap and/or <literal>"icon-static"</literal> is missing, however
the server is free to ignore them and use only the primary frame.
</entry>
</row>
<row>
<entry><literal>"icon-static"</literal></entry>
<entry>
Supports display of exactly 1 frame of any given image array.
This value is mutually exclusive with
<literal>"icon-multi"</literal>, it is a protocol error for the
server to specify both.
</entry>
</row>
<row>
<entry><literal>"persistence"</literal></entry>
<entry>
The server supports persistence of notifications.
Notifications will be retained until they are acknowledged or
removed by the user or recalled by the sender. The presence
of this capability allows clients to depend on the server to
ensure a notification is seen and eliminate the need for
the client to display a reminding function (such as a status
icon) of its own.
</entry>
</row>
<row>
<entry><literal>"sound"</literal></entry>
<entry>
The server supports sounds on notifications. If returned, the
server must support the <literal>"sound-file"</literal> and
<literal>"suppress-sound"</literal> hints.
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
New vendor-specific caps may be specified as long as they start with
<literal>"x-<replaceable>vendor</replaceable>"</literal>. For instance,
<literal>"x-gnome-foo-cap"</literal>. Capability names must not
contain spaces. They are limited to alpha-numeric characters and dashes
(<literal>"-"</literal>).
</para>
</sect3>
<sect3 id="command-notify">
<title><literal>org.freedesktop.Notifications.Notify</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>UINT32
<function>org.freedesktop.Notifications.Notify</function>
</funcdef>
<paramdef>STRING <parameter>app_name</parameter></paramdef>
<paramdef>UINT32 <parameter>replaces_id</parameter></paramdef>
<paramdef>STRING <parameter>app_icon</parameter></paramdef>
<paramdef>STRING <parameter>summary</parameter></paramdef>
<paramdef>STRING <parameter>body</parameter></paramdef>
<paramdef>as <parameter>actions</parameter></paramdef>
<paramdef>a{sv} <parameter>hints</parameter></paramdef>
<paramdef>INT32 <parameter>expire_timeout</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Sends a notification to the notification server.
</para>
<table>
<title>Notify Parameters</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>app_name</parameter></entry>
<entry>STRING</entry>
<entry>
The optional name of the application sending the notification.
Can be blank.
</entry>
</row>
<row>
<entry><parameter>replaces_id</parameter></entry>
<entry>UINT32</entry>
<entry>
The optional notification ID that this notification replaces. The
server must atomically (ie with no flicker or other visual cues)
replace the given notification with this one. This allows clients to
effectively modify the notification while it's active. A value of
value of 0 means that this notification won't replace any
existing notifications.
</entry>
</row>
<row>
<entry><parameter>app_icon</parameter></entry>
<entry>STRING</entry>
<entry>
The optional program icon of the calling application. See <xref linkend="icons-and-images"/>.
Can be an empty string, indicating no icon.
</entry>
</row>
<row>
<entry><parameter>summary</parameter></entry>
<entry>STRING</entry>
<entry>The summary text briefly describing the notification.</entry>
</row>
<row>
<entry><parameter>body</parameter></entry>
<entry>STRING</entry>
<entry>The optional detailed body text. Can be empty.</entry>
</row>
<row>
<entry><parameter>actions</parameter></entry>
<entry>as</entry>
<entry>
Actions are sent over as a list of pairs. Each even element in
the list (starting at index 0) represents the identifier for the
action. Each odd element in the list is the localized string
that will be displayed to the user.
</entry>
</row>
<row>
<entry><parameter>hints</parameter></entry>
<entry>a{sv}</entry>
<entry>
Optional hints that can be passed to the server from the client
program. Although clients and servers should never assume each other
supports any specific hints, they can be used to pass along
information, such as the process PID or window ID, that the server
may be able to make use of. See <xref linkend="hints"/>. Can be
empty.
</entry>
</row>
<row>
<entry><parameter>expire_timeout</parameter></entry>
<entry>INT32</entry>
<entry>
<para>
The timeout time in milliseconds since the display of the notification at
which the notification should automatically close.
</para>
<para>
If -1, the notification's expiration time is dependent on the
notification server's settings, and may vary for the type of
notification.
If 0, never expire.
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
If <parameter>replaces_id</parameter> is 0, the return value is a
UINT32 that represent the notification. It is unique, and will not be
reused unless a <constant>MAXINT</constant> number of notifications
have been generated. An acceptable implementation may just use an
incrementing counter for the ID. The returned ID is always greater than
zero. Servers must make sure not to return zero as an ID.
</para>
<para>
If <parameter>replaces_id</parameter> is not 0, the returned value
is the same value as <parameter>replaces_id</parameter>.
</para>
</sect3>
<sect3 id="command-close-notification">
<title><literal>org.freedesktop.Notifications.CloseNotification</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>void
<function>org.freedesktop.Notifications.CloseNotification</function>
</funcdef>
<paramdef>UINT32 id</paramdef>
</funcprototype>
</funcsynopsis>
<para>
Causes a notification to be forcefully closed and removed from the user's
view. It can be used, for example, in the event that what the
notification pertains to is no longer relevant, or to cancel a
notification with no expiration time.
</para>
<para>
The <literal>NotificationClosed</literal> signal is emitted by this
method.
</para>
<para>
If the notification no longer exists, an empty D-BUS Error message is
sent back.
</para>
</sect3>
<sect3 id="command-get-server-information">
<title><literal>org.freedesktop.Notifications.GetServerInformation</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
void
<function>org.freedesktop.Notifications.GetServerInformation</function>
</funcdef>
<paramdef>out STRING <parameter>name</parameter></paramdef>
<paramdef>out STRING <parameter>vendor</parameter></paramdef>
<paramdef>out STRING <parameter>version</parameter></paramdef>
<paramdef>out STRING <parameter>spec_version</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
This message returns the information on the server. Specifically,
the server name, vendor, and version number.
</para>
<table>
<title>GetServerInformation Return Values</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>name</parameter></entry>
<entry>STRING</entry>
<entry>The product name of the server.</entry>
</row>
<row>
<entry><parameter>vendor</parameter></entry>
<entry>STRING</entry>
<entry>
The vendor name. For example, "KDE," "GNOME,"
"freedesktop.org," or "Microsoft."
</entry>
</row>
<row>
<entry><parameter>version</parameter></entry>
<entry>STRING</entry>
<entry>The server's version number.</entry>
</row>
<row>
<entry><parameter>spec_version</parameter></entry>
<entry>STRING</entry>
<entry>The specification version the server is compliant with.</entry>
</row>
</tbody>
</tgroup>
</table>
</sect3>
</sect2>
<sect2 id="signals">
<title>Signals</title>
<sect3 id="signal-notification-closed">
<title><literal>org.freedesktop.Notifications.NotificationClosed</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
<function>org.freedesktop.Notifications.NotificationClosed</function>
</funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef>
<paramdef>UINT32 <parameter>reason</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
A completed notification is one that has timed out, or has been
dismissed by the user.
</para>
<table>
<title>NotificationClosed Parameters</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>id</parameter></entry>
<entry>UINT32</entry>
<entry>The ID of the notification that was closed.</entry>
</row>
<row>
<entry><parameter>reason</parameter></entry>
<entry>UINT32</entry>
<entry>
<para>The reason the notification was closed.</para>
<para>1 - The notification expired.</para>
<para>2 - The notification was dismissed by the user.</para>
<para>3 - The notification was closed by a call to
<literal>CloseNotification</literal>.</para>
<para>4 - Undefined/reserved reasons.</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The ID specified in the signal is invalidated
<emphasis>before</emphasis> the signal is sent and may not be used
in any further communications with the server.
</para>
</sect3>
<sect3 id="signal-action-invoked">
<title><literal>org.freedesktop.Notifications.ActionInvoked</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
<function>org.freedesktop.Notifications.ActionInvoked</function>
</funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef>
<paramdef>STRING <parameter>action_key</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
This signal is emitted when one of the following occurs:
</para>
<itemizedlist>
<listitem>
<para>
The user performs some global "invoking" action upon a notification.
For instance, clicking somewhere on the notification itself.
</para>
</listitem>
<listitem>
<para>
The user invokes a specific action as specified in the original
Notify request. For example, clicking on an action button.
</para>
</listitem>
</itemizedlist>
<table>
<title>ActionInvoked Parameters</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>id</parameter></entry>
<entry>UINT32</entry>
<entry>
The ID of the notification emitting the ActionInvoked signal.
</entry>
</row>
<row>
<entry><parameter>action_key</parameter></entry>
<entry>STRING</entry>
<entry>
The key of the action invoked. These match the keys sent over
in the list of actions.
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
Clients should not assume the server will generate this signal. Some
servers may not support user interaction at all, or may not support
the concept of being able to "invoke" a notification.
</para>
</note>
</sect3>
<sect3 id="signal-activation-token">
<title><literal>org.freedesktop.Notifications.ActivationToken</literal></title>
<funcsynopsis>
<funcprototype>
<funcdef>
<function>org.freedesktop.Notifications.ActivationToken</function>
</funcdef>
<paramdef>UINT32 <parameter>id</parameter></paramdef>
<paramdef>STRING <parameter>activation_token</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
This signal can be emitted before a <literal>ActionInvoked</literal>
signal. It carries an activation token that can be used to activate a
toplevel.
</para>
<table>
<title>ActivationToken Parameters</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody valign="top">
<row>
<entry><parameter>id</parameter></entry>
<entry>UINT32</entry>
<entry>
The ID of the notification emitting the <literal>ActionInvoked</literal>
signal.
</entry>
</row>
<row>
<entry><parameter>activation_token</parameter></entry>
<entry>STRING</entry>
<entry>
An activation token. This can be either an X11-style startup ID (see
<ulink url="https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt">Startup notification protocol</ulink>)
or a
<ulink url="https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/staging/xdg-activation">Wayland xdg-activation</ulink>
token.
</entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>
Clients should not assume the server will generate this signal. Some
servers may not support user interaction at all, or may not support
the concept of being able to generate an activation token for a
notification.
</para>
</note>
</sect3>
</sect2>
</sect1>
</article>
|