{"id":18826435,"url":"https://github.com/segevfiner/keepawake-rs","last_synced_at":"2025-04-12T19:50:00.283Z","repository":{"id":60598982,"uuid":"542112703","full_name":"segevfiner/keepawake-rs","owner":"segevfiner","description":"Keep your computer awake","archived":false,"fork":false,"pushed_at":"2025-03-15T11:54:19.000Z","size":281,"stargazers_count":31,"open_issues_count":3,"forks_count":19,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T19:49:31.127Z","etag":null,"topics":["awake","caffeinate","gnome-session-inhibit","idle","power-management","rust","sleep","systemd-inhibit"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/keepawake","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/segevfiner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-09-27T13:56:43.000Z","updated_at":"2025-04-07T01:30:46.000Z","dependencies_parsed_at":"2024-12-25T09:11:36.963Z","dependency_job_id":"b969e8e8-92bc-4cf8-a1e2-fcc394f0b3a7","html_url":"https://github.com/segevfiner/keepawake-rs","commit_stats":{"total_commits":162,"total_committers":7,"mean_commits":"23.142857142857142","dds":0.06172839506172845,"last_synced_commit":"71aa9a89d89341e82a8852d298cb35f6d289b4fe"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segevfiner%2Fkeepawake-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segevfiner%2Fkeepawake-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segevfiner%2Fkeepawake-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segevfiner%2Fkeepawake-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/segevfiner","download_url":"https://codeload.github.com/segevfiner/keepawake-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625501,"owners_count":21135513,"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":["awake","caffeinate","gnome-session-inhibit","idle","power-management","rust","sleep","systemd-inhibit"],"created_at":"2024-11-08T01:05:43.842Z","updated_at":"2025-04-12T19:50:00.265Z","avatar_url":"https://github.com/segevfiner.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keepawake-rs\n[![Crates.io](https://img.shields.io/crates/v/keepawake)](https://crates.io/crates/keepawake)\n[![docs.rs](https://img.shields.io/docsrs/keepawake)](https://docs.rs/keepawake)\n[![CI](https://github.com/segevfiner/keepawake-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/segevfiner/keepawake-rs/actions/workflows/ci.yml)\n\nKeep your computer awake. Like [`caffeinate`], [`systemd-inhibit`]/[`gnome-session-inhibit`], or [PowerToys Awake], but cross-platform and written in [Rust].\n\nAlso available as a [Rust crate], and as a [C library](#c-library-experimental) (experimental).\n\n[`caffeinate`]: https://ss64.com/osx/caffeinate.html\n[`systemd-inhibit`]: https://www.freedesktop.org/software/systemd/man/systemd-inhibit.html\n[`gnome-session-inhibit`]: https://manpages.ubuntu.com/manpages/jammy/man1/gnome-session-inhibit.1.html\n[PowerToys Awake]: https://learn.microsoft.com/en-us/windows/powertoys/awake\n[Rust]: https://www.rust-lang.org/\n[Rust crate]: https://docs.rs/keepawake\n\n## Usage\n```\nKeep your computer awake\n\nUsage: keepawake [OPTIONS] [COMMAND]...\n\nArguments:\n  [COMMAND]...  Run the command and wait for it to exit, keeping the computer awake while it runs\n\nOptions:\n  -d, --display              Keep display on\n  -i, --idle                 Keep system from idle sleeping\n  -s, --sleep                Keep system from explicitly sleeping (Functionality and conditions for this to work vary by OS)\n      --completions \u003cSHELL\u003e  Generate shell completions [possible values: bash, elvish, fish, powershell, zsh]\n  -w \u003cPID\u003e                   Wait for the process with the specified pid to exit. This option is ignored when used with the COMMAND argument\n  -h, --help                 Print help information\n  -V, --version              Print version information\n```\n\nSee [docs.rs/keepawake](https://docs.rs/keepawake) for library crate documentation and usage.\n\n## Installation\n\n### Cargo\n```sh\ncargo install keepawake -F bin\n```\n\n### Binaries\nDownload from https://github.com/segevfiner/keepawake-rs/releases/latest.\n\n## Completions\nUse: `keepawake --completions \u003cSHELL\u003e` to generate a completion script, you will have to install it\nas appropriate for the specific shell you are using.\n\n## C library (experimental)\nBuilt using [cargo-c].\n\n```sh\n# build the library, create the .h header, create the .pc file\n$ cargo cbuild --destdir=${D} --prefix=/usr --libdir=/usr/lib64\n```\n\n```sh\n# build the library, create the .h header, create the .pc file and install all of it\n$ cargo cinstall --destdir=${D} --prefix=/usr --libdir=/usr/lib64\n```\n\nSee the generated header file for details on the API. See [cargo-c] for futher details on cargo-c usage.\n\n[cargo-c]: https://crates.io/crates/cargo-c\n\n## Technical Details\n|               | Windows                     | macOS                           | Linux                                                       |\n| ------------- | --------------------------- | ------------------------------- | ----------------------------------------------------------- |\n| API           | [`SetThreadExecutionState`] | [`IOPMAssertionCreateWithName`] | [`org.freedesktop.ScreenSaver`] \u0026 [systemd Inhibitor Locks] |\n| Debug command | `powercfg /requests`        | `pmset -g assertions`           | `systemd-inhibit --list`, `gnome-session-inhibit --list`    |\n| display       | `ES_DISPLAY_REQUIRED`       | `PreventUserIdleDisplaySleep`   | `org.freedesktop.ScreenSaver.Inhibit`                       |\n| idle          | `ES_SYSTEM_REQUIRED`        | `PreventUserIdleSystemSleep`    | `org.freedesktop.login1.Manager.Inhibit(\"idle\")`            |\n| sleep         | `ES_AWAYMODE_REQUIRED`      | `PreventSystemSleep`            | `org.freedesktop.login1.Manager.Inhibit(\"sleep\")`           |\n\n`idle` prevents the system from going to sleep on an idle timer, while `sleep` tries to prevent the system from going to sleep explicitly by the user (Whether `sleep` also prevents idle sleep varies by OS). `sleep` is restricted and will only work under certain conditions, most notably, the computer must be on AC power (AKA plugged in, not on battery), and is not allowed on Windows on any computer that has modern standby on (Which is unfortunate as modern standby is also used in laptops not only in handheld mobile devices).\n\n[`SetThreadExecutionState`]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate\n[`IOPMAssertionCreateWithName`]: https://developer.apple.com/documentation/iokit/1557134-iopmassertioncreatewithname\n[`org.freedesktop.ScreenSaver`]: https://people.freedesktop.org/~hadess/idle-inhibition-spec/re01.html\n[systemd Inhibitor Locks]: https://www.freedesktop.org/wiki/Software/systemd/inhibit/\n\n## Notes\nPreventing the computer from explicitly sleeping, and/or by closing the lid, is often restricted in various ways by the OS, e.g. Only on AC power, not in any PC running Windows with [Modern Standby](https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby). Also note that Modern Standby ignores/terminates power requests on DC (Battery) power, [PowerSetRequest - Remarks](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-powersetrequest#remarks).\n\n## License\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegevfiner%2Fkeepawake-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsegevfiner%2Fkeepawake-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegevfiner%2Fkeepawake-rs/lists"}