{"id":25776787,"url":"https://github.com/pop-os/upower-dbus","last_synced_at":"2025-02-27T06:06:55.398Z","repository":{"id":57671237,"uuid":"444924067","full_name":"pop-os/upower-dbus","owner":"pop-os","description":"Migrated to https://github.com/pop-os/dbus-settings-bindings","archived":true,"fork":false,"pushed_at":"2023-01-09T19:53:00.000Z","size":21,"stargazers_count":6,"open_issues_count":0,"forks_count":5,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-10-29T18:08:13.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pop-os.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-05T19:20:31.000Z","updated_at":"2023-11-07T14:00:06.000Z","dependencies_parsed_at":"2023-02-08T13:45:29.910Z","dependency_job_id":null,"html_url":"https://github.com/pop-os/upower-dbus","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pop-os%2Fupower-dbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pop-os%2Fupower-dbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pop-os%2Fupower-dbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pop-os%2Fupower-dbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pop-os","download_url":"https://codeload.github.com/pop-os/upower-dbus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240987435,"owners_count":19889335,"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-02-27T06:01:31.026Z","updated_at":"2025-02-27T06:06:55.392Z","avatar_url":"https://github.com/pop-os.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# upower-dbus\n\nA Rust library which interfaces with UPower status information through dbus.\n\n## Examples\n\n### Detecting if the system is running on battery\n\n```rust,no_run\nextern crate upower_dbus;\n\nuse futures::stream::StreamExt;\nuse upower_dbus::UPowerProxy;\n\nfn main() -\u003e zbus::Result\u003c()\u003e {\n    futures::executor::block_on(async move {\n        let connection = zbus::Connection::system().await?;\n\n        let upower = UPowerProxy::new(\u0026connection).await?;\n\n        println!(\"On Battery: {:?}\", upower.on_battery().await);\n\n        let mut stream = upower.receive_on_battery_changed().await;\n\n        while let Some(event) = stream.next().await {\n            println!(\"On Battery: {:?}\", event.get().await);\n        }\n\n        Ok(())\n    })\n}\n\n```\n\n### Getting the current battery status as a percentage\n\n```rust,no_run\nextern crate upower_dbus;\n\nuse upower_dbus::UPowerProxy;\n\nfn main() -\u003e zbus::Result\u003c()\u003e {\n    futures::executor::block_on(async move {\n        let connection = zbus::Connection::system().await?;\n\n        let upower = UPowerProxy::new(\u0026connection).await?;\n\n        let device = upower.get_display_device().await?;\n\n        println!(\"Battery: {:?}\", device.percentage().await);\n\n        Ok(())\n    })\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpop-os%2Fupower-dbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpop-os%2Fupower-dbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpop-os%2Fupower-dbus/lists"}