Crates.io | appindicator3 |
lib.rs | appindicator3 |
version | 0.3.0 |
source | src |
created_at | 2022-03-18 19:01:58.419496 |
updated_at | 2023-08-29 02:03:49.764737 |
description | Rust bindings for the AppIndicator and AyatanaAppIndicator library |
homepage | |
repository | https://github.com/rehar/appindicator3 |
max_upload_size | |
id | 552842 |
size | 98,967 |
Rust bindings for the AppIndicator and AyatanaAppIndicator 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.
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"] }
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
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.
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.
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.