Crate appindicator3

source ·
Expand description

Rust bindings for the AppIndicator and AyatanaAppIndicator libraries.

Allows applications to export a menu into the an Application Indicators aware menu bar. Based on KSNI it also works in KDE and will fallback to generic Systray support if none of those are available.

Usage

Add the following to your Cargo.toml:

[dependencies]
gtk = "0.15"
appindicator3 = "0.2.0"

Next:

use gtk::prelude::*;
use appindicator3::{Indicator, IndicatorCategory, IndicatorStatus, prelude::*};
 
fn main() {
    gtk::init().unwrap();

    let m = gtk::Menu::new();
    let mi = gtk::MenuItem::with_label("Hello World");
    mi.connect_activate(|_| {
        gtk::main_quit();
    });
    m.add(&mi);
    mi.show_all();
 
    let _indicator = Indicator::builder("Example")
        .category(IndicatorCategory::ApplicationStatus)
        .menu(&m)
        .icon("face-smile", "icon")
        .status(IndicatorStatus::Active)
        .build();
 
    gtk::main();
}

Re-exports

pub use ffi;
pub use glib;

Modules

Traits intended for blanket imports.

Structs

A application indicator type
A builder-pattern type to construct Indicator objects.

Enums

The category provides grouping for the indicators so that users can find indicators that are similar together.
These are the states that the indicator can be on in the user’s panel. The indicator by default starts in the state Passive and can be shown by setting it to Active.