Commit Graph
50 Commits
Author SHA1 Message Date
sankalp bb4e9248fd feat(src): adddisplay management commands
Implement display command to query and set refresh rates.

New Features
- Add DisplayCommands with Rates and SetRate subcommands
- Register display command in CLI dispatcher

Enhancements
- Extend command dispatch to handle Display subcommand

Bug Fixes
- None
2026-03-19 20:26:47 +05:45
sankalp 24060ebe0d feat(root): add wayland display refresh‑rate control and update dependencies Add support for querying and setting display refresh rates and extend the command‑line interface for refresh‑rate management.
- **New Features**
  - Introduce `lapctl display rates` to list available refresh rates.
  - Add `lapctl display set-rate <HZ>` to change the active display’s refresh rate.
  - Support runtime detection on Hyprland, Sway, KDE Plasma, GNOME, and X11 back‑ends.

- **Enhancements**
  - Include `wayland-client` and `wayland-protocols-wlr` crates with the `client` feature.
  - Update `Cargo.toml` to declare the new Wayland-related dependencies.
  - Expand README with usage examples for refresh‑rate management.

- **Bug Fixes**
  - No bug fixes introduced in this change.
2026-03-19 20:26:43 +05:45
sankalp d8c0cda3d7 feat(root): add touchpad enable/disable commands and update README
New Features
- Added `lapctl touchpad disable` and `lapctl touchpad enable` commands

Enhancements
- Added Touchpad section to README with usage examples

Bug Fixes
- (none)
2026-03-16 22:26:25 +05:45
sankalp 42b3fb47fd feat(commands): add touchpad inhibition handling and status display
New Features
- Implement touchpad enable/disable commands via /sys/class/input/inhibited.
- Add permission adjustments for touchpad inhibition files.
- Show touchpad status in `lapctl status`.

Enhancements
- Update install rules to manage touchpad inhibition permissions.
- Expose new `touchpad` command module.

Bug Fixes
- Resolve missing permission errors for touchpad devices.
- Handle missing /sys/class/input directory gracefully.
2026-03-16 22:26:22 +05:45
sankalp 1bb54facaf feat(src): add touchpadenable/disable commands
Implemented touchpad control to allow enabling and disabling the touchpad via lapctl.

- New Features
  - Add `touchpad` command with `enable` and `disable` subcommands.
- Enhancements
  - Extend CLI parsing and command routing to support touchpad operations.
- Bug Fixes
  - (none)
2026-03-16 22:26:17 +05:45
sankalp b14f279848 feat(tests): add integration tests for inhibit command parsing
Add integration tests that verify the inhibit command parses arguments correctly, covering normal execution, daemon flag usage, and default values for why and who. This provides regression protection for CLI parsing behavior.

- New Feature: Integration tests for inhibit subcommand parsing
2026-03-12 21:37:51 +05:45
sankalp ca2e98ebae feat(src/commands): split argument building into build_args and add tests
The refactor extracts argument construction into a reusable build_args function and adds unit tests, improving modularity and test coverage.

New Features
- Introduce build_args helper to construct inhibit command arguments.
- Add comprehensive unit tests for both empty and non‑empty argument scenarios.

Enhancements
- Refactor existing argument handling to use build_args, eliminating duplicated logic.
- Improve readability and maintainability of the inhibit command implementation.

Bug Fixes
- None
2026-03-12 21:37:45 +05:45
sankalp b11addcde6 feat(root): Add installation instructions to README
New Features
- Added installation guide using `just` (recommended) and `cargo`.

Enhancements
- Documented systemd and X11/NVIDIA tool requirements.

Bug Fixes
- None.
2026-03-12 21:37:32 +05:45
sankalp 626665e3e2 feat(root): Revamp README to showcase new CLI capabilities and project structure
Switch to more descriptive headings and embed badges for quick visual cues. Provide explicit command usage examples and clarify under‑the‑hood layout.

New Features
- Added clear command examples for graphics, battery, power, cooling, and inhibit operations.
- Highlighted benefits such as charge‑limit tuning and TDP limits.

Enhancements
- Reorganized content with badges, dividers, and a project layout diagram.
- Improved readability and navigation of key features.

Bug Fixes
- None.
2026-03-12 20:20:00 +05:45
sankalp 8f3f6c0ab8 feat(root): add sleep inhibitor command and daemon support
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.
2026-03-12 19:02:32 +05:45
sankalp 8095b50ac5 feat(src): add inhibit command to prevent system sleep
The new inhibit subcommand lets users block suspend/sleep while optionally running a command, specifying why and who, and running in daemon mode.

