A widget which
displays an icon in the Gnome desktop system tray.
Synopsis
gnocl::statusIcon [-option value...]
Screenshot
Options
-blink boolean (default: 0)
Whether or not the status icon blinks.
-icon percent-string (default: "")
Image to be shown, can be either a
file (prefix "%/") or a stock item (prefix "%#").
- -onActivate string
(default: "")
- Tcl command which is executed if
the Enter is pressed in the entry. Before evaluation the following
percent strings are substituted:
%w widget name
%t text contents of
the entry widget buffer
- -onButtonPress string (default: "")
- Tcl script which is executed if a
mouse button is press inside the widget. Before evaluation the following
percent strings are substituted:
%w widget name
%t type of event. One of buttonPress, button2Press or button3Press
%x x coordinate
%y y coordinate
%b button number
%s state of the buttons and modifiers (bitmask)
- -onButtonRelease string (default: "")
- Tcl script which is executed if a
mouse button is released inside the widget. Before evaluation the
following percent strings are substituted:
%w widget name
%t type of event. One of buttonPress, button2Press or button3Press
%x x coordinate
%y y coordinate
%b button number
%s state of the buttons and modifiers (bitmask)
- -onPopup string
(default: "")
- Tcl script which is executed
prior to
the display of the default popup menu allowing the controlling
script to add items and submenus to the popup. Before evaluation the following percent strings are
substituted:
- %w widget name
%g widget glade name
-onSizeChange string (default: "")
- Tcl script executed in response to a resizing of the the status icon itself. Before evaluation the following percent strings are
substituted:
- %w widget name
%g widget glade name
-tooltip string (default: "")
Message that appear next to this
widget when the mouse pointer is held over it for a short amount of
time.
- -visible boolean (default: 1)
- Whether or not the item is visible.
Description
The Gnome desktop has a "system tray" which functions as notification
area and generally contains transient icons
that indicate some special state. For example, a system tray icon would
be displayed to notify the user that they have received new mail or an
incoming instant
message.
NOTE:
Reference to the Gtk+ documentation will describe this object as a Gtk+ Display widget. As this item relies upon resource not contained within the core Gtk+ intallation and may not be a cross-plaform feature, this item is included with the GnoclGnome package.
Commands
id cget option
Returns the value for the specified
option. The option may have any of hte values accepted by configure.
id class
Returns the class of the widget, i.e.
statusIcon.
id configure [-option value...]
Configures the widget. Option may have
any of the values accepted on creation of the widget.
id notifiy [-option value...]
Display a notification popup with
message above the statusIcon.
Options
-appName string (default: "")
<description to be added>
-summary string (default: "")
The main notifcation message presented
in enboldened capitals.
-body string (default: "")
A message that expands upon the reason
for the notification, typically contains extra information. The string
can be formatted as a pango markup string..
-icon
percent-string (default: "")
Image to be shown, can either be a file
(prefic "%/") or stock item (prefix "%#").
-sound string
Name of sound file to be played when
notification appears. The sound files loaded are contained in those directories containing sound themes, typically /usr/share/sounds or similar.
-timeout int (default: 3000)
Specify how long the notifiy widget
will be displayed in milliseconds.
-urgency string (default: "normal")
Provide user feedback on the urgency of
the message notified. The available options are: low, normal or
critical. The levels of urgency will be reflected in the colouration of
the stripe displayed in left section of the notification widget.
- id delete
- Deletes the widget and the
associated tcl command.
Example
# statusIcon.tcl
#
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
package require Gnocl
package require GnoclGnome
set visibility 0
set blink 0
set stock 0
set menu [gnocl::menu \
-title "menu"]
$menu add [gnocl::menuItem \
-text "%#Save" \
-onClicked {puts "save"}]
$menu add [gnocl::menuSeparator]
$menu add [gnocl::menuItem \
-text "%#Quit" \
-onClicked exit]
set but1 [gnocl::button \
-text HELLO \
-onPopupMenu {puts "Button POPUP" }]
set but2 [gnocl::button \
-text Notify \
-onPopupMenu {puts "Button POPUP" }]
set but3 [gnocl::toggleButton \
-text "Visibility" \
-variable visibility \
-onValue 1 \
-activeBackgroundColor green \
-onToggled { $abc configure -visibility $visibility } ]
set but4 [gnocl::toggleButton \
-text "Blink" \
-variable blink \
-onValue 1 \
-activeBackgroundColor red \
-onToggled { $abc configure -blink $blink } ]
set but5 [gnocl::toggleButton \
-text "Icon" \
-variable stock \
-onValue 1 \
-activeBackgroundColor yellow \
-onToggled {
if {$stock} {
$abc configure -icon "%#New"
} else {
$abc configure -icon "%/[pwd]/phone.png"
}
}]
$but2 configure -onClicked \
{
$abc configure -visibility 1
$abc notify \
-appName TEST \
-summary "THIS IS MY APPLICATION" \
-body "Caller <b><i> on line </i></b> 01234-567890" \
-icon "%/[pwd]/phone.png" \
-sound "[pwd]/c326.wav" \
-timeout 4500 \
-urgency critical
$abc configure -blink 1
after 5000 { $abc configure -blink 0 }
}
set abc [gnocl::statusIcon \
-onActivate {
puts "I'M ACTIVATED!!!"
$menu popup
} \
-onPopupMenu {puts "HELLO POPUP"} \
-onButtonPress { puts "----- hello %w %t %x %y %X %Y %b %s -----" } \
-onButtonRelease {puts "----- goodbye %w %t %x %y %X %Y %b %s -----"} \
-icon tray_icon.png \
-tooltip "ABC" \
-blink 0 \
-visibility 0]
set box [gnocl::box -orientation vertical]
$box add [list $but1 $but2 $but3 $but4 $but5]
set gui [gnocl::window -child $box -onDestroy { exit } -width 200 -height 80 ]
gnocl::mainLoop