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.18"
appindicator3 = "0.3"

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§

enums
prelude
Traits intended for blanket imports.

Structs§

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

Enums§

IndicatorCategory
The category provides grouping for the indicators so that users can find indicators that are similar together.
IndicatorStatus
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.