- New Features
  - Introduce Inhibit subcommand with command, why, who, and daemon options
- Enhancements
  - Extend CLI parsing to support additional arguments
  - Enable background inhibition via daemon flag for continuous prevention
2026-03-12 19:00:26 +05:45
sankalp 2b2962f7f0 feat(src/commands): add inhibit command to block sleep using systemd-inhibit
This command prevents system sleep while optionally executing a user‑provided command, offering both foreground and background inhibition modes.

- New Features
  - Implemented inhibit.rs with logic to invoke systemd-inhibit.
  - Exposed inhibit functionality by adding pub mod inhibit; to src/commands/mod.rs.

- Enhancements
  - (none)

- Bug Fixes
  - (none)
2026-03-12 19:00:20 +05:45
sankalp 33f6489e32 feat(root): add justfile with cargo script targets
Add a Justfile defining tasks for formatting, linting, testing, building, cleaning, and installing lapctl.

- New Features: introduce default target to list recipes and provide cargo-like commands
- Enhancements: streamline common development workflows
- Bug Fixes: none
2026-03-12 00:48:16 +05:45
sankalp 7846c1f5d2 refactor(src/utils): refactor directory creation and permission handling in create_file
- New Features
- Enhancements: Simplify directory creation error handling
- Bug Fixes: Ensure proper early return when creating parent directories fails
2026-03-12 00:48:11 +05:45
sankalp 857c7ebb28 feat(src/commands): add cooling profile descriptions and improve thermal detection
Implemented clearer cooling profile output by mapping mode codes to
human‑readable names and prefixing with "(ASUS)". Refactored thermal
detection loops for better readability and moved debug logging into the
correct block for GPU cache creation.

New Features
- Map mode strings "0","1","2" to readable cooling profile names
  (Performance, Balanced, Quiet / Battery Saving) and print them with
  "(ASUS)" label.
- Provide explicit cooling profile description in command output.

Enhancements
- Simplify Intel RAPL and AMD hwmon detection loops for clearer flow.
- Adjust brace placement in GPU cache creation to ensure debug log is
  emitted only on successful cache write.
- Minor formatting and style clean‑ups across battery, GPU, and power
  commands.

Bug Fixes
- Fix missing/incorrect closing braces in battery and power command
  parsers that previously caused compilation warnings.
- Ensure thermal detection logic only accesses sysfs entries after
  successful directory read.
2026-03-12 00:47:56 +05:45
sankalp 56a602e0a6 refactor(src/commands): simplify validation and file handling
- New Features
  - None
- Enhancements
  - Simplified percent range validation for battery mode.
  - Combined existence and read checks for sysfs entries, removing redundant branches.
  - Streamlined systemctl command arguments and removed unnecessary references.
  - Removed superfluous braces and simplified cooling profile detection logic.
  - Improved robustness of sysfs parsing for Intel RAPL and AMD hwmon temperature limits.
- Bug Fixes
  - Fixed battery percent validation to use inclusive range (1..=100) instead of incorrect reference comparison.
2026-03-12 00:42:26 +05:45
sankalp ca9390110e feat(root): add Wayland & Xorg support for graphics switching
- New Features
  - Added Wayland & Xorg support for graphics switching.
- Enhancements
  - Updated CLI routing and configuration saving to handle Wayland & Xorg sessions.
- Bug Fixes
  - None
2026-03-12 00:42:09 +05:45
sankalp 3551b973d1 refactor(src/utils): simplify directory creation and systemd-inhibit check
- Enhancements: Refactored conditional logic in create_file and rebuild_initramfs to reduce nesting and improve readability
2026-03-12 00:42:01 +05:45
sankalp f43a15095c refactor(src): restructure CLI module organization and adjust imports
Refactor internal CLI module layout to streamline imports and separate concerns.

- Enhancements
  - Consolidated CLI modules into `lapctl::cli` and `lapctl::commands`.
  - Updated imports in `main.rs` to use absolute paths.
  - Removed redundant module declarations from `main.rs`.
2026-03-12 00:36:21 +05:45
sankalp 435e2d8f3b feat(root): improve README and restructure project documentation
- Added badges for license, language, and OS
- Expanded description highlighting graphics control, battery health, power saving, and cooling control
- Introduced new sections: What It Can Do, how to use it, and project layout
- Added Installation Rules file and organized CLI examples
- Updated contribution and licensing language
- Organized project structure with new lib.rs, commands, and test modules

- New Features
  - Cooling Control for fan profiles on Lenovo/ASUS laptops
