Commit Graph
98 Commits
Author SHA1 Message Date
sankalp 9e5b618f19 chore(root): add project metadata to Cargo.toml
- New Features: Added description, license, and repository fields to clarify project identity.
- Enhancements: Improved Cargo.toml metadata completeness.  - Bug Fixes: None
2026-05-26 10:36:25 +05:45
sankalp 59dabcf6f4 feat(.opencode/plans):add release smoke test workflow and update Cargo.toml metadata 2026-05-26 10:33:40 +05:45
sankalp c03abaadc5 feat(src/commands): Add Ideapad detection and conditional platform profile handling
Enables proper handling of Ideapad laptops by skipping `set_platform_profile` when it is decoupled from fan control, improving compatibility and user feedback.

New Features
- Added `is_ideapad()` helper function.

Enhancements
- Conditional execution of `set_platform_profile` based on Ideapad detection.
- Added informative messages when platform profile is skipped on Ideapad.

Bug Fixes
- None.
2026-05-25 19:02:19 +05:45
sankalp 972618a8e3 fix(src/hardware): improveerror handling for GPU process killing
New Features
- Added explicit error handling and logging for `fuser` command failures.

Enhancements
- Refined process termination logic with richer diagnostics and graceful degradation when tools are unavailable.

Bug Fixes
- Prevented silent failures when stopping `nvidia-persistenced.service` by logging errors instead of ignoring them.
2026-05-25 14:50:17 +05:45
sankalp 74aa1ff262 fix(src): handle tokio runtime creation errors gracefullyBug Fixes:
- Added proper error handling for tokio runtime creation, exiting with a clear error message instead of panicking.
2026-05-25 14:50:06 +05:45
sankalp 0219f1c8ce refactor(src/utils): improve error handling and messaging in system utilitiesNew Features
- None

Enhancements- Added detailed error reporting with exit codes for privilege escalation, initramfs rebuild, service management, and session termination
- Implemented graceful handling of permission‑setting failures with proper logging
- Enhanced error messages for systemctl and loginctl commands, providing clearer diagnostics

Bug Fixes- Fixed incomplete error propagation in status matching, now reports actual exit codes or underlying errors
2026-05-25 14:50:00 +05:45
sankalp 191afd2f12 feat(src/commands): enhance error handling, logging, and robustness in GPU command implementations
- **New Features**: Added detailed error logging for signal handling, directory creation, cache file operations, and service management; improved cleanup with explicit error propagation.
- **Enhancements**: Refactored Drop implementations to handle failures gracefully; upgraded status handling for systemctl commands with precise exit code reporting; strengthened directory and file removal with debug logging.
- **Bug Fixes**: Fixed missing error propagation in Ctrl+C handler; corrected service enable/disable status reporting; ensured proper removal of cache files and directories with appropriate logging of failures.
2026-05-25 14:49:48 +05:45
sankalp 02f8ff4c33 docs(root): Clarify Wayland auto‑detection and add safety features documentation
- New Features: Add `--no-reboot` flag usage example for GPU switching
- Enhancements: Document Wayland auto‑detection and new safety mechanisms (concurrency lock, interrupt‑safe restart, atomic writes)
- Bug Fixes: Minor phrasing corrections and typo fixes in README sections
2026-05-25 13:38:26 +05:45
sankalp 75c3a39597 feat(src/daemon): add battery limit validation to set_battery_limit
The change ensures that only valid battery percentages (1‑100) are processed, preventing out‑of‑range values from reaching the underlying command.

- New Features
  - Validation of battery limit percentage added.
- Enhancements  - Better error reporting for invalid arguments.
- Bug Fixes
  - Prevents processing of invalid battery limit values.
2026-05-25 13:36:40 +05:45
sankalp f5f73a4990 fix(src/hardware): improvePCI address parsing and error handling
- Improves robustness of NVIDIA GPU PCI bus detection.
- Adds validation for unexpected PCI format strings.
- Prevents panic by handling missing command output and malformed IDs gracefully.
2026-05-25 13:36:34 +05:45
sankalp c018aeda57 chore(root): Update dependencies and add new crates
Add several new crates (block2, cfg_aliases, ctrlc, dispatch2, fs2, nix, objc2, objc2-encode, winapi and their sub‑crates) to support new functionality and improve compatibility. Bump versions of core crates (libc, futures-core, etc.) to latest releases.

- New Features:
  - Introduce `block2`, `cfg_aliases`, `ctrlc`, `dispatch2`, `fs2`, `nix`, `objc2`, `objc2-encode`, and `winapi` (including target‑specific crates) to enable additional system interaction and async capabilities.
- Enhancements:
  - Upgrade `libc`, `futures-core`, `futures-util`, `tokio`, `clap`, `serde`, and other dependencies to latest stable versions for performance and security improvements.
