2 stable releases
1.0.1 | Jan 30, 2025 |
---|
#1 in #caffeine
259 downloads per month
24KB
304 lines
☕ Caffeine Cli
Just another caffeine tool, but this one should work. It uses systemd inhibit to manage the idling part.
How To Install
To install run:
cargo install caffeine-cli
Alternatively you can manually download the release binary in the releases page.
Usage
To install it as you can use cargo to add it or manually add the library in cargo.toml:
cargo add caffeine-cli
To add it in the cargo.toml:
caffeine-cli = "1.0.1"
You can also use this as a library:
To start and get a session you can use the init_session command:
// Starts an endless session
let session = init_session(None).unwrap();
// Starts with a protected session (no other sessions can be created if there's an active session)
let session = init_protected_session(None).unwrap();
// For a timed session (seconds)
let session = init_session(Some(4 * 60)).unwrap();
// Starts with a timed protected session
let session = init_protected_session(Some(4 * 60)).unwrap();
To end a session:
// Ends the given session
end_session(session);
// Ends the current protected session
end_protected_session();
Commands
You can run the following commands:
caffeine-cli {command}
Command | Description |
---|---|
enable | Enables the caffeine session with an infinnite amount of time |
timed | Enables the caffeine session with x amount of minutes |
disable | Disables the current session |
status | Shows the status of the current session |
Alternatively you can run the app and select the options in the menu:
![](https://img.gs/czjpqfbdkz/full/https://raw.githubusercontent.com/lighttigerxiv/caffeine-cli/97ddd0fb1f6a8bee5c82de67c1d04e066f4a978b/cli-preview.webp)
Dependencies
~6–15MB
~178K SLoC