appindicator3

Crates.ioappindicator3
lib.rsappindicator3
version0.3.0
sourcesrc
created_at2022-03-18 19:01:58.419496
updated_at2023-08-29 02:03:49.764737
descriptionRust bindings for the AppIndicator and AyatanaAppIndicator library
homepage
repositoryhttps://github.com/rehar/appindicator3
max_upload_size
id552842
size98,967
Rene Harder (rehar)

documentation

README

appindicator3-rs

LGPL-2.1 licensed

Rust bindings for the AppIndicator and AyatanaAppIndicator library.

Ayatana Application Indicator Library

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]
appindicator3 = "0.2.0"

By default appindicator3-rs links against the libayatana-appindicator3 library. To link against the original libappindicator3 library enable the original feature:

[dependencies]
appindicator3 = { version = "0.2.0", feature = ["original", "v0_5"] }

Dependencies

You will need the development packages for libayatana-appindicator3 to compile against this crate.

Debian/Ubuntu:

sudo apt install libayatana-appindicator3-dev

openSUSE:

sudo zypper install libayatana-appindicator3-devel
# or for feature = ["original"]
sudo zypper install libappindicator3-devel 

Example Program

use appindicator3::{prelude::*, IndicatorStatus};
use appindicator3::{Indicator, IndicatorCategory};
use gtk::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();
}

Additonal examples can be found in examples.

Bindings

A large portion of the bindings is auto generated by GObject Introspection and gir using this configuration file.

More details on how to use gir can be found here.

License

appindicator3-rs is available under the MIT License. Please refer to the LICENSE file. This project provides bindings to the Application Indicator library but doesn't distribute any parts of it. Distributing compiled libraries and executable that link to this library may be subject to other licenses.

Commit count: 20

cargo fmt