3 unstable releases
0.2.1 | Oct 18, 2024 |
---|---|
0.2.0 | Jul 12, 2024 |
0.1.0 | Jun 19, 2024 |
#482 in Command line utilities
187 downloads per month
43KB
1K
SLoC
ala lape
sleepy zero
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 on idle, and as such, requires systemd, but does not rely on Wayland.
Notification inhibition depends on the daemon in use - see the docs 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), 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
cargo install ala-lape
Or directly from a checkout of this repo:
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.
nix run git+https://git.madhouse-project.org/algernon/ala-lape.git
Home Manager example
{
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"; }
];
};
};
}
];
};
};
}
Dependencies
~20–34MB
~561K SLoC