- Enhancements
  - Detailed README with badges and clearer feature explanations
  - New sections explaining usage and project layout
  - Added install_rules.rs and reorganized CLI docs
- Bug Fixes
  - None
2026-03-12 00:36:12 +05:45
sankalp f6d36c6555 feat(src/commands): expose xorg_intel, xorg_amd, and generate_xrandr_script as public functions
- Made the three helper functions public to allow external usage
- Facilitates reuse of GPU configuration helpers
- No functional changes beyond visibility
2026-03-12 00:36:08 +05:45
sankalp 5d35f10958 feat(tests): add CLI and GPU command tests
Add tests for CLI argument parsing and GPU command generation to increase coverage and ensure future changes don't break functionality.

New Features
- Add unit test `verify_cli` to ensure Clap command is built correctly.
- Add unit tests for `xorg_intel`, `xorg_amd`, and `generate_xrandr_script` functions.
- Validate that generated Xrandr scripts contain expected provider settings.

Enhancements
- none

Bug Fixes
- none
2026-03-12 00:36:03 +05:45
sankalp c9f64760d4 chore(.github/workflows): add Rust CI workflow
Add CI pipeline for Rust project to enforce formatting, clippy, and tests:
New Features
- Introduce Rust CI workflow triggered on push and pull_request to main/master
- Execute cargo fmt check, cargo clippy with deny warnings, cargo build, and cargo test
Enhancements
- No enhancements
Bug Fixes
- No bug fixes
2026-03-12 00:35:56 +05:45
sankalp e8f6c69638 feat(src/hardware): add logging for detected NVIDIA GPU and refactor command calls
Add `info!` logging when a NVIDIA GPU is discovered via `lspci`, enhancing debug visibility. Refactor the `lspci` and `xrandr` command constructions into multi‑line style for consistency and prepare a regex for future AMD GPU name detection.

- New Features: Log GPU detection with `info!` macro.
- Enhancements: Refactor command calls for readability; introduce regex preparation for AMD detection.
- Bug Fixes: None.
2026-03-12 00:27:57 +05:45
sankalp d67eae94d9 feat(src): add install-rules command for udev rule installation
New Features
- Introduced `InstallRules` subcommand to install udev rules for rootless operation.

Enhancements
- Streamlined `LimitTdp` and `Limit` enum variants by removing unnecessary wrapper structs.
- Updated command dispatch in `main` to handle the new `InstallRules` variant.
2026-03-12 00:27:51 +05:45
sankalp 05c8a3bd87 fix(src/utils): fix missing braces and improve conditional logic for rebuild_initramfs detection
Why: Ensure correct detection of EndeavourOS and provide clearer command building for initramfs.

- New Features: Added explicit multi‑condition detection with proper braces for EndeavourOS handling.
- Enhancements: Improved readability of systemd‑inhibit command construction.
- Bug Fixes: Resolved syntax issue that could cause command generation failure.
2026-03-12 00:27:46 +05:45
sankalp 8bd5b52b05 refactor(src/commands): enhance battery command error handling and readability
Restructure loops, add explicit error handling, improve multi‑line messages, and fix formatting issues.

- Enhancements
  - Use explicit braces for error branches to prevent silent failures
  - Wrap warning and informational messages in multi‑line `println!` with consistent spacing
  - Refactor directory reads for Ideapad fallback to avoid nested `let` bindings
  - Improve parsing and formatting of AMD TDP limit output with clear parentheses
  - Provide clearer debug logging when writing to threshold files
- Bug Fixes
  - Added missing braces around error handling to ensure proper execution flow
  - Fixed variable binding scope for `ideapad_entries` to prevent shadowing
  - Ensured consistent handling of missing `charge_control_end_threshold` across all entries

no changes.
2026-03-12 00:27:37 +05:45
sankalp 47aa4613d6 chore(root): Add credits and update license to MIT
Add acknowledgment of EnvyControl and change license from AGPL-3.0 to MIT.

New Features
-

Enhancements
- Added credits to EnvyControl.
- Updated license to MIT.

Bug Fixes
-
2026-03-12 00:17:47 +05:45
sankalp b08f3d5847 chore(license): switch from AGPL-3.0 to MIT
Relicensing the project to be more permissive.
2026-03-12 00:16:20 +05:45
sankalp 387047748a feat(src): update 2026-03-12 00:14:54 +05:45
sankalp 569775f549 feat(src/commands): implement dynamic CPU TDP limit control and status reporting
New Features
- Add per‑CPU power limit commands using Intel RAPL (PL1/PL2) and AMD hwmon constraints
- Expose current TDP limits in status output, distinguishing RAPL, AMD hwmon, or hardware‑managed
- Gracefully handle absence of required sysfs entries

