Hypnos is the name of the greek god of sleep... But that's not what this software is (you can't code a god (I think)).
(Our) Hypnos is a simple idle daemon that you can configure to execute actions after an idle period.
To build Hypnos, you need to have Rust and Cargo installed. You can then clone this repository and build the project using Cargo:
git clone https://github.com/axos-project/hypnos.git
cd hypnos
cargo build --releaseThe resulting binary will be located in the target/release directory.
If you want to install it as a package, you can build the package:
makepkgOr, if you just want to have the binary installed system-wide:
cp target/release/hypnos /usr/local/bin/Hypnos uses a JSON configuration file to define idle rules. By default, it looks for a configuration file at $HOME/.config/hypnos/config.json. You can specify a different configuration file using the -c or --config command-line option.
Here is an example configuration file:
{
"enabled": true,
"rules": {
"dim": {
"timeout": 300,
"actions": "brightnessctl -s set 10",
"restore": "brightnessctl -r",
"on_battery": true
},
"lock": {
"timeout": 600,
"actions": "loginctl lock-session",
"on_battery": false,
"enabled": false
}
}
}enabled: If set to false, Hypnos will not execute any rules.
Each rule in the rules object are defined as follows:
Run Hypnos with the following command:
hypnosWow, how difficult was that, right?
You can also specify a custom configuration file:
hypnos -c /path/to/your/config.jsonIf you want to have the details of what is happening, you can run Hypnos with the RUST_LOG environment variable set to info or debug:
RUST_LOG=debug hypnos # Assuming your binary is in your PATHThis will provide detailed logs about the idle notifications and actions being executed.