Package: gtk

Class gtk-status-icon

Superclasses

g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

embedded
The embedded property of type :boolean (Read)
True if the status icon is embedded in a notification area.
Default value: false
file
The file property of type :string (Write)
Filename to load and display.
Default value: nil
gicon
The gicon property of type g-icon (Read / Write)
The icon displayed in the status icon. For themed icons, the image will be updated automatically if the theme changes.
has-tooltip
The has-tooltip property of type :boolean (Read / Write)
Enables or disables the emission of "query-tooltip" signals on the status icon. A value of true indicates that the status icon can have a tooltip, in this case the status icon will be queried using the "query-tooltip" signal to determine whether it will provide a tooltip or not. Note that setting this property to true for the first time will change the event masks of the windows of this status icon to include "leave-notify" and "motion-notify" signals. This will not be undone when the property is set to false again. Whether this property is respected is platform dependent. For plain text tooltips, use the tooltip-text property in preference.
Default value: false
icon-name
The icon-name property of type :string (Read / Write)
The name of the icon from the icon theme.
Default value: nil
orientation
The orientation property of type gtk-orientation (Read)
The orientation of the tray in which the status icon is embedded.
Default value: :horizontal
pixbuf
The pixbuf property of type gdk-pixbuf (Read / Write)
The pixbuf to display.
screen
The screen property of type gdk-screen (Read / Write)
The screen where this status icon will be displayed.
size
The size property of type :int (Read)
The size of the icon.
Allowed values: >= 0
Default value: 0
stock
The stock property of type :string (Read / Write)
Stock ID for a stock image to display.
Warning: The stock property has been deprecated since version 3.10 and should not be used in newly written code. Use the icon-name property instead.
Default value: nil
storage-type
The storage-type property of type gtk-image-type (Read)
The representation being used for image data.
Default value: :empty
title
The title property of type :string (Read / Write)
The title of this tray icon. This should be a short, human readable, localized string describing the tray icon. It may be used by tools like screen readers to render the tray icon.
Default value: nil
tooltip-markup
The tooltip-markup property of type :string (Read / Write)
Sets the text of the tooltip to be the given string, which is marked up with the Pango text markup language. Also see the function gtk-tooltip-set-markup. This is a convenience property which will take care of getting the tooltip shown if the given string is not nil. The has-tooltip property will automatically be set to true and the default handler for the "query-tooltip" signal will take care of displaying the tooltip. On some platforms, embedded markup will be ignored.
Default value: nil
tooltip-text
The tooltip-text property of type :string (Read / Write)
Sets the text of the tooltip to be the given string. Also see the function gtk-tooltip-set-text. This is a convenience property which will take care of getting the tooltip shown if the given string is not nil. The has-tooltip property will automatically be set to true and the default handler for the "query-tooltip" signal will take care of displaying the tooltip. Note that some platforms have limitations on the length of tooltips that they allow on status icons, e.g. Windows only shows the first 64 characters.
Default value: nil
visible
The visible property of type :boolean (Read / Write)
Whether the status icon is visible.
Default value: true

Details

The "system tray" or notification area is normally used for transient icons that indicate some special state. For example, a system tray icon might appear to tell the user that they have new mail, or have an incoming instant message, or something along those lines. The basic idea is that creating an icon in the notification area is less annoying than popping up a dialog.

A gtk-status-icon object can be used to display an icon in a "system tray". The icon can have a tooltip, and the user can interact with it by activating it or popping up a context menu.

It is very important to notice that status icons depend on the existence of a notification area being available to the user. You should not use status icons as the only way to convey critical information regarding your application, as the notification area may not exist on the environment of the user, or may have been removed. You should always check that a status icon has been embedded into a notification area by using the function gtk-status-icon-is-embedded, and gracefully recover if the function returns nil.

On X11, the implementation follows the freedesktop.org "System Tray" specification. Implementations of the "tray" side of this specification can be found e.g. in the GNOME 2 and KDE panel applications.

