<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="topic" id="notification" xml:lang="zh_CN">
  <info>
    <link type="guide" xref="index#dialogs"/>
    <desc>使用 <cmd>--notification</cmd> 选项。</desc>
    <include xmlns="http://www.w3.org/2001/XInclude" href="legal.xml"/>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>TeliuTe</mal:name>
      <mal:email>teliute@163.com</mal:email>
      <mal:years>2010</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>tuhaihe</mal:name>
      <mal:email>1132321739qq@gmail.com</mal:email>
      <mal:years>2012</mal:years>
    </mal:credit>
  </info>
  <title>通知区域图标</title>
    <p>使用 <cmd>--notification</cmd> 选项创建一个被动桌面通知。</p>

  <terms>
    <item>
      <title><cmd>--text</cmd>=<var>文本</var></title>
      <p>指定在通知区域显示的文本。</p>
    </item>
    <item>
      <title><cmd>--icon</cmd>=<var>路径</var></title>
      <p>使用包含系统上有效图标路径的字符串设置通知图标。</p>
    </item>
    <item>
      <title><cmd>--listen</cmd></title>
      <p>监听标准输入的命令。必须至少指定一个命令。命令以逗号分隔。命令后面必须跟有冒号和值。</p>
      <note style="tip">
        <p><cmd>icon</cmd> 命令还接受符合 FreeDesktop.org 图标命名规范的图标主题名称值，例如 <var>dialog-error</var>、<var>dialog-information</var> 和 <var>security-high</var>。</p>
      </note>
      <p>示例包括：</p>
      <code>
      message: 你好，我的名字是 Joe
      icon: /usr/share/pixmaps/monitor.xpm
      </code>
    </item>
  </terms>

  <p>下面的脚本示范了如何创建一个通知区域图标：</p>
  <code>
  #!/bin/sh

  zenity --notification \
    --icon="/usr/share/pixmaps/monitor.xpm" \
    --text="系统有必要的更新！"
  </code>

  <figure>
    <title>通知区域图标范例</title>
    <desc><app>Zenity</app> 通知图标范例</desc>
    <media type="image" mime="image/png" src="figures/zenity-notification-screenshot.png"/>
  </figure>

  <p>下面的脚本示范了如何创建一个包含 <cmd>--listen</cmd> 选项的通知区域图标：</p>
  <code>
  #!/bin/sh
  cat &lt;&lt;EOH| zenity --notification --listen
  message: this is the message text
  EOH
  </code>

  <figure>
    <title>包含<cmd>--listen</cmd>选项的通知区域图标范例</title>
    <desc>包含<cmd>--listen</cmd>选项的<app>Zenity</app> 通知图标范例</desc>
    <media type="image" mime="image/png" src="figures/zenity-notification-listen-screenshot.png"/>
  </figure>

</page>