- Bug Fixes:
  - Updated checksums and dependency resolution to reflect newer releases, reducing potential runtime issues.
2026-05-25 13:36:29 +05:45
sankalp 73e1edfd97 fix(src/utils): add warning for unknowndistribution when rebuilding initramfs
Log a warning when the initramfs rebuild is skipped because the distribution is unknown, ensuring the user is informed.

New Features
- None

Enhancements
- Added explicit warning for unknown distributions to prevent silent skips
- Improved logging clarity in rebuild_initramfs

Bug Fixes
- Fixed missing warning path that could hide build issues on unsupported distros
2026-05-25 13:36:23 +05:45
sankalp 4e46604cfd feat(src/commands): implement atomic interrupt handling, display‑manager guard, lock file for operation serialization, safe cache writes, and improve daemon enable messaging
The changes add robust interruption support, exclusive‑lock enforcement, and safer file handling to the GPU switching commands, while clarifying installation output.

- New Features  - Atomic `INTERRUPTED` flag with Ctrl‑C signal handler
  - `DmGuard` struct to manage display‑manager start/stop lifecycle
  - `LockGuard` with exclusive lock file (`/var/lock/lapctl.lock`) to serialize GPU switches
  - Safe temporary‑file write + rename for cache updates
- Enhancements
  - Unified `prepare_no_reboot` returns `DmGuard` instead of `Option<String>`
  - Consistent early‑exit handling with lock acquisition checks
  - Improved debug/info logging for DM actions
  - Restructured `finalize_no_reboot` to return a guard value
  - Clarified installation success/failure messages for `lapctld`
- Bug Fixes
  - Prevented race conditions on concurrent GPU switches by locking before operation
  - Ensured lock is released on early return paths
  - Fixed incomplete `finalize_no_reboot` handling
  - Corrected daemon enable detection and user feedback logic
2026-05-25 13:36:16 +05:45
sankalp b6c0ca0b9b feat(src): add Clone derive to GpuCommandsThe GpuCommands enum now derives Clone, enabling it to be cloned and used in contexts such as message passing or state storage.
New Features:
- Enables cloning of GpuCommands variants for greater flexibility.

Enhancements:
- Improves CLI ergonomics by allowing command enum to be transmitted across async boundaries.
2026-05-25 13:27:23 +05:45
sankalp 94aed29728 feat(src/commands): add Wayland detection and Xorg modesetting support
Enable automatic handling of NVIDIA commands in Wayland sessions and generate proper Xorg config snippets.

- New Features
  - Adds `is_wayland_session()` that detects a Wayland environment via `WAYLAND_DISPLAY` or `XDG_SESSION_TYPE`.
  - Adds `xorg_modesetting(bus_id)` that builds a full Xorg configuration snippet for the modesetting driver.

- Enhancements
  - `switch_nvidia()` now automatically treats NVIDIA commands as Wayland‑aware when a Wayland session is detected.
  - Refactored command matching in `execute()` to preserve original fields while injecting Wayland awareness.
  - Fixed daemon invocation to pass a reference to the (potentially transformed) command.

- Bug Fixes
  - Corrected argument passing in `try_call_daemon` and `execute_local` to avoid move errors.
  - Prevented duplicate command handling when a Wayland session is detected.
2026-05-25 13:27:17 +05:45
sankalp d12d0a0916 bumped to 0.3.3 0.3.3 2026-05-08 22:14:36 +05:45
sankalp 30dadec637 fixed clippy:derivable-imps warning 2026-05-08 22:12:31 +05:45
sankalp dba3995608 docs(root): Remove sleep inhibitordocumentation and inhibit daemon CLI examples
Clean up obsolete documentation and CLI usage examples from README.
2026-05-08 22:08:03 +05:45
sankalp c8a688f44f refactor(tests): drop inhibit test file 2026-05-08 22:07:55 +05:45
sankalp 7de76d0365 refactor(src/daemon): drop set_system_inhibition method and simplify Default impl
Simplify daemon interface by removing obsolete system inhibition logic.

New Features
-
Enhancements
- Cleaned up dead code path.
-
Bug Fixes
- Prevented potential file descriptor leak by removing inhibition handling.
2026-05-08 22:07:53 +05:45
sankalp 055fdcd500 refactor(src/utils): remove systemd-inhibit handling from rebuild_initramfsSimplify command construction by dropping unused inhibition logic.
- New Features:
- Enhancements: Simplified command construction in rebuild_initramfs.
- Bug Fixes: Resolved potential error when systemd-inhibit is unavailable.
2026-05-08 22:07:49 +05:45
sankalp 934aeda6aa refactor(src): remove inhibit command
New Features
-

Enhancements
- Dropped inhibit subcommand and related modules.
- Cleaned up command handling logic in main.rs.

Bug Fixes- No bug fixes introduced.
2026-05-08 22:07:37 +05:45
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