76 Commits
Author SHA1 Message Date
sankalp 8947bd643a feat(commands):simplify battery limit messaging for Ideapad laptopsThe command now detects Ideapad hardware and provides clearer messages about Conservation Mode, removing outdated warnings. 0.3.2 2026-03-23 18:30:37 +05:45
sankalp 5ac2aed516 chore(root): bump lapctl version to 0.3.2
Updated Cargo.lock and Cargo.toml to version 0.3.2 of the `lapctl` package.

New Features
- None

Enhancements
- Updated dependency version to 0.3.2Bug Fixes
- None
2026-03-23 17:28:36 +05:45
sankalp 4020f65e28 bumped to 0.3.2 2026-03-23 17:10:37 +05:45
sankalp d52b3992e3 feat(src/commands):add Ideapad conservation mode fallback and improve charge limit messaging 2026-03-23 17:08:36 +05:45
sankalp 01d2e148a0 refactor(src/daemon): replace execute calls with execute_local for dbus commands
Why: Adopt local execution path to streamline command handling and reduce RPC overhead.

New Features
-

Enhancements
- Replace `gpu::execute` with `gpu::execute_local` in integrated, hybrid, and nvidia command invocations.
- Replace `crate::commands::power`, `battery`, `cooling`, and `touchpad` executions with `execute_local`.
- Remove the unused `LAPCTL_DAEMON_INTERNAL` environment variable setting.

Bug Fixes
- None
0.3.1
2026-03-23 16:16:31 +05:45
sankalp 0dc00ec5c9 refactor(src/commands): Refactor battery and touchpad command execution
Refactored command flow to separate daemon invocation, added status handling, and improved error handling.

- New Features: Added `execute_local` helper and `BatteryCommands::Status` handling.
- Enhancements: Simplified daemon checks, removed redundant condition, improved readability and error messages.
- Bug Fixes: Fixed missed daemon return path for status command and ensured proper touchpad inhibition logic.
2026-03-23 16:16:25 +05:45
sankalp 319ca54300 bumped to 0.3.1 2026-03-23 15:40:19 +05:45
sankalp f12134a9c8 feat(src/daemon): set LAPCTL_DAEMON_INTERNAL env var internally
Set an internal environment variable when the daemon starts to allow components to detect internal mode and prepare for future runtime configuration.

- New Features
  - Introduce `LAPCTL_DAEMON_INTERNAL` set to "1" inside the daemon.
- Enhancements
  - Enable downstream components to detect internal daemon execution.
2026-03-23 15:39:08 +05:45
sankalp 86ac9b556c chore(root): remove PKGBUILD and update .gitignore
Removed legacy packaging script and cleaned .gitignore entries.

New Features
-

Enhancements
-

Bug Fixes
-
2026-03-23 15:39:04 +05:45
sankalp c564259a19 refactor(src/commands): add timeouthandling and internal daemon guard
Adds 2‑second timeouts around D‑Bus interactions and guards against internal daemon self‑calls; refactors command handling to use a consistent async timeout pattern and improves error reporting.

New Features
- Wrap D‑Bus calls with a 2‑second timeout to prevent hangs
- Early‑exit when $LAPCTL_DAEMON_INTERNAL is set to skip self‑calls- Apply consistent timeout usage across all commands

Enhancements
- Unified error handling using the `matches!` macro
- Reduced race conditions in connection establishment

Bug Fixes
- Prevent silent failures when a connection timeout occurs
2026-03-23 15:38:57 +05:45
sankalp 46cbcb5b4b update 2026-03-23 15:28:18 +05:45
sankalp 899d4c831f docs(root): Simplify Arch Linux installation instructions
Remove outdated Arch AUR install recommendation and clean up documentation wording

New Features
-

Enhancements
- Updated `yay -S` command to install `lapctl` instead of `lapctl-git`
- Removed redundant dependency and udev rules note
- Adjusted emphasis formatting in `install-rules` description

