{"id":28690620,"url":"https://github.com/thunderbird/dbus_hooks","last_synced_at":"2025-06-14T06:05:44.064Z","repository":{"id":240795769,"uuid":"803495106","full_name":"thunderbird/dbus_hooks","owner":"thunderbird","description":"Thunderbird implementation of ksni for the linux system tray icon","archived":false,"fork":false,"pushed_at":"2024-05-28T20:16:16.000Z","size":298,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-29T11:17:41.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thunderbird.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-20T20:42:30.000Z","updated_at":"2024-05-29T11:17:46.378Z","dependencies_parsed_at":"2024-05-20T23:17:40.475Z","dependency_job_id":"32c8e83f-30f1-4843-898d-d78b3a307fde","html_url":"https://github.com/thunderbird/dbus_hooks","commit_stats":null,"previous_names":["thunderbird/tb-ksni","thunderbird/dbus-hooks"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thunderbird/dbus_hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunderbird%2Fdbus_hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunderbird%2Fdbus_hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunderbird%2Fdbus_hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunderbird%2Fdbus_hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thunderbird","download_url":"https://codeload.github.com/thunderbird/dbus_hooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunderbird%2Fdbus_hooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259768612,"owners_count":22908230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-14T06:05:43.461Z","updated_at":"2025-06-14T06:05:44.059Z","avatar_url":"https://github.com/thunderbird.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dbus\\_hooks\n\n`dbus_hooks` is forked from an upstream crate called `ksni` and modified to fit Thunderbird's needs. You can find the [![upstream `ksni` documentation](https://docs.rs/ksni/badge.svg)](https://docs.rs/ksni)\n[![MSRV](https://img.shields.io/badge/msrv-1.58.0-blue)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)\n\nA Rust implementation of the KDE/freedesktop StatusNotifierItem specification.\n\nThis crate is used in the [Linux system tray icon](https://github.com/thunderbird/linux-sys-tray/).\n\n## Example\n\n```rust\nuse dbus_hooks;\n\n#[derive(Debug)]\nstruct MyTray {\n    selected_option: usize,\n    checked: bool,\n}\n\nimpl dbus_hooks::Tray for MyTray {\n    fn icon_name(\u0026self) -\u003e String {\n        \"help-about\".into()\n    }\n    fn title(\u0026self) -\u003e String {\n        if self.checked { \"CHECKED!\" } else { \"MyTray\" }.into()\n    }\n    // NOTE: On some system trays, `id` is a required property to avoid unexpected behaviors\n    fn id(\u0026self) -\u003e String {\n        env!(\"CARGO_PKG_NAME\").into()\n    }\n    fn menu(\u0026self) -\u003e Vec\u003cdbus_hooks::MenuItem\u003cSelf\u003e\u003e {\n        use dbus_hooks::menu::*;\n        vec![\n            SubMenu {\n                label: \"a\".into(),\n                submenu: vec![\n                    SubMenu {\n                        label: \"a1\".into(),\n                        submenu: vec![\n                            StandardItem {\n                                label: \"a1.1\".into(),\n                                ..Default::default()\n                            }\n                            .into(),\n                            StandardItem {\n                                label: \"a1.2\".into(),\n                                ..Default::default()\n                            }\n                            .into(),\n                        ],\n                        ..Default::default()\n                    }\n                    .into(),\n                    StandardItem {\n                        label: \"a2\".into(),\n                        ..Default::default()\n                    }\n                    .into(),\n                ],\n                ..Default::default()\n            }\n            .into(),\n            MenuItem::Separator,\n            RadioGroup {\n                selected: self.selected_option,\n                select: Box::new(|this: \u0026mut Self, current| {\n                    this.selected_option = current;\n                }),\n                options: vec![\n                    RadioItem {\n                        label: \"Option 0\".into(),\n                        ..Default::default()\n                    },\n                    RadioItem {\n                        label: \"Option 1\".into(),\n                        ..Default::default()\n                    },\n                    RadioItem {\n                        label: \"Option 2\".into(),\n                        ..Default::default()\n                    },\n                ],\n                ..Default::default()\n            }\n            .into(),\n            CheckmarkItem {\n                label: \"Checkable\".into(),\n                checked: self.checked,\n                activate: Box::new(|this: \u0026mut Self| this.checked = !this.checked),\n                ..Default::default()\n            }\n            .into(),\n            StandardItem {\n                label: \"Exit\".into(),\n                icon_name: \"application-exit\".into(),\n                activate: Box::new(|_| std::process::exit(0)),\n                ..Default::default()\n            }\n            .into(),\n        ]\n    }\n}\n\nfn main() {\n    let service = dbus_hooks::TrayService::new(MyTray {\n        selected_option: 0,\n        checked: false,\n    });\n    let handle = service.handle();\n    service.spawn();\n\n    std::thread::sleep(std::time::Duration::from_secs(5));\n    // We can modify the tray\n    handle.update(|tray: \u0026mut MyTray| {\n        tray.checked = true;\n    });\n    // Run forever\n    loop {\n        std::thread::park();\n    }\n}\n```\n\nWill create a system tray like this:\n\n![screenshot_of_example_in_gnome.png](examples/screenshot_of_example_in_gnome.png)\n\n(In GNOME with AppIndicator extension)\n\n## License\n\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunderbird%2Fdbus_hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthunderbird%2Fdbus_hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunderbird%2Fdbus_hooks/lists"}