From 387047748a8e5375e3baf3907e3f16d91082ed94 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 12 Mar 2026 00:14:54 +0545 Subject: [PATCH] feat(src): update --- README.md | 83 ++++++++++++++++++++++------------------- src/cli.rs | 4 ++ src/hardware/battery.rs | 3 -- src/hardware/mod.rs | 1 - 4 files changed, 49 insertions(+), 42 deletions(-) delete mode 100644 src/hardware/battery.rs diff --git a/README.md b/README.md index 085f8d0..ee02955 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,58 @@ # lapctl -**lapctl** is an upcoming command-line utility written in Rust for managing laptop hardware features on Linux. +**lapctl** is a powerful, dependency-free command-line utility written in Rust. It is designed to provide seamless hardware management for Linux laptops. -It aims to provide a simple and unified interface for controlling hybrid GPU modes, battery charging limits, and other laptop power features directly from the terminal. +By interfacing directly with the Linux kernel and ACPI endpoints, `lapctl` provides a unified interface for controlling hybrid GPU modes, battery charging thresholds, and thermal/power profiles—all from the terminal. --- -## Planned Features +## Key Features -- Switch GPU modes on hybrid graphics laptops - - Integrated GPU - - Hybrid mode - - NVIDIA GPU - -- Set and manage battery charging limits -- View laptop hardware and power status -- Lightweight and fast CLI interface -- Designed for Linux systems with hybrid GPUs (Optimus) +- **Hybrid GPU Management:** Switch effortlessly between Integrated, Nvidia, and Hybrid graphics modes (Optimus). +- **Battery Health:** Enforce battery charging thresholds (e.g., 80%) to maximize chemical lifespan. +- **Power Profiling:** Dynamically adjust ACPI Platform Profiles, CPU scaling governors, and TDP (Wattage) limits. +- **Thermal Controls:** Direct hardware hooks for proprietary cooling solutions (e.g., Lenovo Ideapad, ASUS). +- **Hardware Polling:** Comprehensive hardware status checking without heavy daemon dependencies. --- -## Project Status - -**Stable** - -This project has reached its first stable milestone with all planned features implemented. - ---- - -## Goals - -- Provide a **simple CLI interface** for laptop hardware management -- Support **hybrid GPU laptops (Intel + NVIDIA / AMD + NVIDIA)** -- Offer **battery health features like charge limit control** -- Be **lightweight, fast, and easy to use** - ---- - -## Example CLI (Planned) +## Example CLI ```bash +# GPU Modes lapctl gpu integrated lapctl gpu hybrid lapctl gpu nvidia +# Battery Controls lapctl battery limit 80 lapctl battery status +# Power Profiles +lapctl power performance +lapctl power balanced +lapctl power battery-save + +# Raw Wattage Capping +lapctl power limit-tdp 35 + +# Cooling/Thermal Overrides (Lenovo/ASUS) +lapctl cooling performance +lapctl cooling balanced +lapctl cooling quiet + +# Check All Hardware lapctl status + +# --- lapctl status --- +# GPU Mode: hybrid +# BAT1: +# Capacity: 99% +# Status: Full +# Charge Limit: 100% +# Power Profile: balanced +# Cooling Profile: Balanced (Ideapad) +# CPU TDP Limit: Hardware Managed ``` --- @@ -78,25 +83,27 @@ lapctl │ │ ├── gpu.rs │ │ ├── battery.rs │ │ ├── power.rs +│ │ ├── cooling.rs │ │ └── status.rs │ │ │ ├── hardware/ │ │ ├── mod.rs -│ │ ├── gpu.rs -│ │ └── battery.rs +│ │ └── gpu.rs │ │ │ └── utils/ │ └── system.rs ``` -## Roadmap +## Core Capabilities -- [x] CLI structure -- [x] GPU mode switching -- [x] Battery charge limit management -- [x] Hardware status command -- [x] Configuration support +- [x] CLI structure and routing architecture +- [x] GPU mode switching and configuration orchestration +- [x] Battery charge limit management (sysfs & Ideapad conservation mode) +- [x] Comprehensive hardware status polling +- [x] Configuration support and state caching +- [x] Thermal/Cooling profiles (Lenovo VPC / ASUS WMI) +- [x] CPU TDP (Wattage) Control (Intel RAPL / AMD hwmon) --- diff --git a/src/cli.rs b/src/cli.rs index 89b9733..2fe81b8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -94,6 +94,10 @@ pub enum PowerCommands { Balanced, /// Set power profile to battery saver BatterySave, + /// Set CPU TDP limit (in Watts) + LimitTdp { + watts: u32, + }, } #[derive(Subcommand, Debug)] diff --git a/src/hardware/battery.rs b/src/hardware/battery.rs deleted file mode 100644 index d39844a..0000000 --- a/src/hardware/battery.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn info() { - println!("Hardware battery placeholder"); -} diff --git a/src/hardware/mod.rs b/src/hardware/mod.rs index 91e5ae9..8ed4129 100644 --- a/src/hardware/mod.rs +++ b/src/hardware/mod.rs @@ -1,2 +1 @@ -pub mod battery; pub mod gpu;