Bug Fixes
- none
2026-03-22 18:05:36 +05:45
sankalp 3590f693d3 Merge pull request #3 from S4NKALP/dev 0.3.0 2026-03-22 17:55:25 +05:45
sankalp e98346fad5 fix test 2026-03-22 17:53:36 +05:45
sankalp b0fdc0d58e fuck it forgot to commit all those changes 2026-03-22 15:05:45 +05:45
sankalp c20a5d3a06 docs(root): update readme 2026-03-20 09:51:03 +05:45
sankalp 2733215d9f Merge pull request #1 from S4NKALP/dev 0.2 2026-03-20 08:39:01 +05:45
sankalp 7fb21f5e3d chore(root): bump version to 0.2.0 and set edition 2024
New Features
- None

Enhancements
- Updated edition to 2024

Bug Fixes
- None
2026-03-19 21:03:40 +05:45
sankalp f333dabfe5 docs(root): fixformatting of GPU run command example
- New Features:
- Enhancements: Clarify formatting of `lapctl gpu run steam` example.
- Bug Fixes:
2026-03-19 20:59:48 +05:45
sankalp e840bb7ce1 feat(root): add GPU run steam command to launch Steam on dGPU
The command enables launching Steam directly on the dGPU while in hybrid mode, improving performance for gaming workloads.

New Features
- Introduces `lapctl gpu run steam` to run Steam on dGPU directly in hybrid mode.

Enhancements
- Updated README with documentation for the new GPU command.

Bug Fixes
- None.
2026-03-19 20:55:22 +05:45
sankalp 5e921d2833 feat(src/commands): add run_on_dgpu command to launch applications on discrete GPU
Running applications on the dGPU now requires proper environment variable setup and runtime mode checking. The implementation includes warnings when the system is not in hybrid mode and logs the launched command and its exit status.

- New Feature: Implemented `run_on_dgpu` function to execute commands with NVIDIA offload environment variables.
- Enhancement: Added runtime mode verification and warning for non‑hybrid configurations.
- Enhancement: Added informational logging for launched command and process exit status.
2026-03-19 20:55:18 +05:45
sankalp 707192903e feat(src): add Run subcommand tolaunch applications on discrete GPU
- New Features
  - Introduce `Run` command with trailing var argument support for executing commands on the discrete GPU (requires Hybrid Mode)
- Enhancements
  - Update CLI parsing to accept a vector of command strings
- Bug Fixes
  - None
2026-03-19 20:55:15 +05:45
sankalp f7a2848214 docs(root): clarify GPU Switching (Optional) requirements
- New Features: Add optional GPU switching requirement description for X11 (lapctl gpu) usage.
- Enhancements: Improve clarity of system dependency documentation.
- Bug Fixes: None.
2026-03-19 20:38:27 +05:45
sankalp 9dba194e7d feat(root): add native Wayland display refresh rate control
Add native Wayland refresh rate control using zwlr_output_manager_v1, remove reliance on xrandr, and document limitations for GNOME/KDE. This enables on‑the‑fly Hz changes without external tools.

- New Feature: Native Wayland refresh rate management
- Enhancement: Updated requirements and limitations sections
- Enhancement: Improved documentation for refresh rate control
2026-03-19 20:36:00 +05:45
sankalp a9ea518457 feat(src/commands): add get_active_display_info and status display output
Add function to retrieve and display active monitor information, and expose it via status command.

New Features:
- Implement get_active_display_info returning formatted display strings.
- Extend status command to list active displays using the new function.

Enhancements:
- Improve console output for display information.
- Update dependency usage for cleaner code.

Bug Fixes:
- None
2026-03-19 20:35:57 +05:45
sankalp c03251b0a8 feat(src/commands): add display command implementation for refresh rate control
New Features
- Create `src/commands/display.rs` providing `execute` handling for `Rates` and `SetRate` commands, querying refresh rates and applying configuration via Wayland output manager
- Implement mode enumeration, deduplication, and marker labeling (current/preferred) for displayed modes
- Enable fuzzy matching of target refresh‑rate when setting a new rateEnhancements
- Register the `display` module in `src/commands/mod.rs`
- Extend `AppState` with manager, heads, and modes maps plus configuration state tracking
- Add dedicated error handling for unsupported compositorsBug Fixes
- None
2026-03-19 20:26:51 +05:45
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
0.1
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