{"id":28515411,"url":"https://github.com/mrusme/zpoweralertd","last_synced_at":"2026-07-04T14:32:19.441Z","repository":{"id":289723010,"uuid":"972098363","full_name":"mrusme/zpoweralertd","owner":"mrusme","description":"Zig rewrite and drop-in replacement of poweralertd (https://codeberg.org/mrus/zpoweralertd)","archived":false,"fork":false,"pushed_at":"2026-02-07T15:10:16.000Z","size":1188,"stargazers_count":23,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-07T23:54:51.424Z","etag":null,"topics":["d-bus","daemon","dbus","mako","notifications","poweralertd","upower","zig"],"latest_commit_sha":null,"homepage":"https://xn--gckvb8fzb.com/zpoweralertd-a-poweralertd-drop-in-replacement-written-in-zig/","language":"Zig","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrusme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":["https://xn--gckvb8fzb.com/support/"]}},"created_at":"2025-04-24T14:30:40.000Z","updated_at":"2026-02-07T15:20:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"a63d7153-eb69-498d-82ed-f58b7fc49ecd","html_url":"https://github.com/mrusme/zpoweralertd","commit_stats":null,"previous_names":["mrusme/zpoweralertd"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mrusme/zpoweralertd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrusme%2Fzpoweralertd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrusme%2Fzpoweralertd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrusme%2Fzpoweralertd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrusme%2Fzpoweralertd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrusme","download_url":"https://codeload.github.com/mrusme/zpoweralertd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrusme%2Fzpoweralertd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35125718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-04T02:00:05.987Z","response_time":113,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["d-bus","daemon","dbus","mako","notifications","poweralertd","upower","zig"],"created_at":"2025-06-09T03:05:39.526Z","updated_at":"2026-07-04T14:32:19.435Z","avatar_url":"https://github.com/mrusme.png","language":"Zig","funding_links":["https://xn--gckvb8fzb.com/support/"],"categories":[],"sub_categories":[],"readme":"# zpoweralertd\n\n![zpoweralertd](.README.md/banner.png)\n\n[\u003cimg src=\"https://xn--gckvb8fzb.com/images/chatroom.png\" width=\"275\"\u003e](https://xn--gckvb8fzb.com/contact/)\n\n`zpoweralertd` _gives you power notifications as you need them_. Paul Allen has\nmistaken it for `poweralertd`, which seems logical, because `zpoweralertd` also\ndepends on UPower and a notification daemon such as `mako`, and in fact does the\nsame exact thing `poweralertd` does, and it also has a penchant for D-Bus\nintegration and lightweight code. `poweralertd` and `zpoweralertd` even support\nthe same command-line arguments, although `zpoweralertd` is slightly more\nmodern.\n\n\u003e If you couldn't tell by now, `zpoweralertd` is a Zig rewrite and drop-in\n\u003e replacement of [`poweralertd`](https://github.com/kennylevinsen/poweralertd/).\n\n## How to build\n\n```sh\nzig build\n```\n\n(requires Zig 0.15.1+)\n\n## Usage\n\nSimply run `zpoweralertd` to start receiving desktop notifications about power\nevents like battery state changes, warning levels, and power supply\nconnect/disconnect:\n\n```sh\nzpoweralertd\n```\n\nIn Sway and similar desktop environments, you can copy-paste the following to\nthe end of the configuration file (e.g. `~/.config/sway/config`) to\nautomatically launch `zpoweralertd` in the background:\n\n```cfg\n# zpoweralertd\n# https://codeberg.org/mrus/zpoweralertd\nexec zpoweralertd\n```\n\n### Options\n\nThe following flags are available:\n\n| Flag                              | Description                                              |\n| --------------------------------- | -------------------------------------------------------- |\n| `-h`                              | Show help message                                        |\n| `-i \u003cdevice_type\u003e`                | Ignore a device type (can be specified multiple times)   |\n| `-s`                              | Ignore events at startup                                 |\n| `-S`                              | Only monitor power supplies                              |\n| `-v`                              | Show version number                                      |\n| `-V`                              | Verbose output                                           |\n| `--when \u003cstatus\u003e \u003cpct\u003e \u003ccommand\u003e` | Execute a shell command at a specific battery percentage |\n\nAlmost all flags are the exact same ones supported by `poweralertd`. However,\n`zpoweralertd` also implements flags that `poweralertd` does not support:\n\n#### `--when`\n\nThe `--when` flag allows executing arbitrary shell commands when the battery\nreaches a specific percentage, either by charging or discharging. This is a\nfeature unique to `zpoweralertd` and `poweralertd` does not support it.\n\nThe flag takes three arguments:\n\n1. `status`: Either `charged` (aliases: `charge`, `charging`) or `discharged`\n   (aliases: `discharge`, `discharging`)\n2. `percentage`: The battery level (number from 0 to 100)\n3. `command`: The shell command to execute\n\nFor `discharged`, the command fires when the battery percentage drops **to or\nbelow** the given value. For `charged`, it fires when the percentage **reaches\nor exceeds** it. The command fires once when the condition is met and will only\nfire again after the condition has cleared and been met again.\n\nThe flag can be specified multiple times to define different rules:\n\n```sh\nzpoweralertd \\\n  --when discharged 5 \"doas halt\" \\\n  --when discharged 15 \"notify-send 'Battery critical!'\" \\\n  --when charged 99 \"notify-send 'Almost full!'\"\n```\n\nThis makes it possible to build a complete power management policy directly\nthrough command-line arguments, from low-battery warnings to automatic shutdown,\nwithout any external scripts or configuration files. The benefit this has over,\nlet's say, `udev` rules, is that script execution as the current user is\nsignificantly easier, less hacky and poses fewer overall security risks, as\n`zpoweralertd` does not need to (read: **should not**) be run in privileged\nmode.\n\n## Footnotes\n\n![zpoweralertd](.README.md/footer.png)\n\n\u003e You like Huey Lewis and the News?\n\n\u003e Well, you can always be thinner... look better.\n\n\u003e I like to dissect old C software. Did you know I'm utterly insane?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrusme%2Fzpoweralertd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrusme%2Fzpoweralertd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrusme%2Fzpoweralertd/lists"}