Introduce inhibit subcommand to prevent system sleep while tasks run, offering flexible daemon and why options. - New Features - Added inhibit.rs module with `lapctl inhibit`, `lapctl inhibit --daemon`, and `lapctl inhibit --why "..."`. - Updated README.md with detailed Sleep Inhibitor description and usage examples. - Enhancements - Added Sleep inhibitor entry to the project checklist under Tool configuration saving. - Included inhibit.rs in the project structure listing. - Improved CLI help context for power and cooling sections. - Bug Fixes - No bug fixes included in this change.
lapctl
lapctl is a fast and easy command line tool made in Rust. It helps you control your Linux laptop hardware from the terminal.
You can use it to change your graphics card mode, set battery charge limits, pick power profiles, and control the cooling fans. It talks directly to your system hardware, so it does not need any heavy background programs to run.
What It Can Do
Graphics Control
Easily switch between Integrated, Nvidia, and Hybrid graphics modes to save battery or get more power.
Battery Health
Set a battery charge limit like 80% to make your battery last longer over the years.
Power Saving
Change power profiles and set CPU power limits to save energy when you need it.
Cooling Control
Control the cooling fans for laptops like Lenovo or ASUS to keep your computer quiet or cool.
Sleep Inhibitor
Prevent your system from sleeping or suspending while running a task or indefinitely.
Hardware Status
Check the status of your battery, graphics, and power all in one place.
How to Use It
# Graphics
lapctl gpu integrated
lapctl gpu hybrid
lapctl gpu nvidia
# Battery limit
lapctl battery limit 80
lapctl battery status
# Power mode
lapctl power performance
lapctl power balanced
lapctl power battery-save
# Power limit in Watts
lapctl power limit-tdp 35
# Cooling fans
lapctl cooling performance
lapctl cooling balanced
lapctl cooling quiet
# Sleep inhibitor
lapctl inhibit
lapctl inhibit --daemon
lapctl inhibit -- why "Building project" cargo build
# Check everything
lapctl status
File Layout
lapctl
│
├── Cargo.toml
├── README.md
├── LICENSE
├── .gitignore
│
├── src/
│ ├── main.rs
│ ├── cli.rs
│ ├── lib.rs
│ │
│ ├── commands/
│ │ ├── mod.rs
│ │ ├── gpu.rs
│ │ ├── battery.rs
│ │ ├── power.rs
│ │ ├── cooling.rs
│ │ ├── inhibit.rs
│ │ ├── install_rules.rs
│ │ └── status.rs
│ │
│ ├── hardware/
│ │ ├── mod.rs
│ │ └── gpu.rs
│ │
│ └── utils/
│ └── system.rs
│
└── tests/
├── cli.rs
└── gpu.rs
Project Goals Finished
- CLI setup and routing
- Graphics switching (Wayland & Xorg)
- Battery limits tools
- System status checking
- Tool configuration saving
- Cooling fan setup
- CPU power limit setup
- Sleep inhibitor (systemd-inhibit wrapper)
Contributions
We welcome your ideas and help!
To contribute, please fork the repository, create a new feature branch, and submit a Pull Request. Please ensure all tests pass by running cargo test before submitting your changes.
Special Credit
Special thanks to EnvyControl by bayasdev. lapctl uses many ideas from EnvyControl to handle graphics setup on Linux.
License
This project uses the MIT License.
You can use, change, and share this software freely under the rules of the license. Check the LICENSE file in this folder for details.
⭐ If you like this tool, please consider starring the repository!