ala lape ======== > sleepy zero [![Build status][ci:badge]][ci:url] [![Docs: CLI][docs:cli:badge]][docs:cli] [![Docs: Config][docs:config:badge]][docs:config] [![Crates.io release][crate:badge]][crate:url] [ci:badge]: https://git.madhouse-project.org/algernon/ala-lape/actions/workflows/build.yaml/badge.svg?style=for-the-badge&label=CI [ci:url]: https://git.madhouse-project.org/algernon/ala-lape/actions/workflows/build.yaml/runs/latest [docs:cli:badge]: https://img.shields.io/badge/docs-cli-blue?style=for-the-badge [docs:config:badge]: https://img.shields.io/badge/docs-config-blue?style=for-the-badge [crate:badge]: https://img.shields.io/crates/v/ala_lape?style=for-the-badge [crate:url]: https://crates.io/crates/ala-lape [docs:cli]: https://git.madhouse-project.org/algernon/ala-lape/src/branch/main/docs/cli.md [docs:config]: https://git.madhouse-project.org/algernon/ala-lape/src/branch/main/docs/config.md ### What A little tool to help with preventing the computer from going idle while it is actively used, in a way that may be invisible to the desktop environment. Unlike many other idle inhibitors, this tool does *not* rely on creating a Wayland surface. It does not rely on Wayland at all, and works with XOrg too. If you ever found yourself in the middle of a gaming session, happily spamming buttons on your gamepad, only for the computer to go to sleep because it did not recognise gamepad input as activity, this is the tool for you. ### How `ala-lape` monitors gamepads, and inhibits idle (and/or notifications, on supported notification daemons) when there's activity. It can also monitor the presence of processes, and do the inhibition while select processes are present. Idle inhibition is done by taking an [inhibitor lock](https://systemd.io/INHIBITOR_LOCKS/) on idle, and as such, requires systemd, but does not rely on Wayland. Notification inhibition depends on the daemon in use - see the [docs][docs:config] about that. ### Why Mostly because fixing the issue (gamepad input not being considered as activity) is an issue known for well over a decade, and still not addressed, because it is a hard problem. So here's an external tool that gets the job done. It does so without being tied to Wayland, because doing it through Wayland did not work with my compositor of choice ([niri](https://github.com/YaLTeR/niri)), and I didn't have the slightest idea how to debug it, let alone fixing it. This is a workaround, and it gets the job done. ## Building ``` shellsession cargo install ala-lape ``` Or directly from a checkout of this repo: ``` shellsession cargo install --path . ``` ### NixOS A flake is included in the repo, which can be used with Home Manager, and the flake can be run directly too. ``` shellsession nix run git+https://git.madhouse-project.org/algernon/ala-lape.git ```
Home Manager example ```nix { inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; inputs.ala-lape = { url = "git+https://git.madhouse-project.org/algernon/ala-lape.git"; inputs.nixpkgs.follows = "nixpkgs"; }; inputs.hm = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs: { homeManagerConfigurations."USER@HOSTNAME" = inputs.hm.lib.homeManagerConfiguration { pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; modules = [ inputs.ala-lape.homeManagerModules.default { services.ala-lape = { enable = true; package = inputs.ala-lape; config = { inhibitors.notifications.swaync.enable = true; limits = { poll_frequency = "30s"; activity_timeout = "30s"; event_threshold = 6; }; gamepad = [ { name = "X-Box 360"; } ]; process = [ { name = "some-program"; } ]; }; }; } ]; }; }; } ```