Enhancements
- Extend the power command set with a `LimitTdp` sub‑command
- Add debug logging for limit application attempts

Bug Fixes
- Ensure the command degrades gracefully when hardware does not support dynamic power caps
2026-03-12 00:11:29 +05:45
sankalp 0327885bef feat(commands): add cooling command implementation and status integration
- New Features
  - Implement fan_mode control for Ideapad laptops
  - Implement thermal policy control for ASUS laptops via WMI
  - Provide cooling command supporting performance, balanced, and quiet profiles

- Enhancements
  - Display current cooling profile in `lapctl status` output

- Bug Fixes
  - None
2026-03-12 00:01:48 +05:45
sankalp bc31ce6506 feat(src): add cooling and thermal management commands
Adds a new Cooling command group with selectable fan profiles (Performance, Balanced, Quiet) and updates the CLI and logging accordingly.

- New Features
  - Introduce Cooling subcommands for setting thermal management modes
  - Implement runtime logic to apply selected fan profiles
- Enhancements
  - Extend CLI enum `Commands` to include `Cooling` and dispatch handling
  - Refine env_logger formatting to output only `[LEVEL] message`
  - Integrate cooling execution into the main command dispatch flow
- Bug Fixes
  - No bug fixes introduced in this change
2026-03-12 00:01:36 +05:45
sankalp e478630796 docs(root): Update status to stable and mark checklist items as completed
- New Features:
- Enhancements: Added confirmation of battery charge limit management and configuration support.
- Bug Fixes:
2026-03-11 23:47:59 +05:45
sankalp b5ba6efd41 feat(src/commands): implement battery limit command with validation and enhance status output
The changes introduce a robust `BatteryCommands::Limit` implementation that validates user‑provided percentages, writes charge‑control thresholds, and gracefully handles Lenovo Ideapad firmware via the `conservation_mode` fallback. The `lapctl status` command is also updated to display battery‑specific details such as capacity, status, and charge limits, replacing the previous generic placeholder.

New Features
- Added `BatteryCommands::Limit` handling with range validation (1‑100) and support for multiple `/sys/class/power_supply` entries.
- Implemented Ideapad fallback using `conservation_mode` to provide custom charge limits or warnings when unsupported.
- Extended `lapctl status` to show charge limit and Conservation Mode for each battery.

Enhancements
- Added root‑privilege check (`assert_root`) and improved error/debug logging throughout the command.
- Restructured directory traversal logic for readability and added `debug!` traces on write failures.
- Re‑used status logic to present battery‑specific information instead of a generic placeholder.

Bug Fixes
- Resolved placeholder status output and proper handling of missing `charge_control_end_threshold` files.
- Ensured correct exit codes and clear error messages for invalid percentage inputs.
2026-03-11 23:47:50 +05:45
sankalp 2d03067f0e feat(src/commands): add power profile status output
The `status` command now displays the current power profile by reading `/sys/firmware/acpi/platform_profile`, giving users insight into power usage.

New Features
- Output power profile status to the console.

Enhancements
- Enriches status command with additional hardware information.
2026-03-11 23:37:03 +05:45
sankalp c0481b1149 refactor(root): remove legacy lapctl.py and update roadmap status
The removed file contained outdated GPU power‑management integration now handled elsewhere; updating the README marks the associated tasks as completed.

Enhancements:
- Marked CLI structure, GPU mode switching, and hardware status command as completed.
2026-03-11 23:36:57 +05:45
sankalp fb69cdc63c feat(src/commands): implement power profile switching via sysfs
Set CPU scaling governor, energy performance preference, and ACPI platform profile for performance, balanced, and battery‑save modes. Added root assertion and detailed logging.

- New Features: Added set_cpu_governor, set_energy_performance_preference, set_platform_profile; integrated into execute for each PowerCommands variant.
- Enhancements: Use of logging to report successes/failures; fallback to modern scheduler governor (schedutil); validation of CPU sysfs paths.
- Bug Fixes: Guard against missing sysfs entries; improved debugging messages.
2026-03-11 23:33:47 +05:45
sankalp eab21bb2b1 feat(src): Introduce full CLI interface for laptop hardware management
Add clap‑based CLI with subcommands (gpu, battery, power, status), verbose flag, and detailed options such as rtd3, use_nvidia_current, etc.
- New Features
  - New CLI entry point with complete subcommand hierarchy
  - Verbose logging support
  - Granular command options for GPU, Battery, Power, Status