Note that a status icon is not a widget, but just a g-object object. Making it a widget would be impractical, since the system tray on Win32 does not allow to embed arbitrary widgets.

Warning

The gtk-status-icon class has been deprecated in 3.14. You should consider using notifications or more modern platform-specific APIs instead. GLib provides the GNotification API which works well with the gtk-application class on multiple platforms and environments, and should be the preferred mechanism to notify the users of transient status updates. See GNotification for code examples.

Signal Details

The "activate" signal
 lambda (icon)    :action      
Gets emitted when the user activates the status icon. If and how status icons can be activated is platform dependent. Unlike most :action signals, this signal is meant to be used by applications and should be wrapped by language bindings.
icon
The gtk-status-icon object which received the signal.
The "button-press-event" signal
 lambda (icon event)    :run-last      
The signal will be emitted when a button, typically from a mouse, is pressed. Whether this event is emitted is platform dependent. Use the "activate" and "popup-menu" signals in preference.
icon
The gtk-status-icon object which received the signal.
event
The gdk-event-button event which triggered this signal.
Returns
True to stop other handlers from being invoked for the event. False to propagate the event further.
The "button-release-event" signal
 lambda (icon event)    :run-last      
The signal will be emitted when a button, typically from a mouse, is released. Whether this event is emitted is platform dependent. Use the "activate" and "popup-menu" signals in preference.
icon
The gtk-status-icon object which received the signal.
event
The gdk-event-button event which triggered this signal.
Returns
True to stop other handlers from being invoked for the event. False to propagate the event further.
The "popup-menu" signal
 lambda (icon button time)    :action      
Gets emitted when the user brings up the context menu of the status icon. Whether status icons can have context menus and how these are activated is platform dependent. The button and time parameters should be passed as the last arguments to the function gtk-menu-popup. Unlike most :action signals, this signal is meant to be used by applications and should be wrapped by language bindings.
icon
The gtk-status-icon object which received the signal.
button
An unsigned integer with the button that was pressed, or 0 if the signal is not emitted in response to a button press event.
time
An unsigned integer with the timestamp of the event that triggered the signal emission.
The "query-tooltip" signal
 lambda (icon x y mode tooltip)    :run-last      
Emitted when the gtk-tooltip-timeout setting has expired with the cursor hovering above the status icon, or emitted when the status icon got focus in keyboard mode. Using the given coordinates, the signal handler should determine whether a tooltip should be shown for the status icon. If this is the case true should be returned, false otherwise. Note that if mode is true, the values of x and y are undefined and should not be used. The signal handler is free to manipulate the tooltip with the therefore destined function calls. Whether this signal is emitted is platform dependent. For plain text tooltips, use the tooltip-text property in preference.
icon
The gtk-status-icon object which received the signal.
x
An integer with the x coordinate of the cursor position where the request has been emitted, relative to icon.
y
An integer with the y coordinate of the cursor position where the request has been emitted, relative to icon.
mode
True if the tooltip was trigged using the keyboard.
tooltip
A gtk-tooltip object.
Returns
True if the tooltip should be shown right now, false otherwise.
The "scroll-event" signal
 lambda (icon event)    :run-last      
The signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned. Whether this event is emitted is platform dependent.
icon
The gtk-status-icon object which received the signal.
event
The gdk-event-scroll event which triggered this signal.
Returns
True to stop other handlers from being invoked for the event. False to propagate the event further.
The "size-changed" signal
 lambda (icon size)    :run-last      
Gets emitted when the size available for the image changes, e.g. because the notification area got resized.
icon
The gtk-status-icon object which received the signal.
size
An integer with the new size.
Returns
True if the icon was updated for the new size. Otherwise, GTK will scale the icon as necessary.
 

Slot Access Functions

Inherited Slot Access Functions

2021-7-22