{"id":20340220,"url":"https://github.com/stefano-m/lua-upower_dbus","last_synced_at":"2025-09-02T22:45:22.593Z","repository":{"id":96809181,"uuid":"73123935","full_name":"stefano-m/lua-upower_dbus","owner":"stefano-m","description":"Get power information with UPower and DBus","archived":false,"fork":false,"pushed_at":"2024-10-05T16:13:21.000Z","size":36,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T23:17:16.067Z","etag":null,"topics":["battery","dbus","lua","upower"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefano-m.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-07T21:48:12.000Z","updated_at":"2024-10-05T16:13:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"aabd4937-3b91-4238-886f-27ffb90cff5e","html_url":"https://github.com/stefano-m/lua-upower_dbus","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefano-m%2Flua-upower_dbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefano-m%2Flua-upower_dbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefano-m%2Flua-upower_dbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefano-m%2Flua-upower_dbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefano-m","download_url":"https://codeload.github.com/stefano-m/lua-upower_dbus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492885,"owners_count":21113163,"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":["battery","dbus","lua","upower"],"created_at":"2024-11-14T21:20:17.455Z","updated_at":"2025-04-11T23:17:29.137Z","avatar_url":"https://github.com/stefano-m.png","language":"Lua","readme":"# Get information about your power devices using [UPower](https://upower.freedesktop.org/) and DBus.\n\n## Requirements\n\nIn addition to the requirements specified in the rockspec file,\nyou need UPower and DBus (usually both are present in modern GNU/Linux systems).\nNote that you may need permissions to access the UPower DBus interface.\n\n## Installation\n\n### Luarocks\n\nThis module can be installed with [Luarocks](http://luarocks.org/) by running\n\n    luarocks install upower_dbus\n\nUse the `--local` option in `luarocks` if you don't want or can't install it system-wide.\n\n### NixOS\n\nIf you are on NixOS, you can install this package from\n[nix-stefano-m-overlays](https://github.com/stefano-m/nix-stefano-m-nix-overlays).\n\n## Example\n\nThis module exposes the following\n\n* `Manager` singleton, containing its own properties and the `devices` array.\n* `enums` table containing the UPower enumerations as arrays of strings.\n* `Device` constructor, although it's advised to use the Manager to get the devices rather then building them by hand.\n\n```lua\nlocal GLib = require(\"lgi\").GLib\nlocal ctx = GLib.MainLoop():get_context()\nlocal upower = require(\"upower_dbus\")\n-- What version of UPower is in use?\nupower.Manager.DaemonVersion\n-- Are we using a battery?\nupower.Manager.OnBattery\n-- Print all fields of the first device found\nfor k, v in pairs(upower.Manager.devices[1]) do print(k, v) end\n-- Enumerate the Device Types known by UPower\nfor _, v in ipairs(upower.enums.DeviceType) do print(v) end\n-- Say that the first device is a battery\nbattery = upower.Manager.devices[1]\nprint(battery.Percentage) -- may print 100.0\n-- Update the devices in case something changed\nctx:iteration()\n-- The battery discharged a bit\nbattery.Percentage -- may print 99.0\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefano-m%2Flua-upower_dbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefano-m%2Flua-upower_dbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefano-m%2Flua-upower_dbus/lists"}