- Enhancements
  - Replace placeholder hello world with proper logging initialization
  - Modularize command implementations into dedicated modules
2026-03-11 23:32:15 +05:45
sankalp 9965e5716c feat(src/hardware): add battery placeholder and GPU detection utilities
New Features:
- Battery module with placeholder `info` function.
- GPU module with functions to detect NVIDIA mode, retrieve PCI bus IDs, identify Intel/AMD iGPU vendors, and extract AMD GPU names via xrandr.

Enhancements:
- Add logging for diagnostic messages and runtime checks.
- Include safety validation for external commands (lspci, xrandr) and configuration files.
2026-03-11 23:32:09 +05:45
sankalp d0b43db8ed feat(src/utils): add system utilities module
Create utilities for root checking, file creation with permissions, display manager detection, and initramfs rebuild.

- New Features
  - Introduce `system` module with `assert_root`, `create_file`, `get_display_manager`, and `rebuild_initramfs` functions.
- Enhancements
  - Add comprehensive logging (info, debug, warn, error) and debug output.
  - Implement directory creation and executable permission handling.
  - Wrap initramfs rebuild commands with `systemd-inhibit` when available.
- Bug Fixes
  - None
2026-03-11 23:32:03 +05:45
sankalp ea36902e72 feat(commands): add battery, gpu, power, and status command implementations
Added full command implementations for battery limit/status, GPU management (cache operations, mode switching, NVIDIA handling), and a status reporter that prints GPU mode and battery details. Introduced module registration and placeholder power command.

New Features
- Battery command support (`limit`, `status`)
- GPU command suite (`cache-delete`, `cache-query`, `reset`, `reset-sddm`, `integrated`, `hybrid`, `nvidia`)
- Status command output showing GPU mode and battery information
- Power command placeholder scaffold

Enhancements
- Unified command registration via `mod.rs`
- Added root checks and file utilities for cache and config operations
- Integrated logging infrastructure

Bug Fixes: none
2026-03-11 23:31:53 +05:45
sankalp 36d0807983 feat(root): add hybrid Optimus mode caching and command extensions
- New Features
  - Introduced cached configuration for hybrid Optimus systems
  - Added command‑line options for switching, resetting, and cache management
- Enhancements
  - Integrated clap‑derived CLI parsing
  - Updated project dependencies via Cargo.lock
  - Improved error handling and logging
2026-03-11 23:31:43 +05:45
sankalp d7e698d29d feat(src/utils): add system module placeholder
Add empty system.rs file in src/utils as a placeholder for future system utilities.

- New Features
  - Add system module skeleton
- Enhancements
- Bug Fixes
2026-03-11 22:18:17 +05:45
sankalp a9c6f4e561 feat(src/commands): add new command modules for battery, gpu, power, and status
- New Features
  - battery.rs: new command to display battery charge and health
  - gpu.rs: new command to query GPU utilization and temperature
  - power.rs: new command to show power consumption and mode
  - status.rs: new command to provide overall system status overview
2026-03-11 22:18:08 +05:45
sankalp af8d74bd05 feat(src): add initial CLI implementation
Add main entry point and scaffold CLI module to start building the tool.

- New Features:
  - Added `src/main.rs` with a hello‑world entry point.
  - Added `src/cli.rs` as placeholder for future CLI command definitions.
- Enhancements:
  - None
- Bug Fixes:
  - None
2026-03-11 22:18:00 +05:45
sankalp c150d422cd chore(root): add Cargo.toml and update .gitignore
Why: initialize Rust project and configure ignore patterns

New Features
- Initialize new Rust package `lapctl`.

Enhancements
- Add .gitignore entries for IDE metadata and build output.

Bug Fixes
- (none)
2026-03-11 22:17:55 +05:45
sankalp 69d6fd510c feat(src/hardware): add battery, gpu and mod files
- New Features
  - Added Battery implementation
  - Added GPU implementation
  - Added hardware module entry point
- Enhancements
  -
- Bug Fixes
  -
2026-03-11 22:17:49 +05:45
sankalp 30823fcc19 docs(root): Add initial README for lapctl
This adds the project's README documenting its purpose, planned features, and roadmap to orient contributors and users.

- New Features
  - Introduce overview of lapctl, including hybrid GPU control, battery limit management, and status commands
- Enhancements
  - Provide structured sections for project status, goals, example CLI, and roadmap
- Bug Fixes
  - None
2026-03-11 22:09:47 +05:45
sankalp 2365a0e445 Initial commit 2026-03-11 21:53:48 +05:45