{"id":47641334,"url":"https://github.com/s4nkalp/lapctl","last_synced_at":"2026-05-29T12:00:48.303Z","repository":{"id":343772571,"uuid":"1179033236","full_name":"S4NKALP/lapctl","owner":"S4NKALP","description":"Zero dependency Rust CLI for managing Linux laptop hardware via sysfs/acpi; GPU switching, battery health, power limits, and cooling.","archived":false,"fork":false,"pushed_at":"2026-05-25T07:53:30.000Z","size":207,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-25T09:27:34.448Z","etag":null,"topics":["battery-health","battery-limi","battery-management-system","cli","cooling-control","gpu-switch","graphics-switcher","inhibitor","linux","optimus-manager","power-tune","rust","rust-cli"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/S4NKALP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["S4NKALP"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"buy_me_a_coffee":null,"thanks_dev":"u/gh/s4nkalp"}},"created_at":"2026-03-11T16:08:48.000Z","updated_at":"2026-05-25T07:53:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/S4NKALP/lapctl","commit_stats":null,"previous_names":["s4nkalp/lapctl"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/S4NKALP/lapctl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S4NKALP%2Flapctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S4NKALP%2Flapctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S4NKALP%2Flapctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S4NKALP%2Flapctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/S4NKALP","download_url":"https://codeload.github.com/S4NKALP/lapctl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S4NKALP%2Flapctl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33650712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["battery-health","battery-limi","battery-management-system","cli","cooling-control","gpu-switch","graphics-switcher","inhibitor","linux","optimus-manager","power-tune","rust","rust-cli"],"created_at":"2026-04-02T00:56:25.554Z","updated_at":"2026-05-29T12:00:48.297Z","avatar_url":"https://github.com/S4NKALP.png","language":"Rust","funding_links":["https://github.com/sponsors/S4NKALP","https://thanks.dev/u/gh/s4nkalp"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n![Rust](https://img.shields.io/badge/rust-%23000000.svg?style=flat\u0026logo=rust\u0026logoColor=white)\n![Linux](https://img.shields.io/badge/Linux-FCC624?style=flat\u0026logo=linux\u0026logoColor=black)\n\n**Take full control of your Linux laptop hardware with a fast, zero dependency CLI tool built in Rust.**\n\n\u003c/div\u003e\n\n---\n\n### Why lapctl?\n\nBuilt for speed and simplicity, it talks directly to your system's hardware interfaces (`sysfs`, `acpi`, `udev`). A background daemon (**lapctld**) handles all privileged operations via a secure D-Bus interface, allowing you to control your laptop completely **without sudo**.\n\n---\n\n### Key Features\n\n- **Graphics Switching**: Effortlessly toggle between Integrated, NVIDIA, and Hybrid modes. Wayland is auto detected; no `--wayland` flag needed. Optimize for battery life on the go or raw performance at your desk.\n- **Battery Health**: Modern batteries hate being at 100% all the time. Set custom charge limits (like 80%) to significantly extend your battery's lifespan.\n- **Power Tuning**: Switch through performance profiles or set hard CPU power (TDP) limits in Watts to keep things cool or let them loose.\n- **Intelligent Cooling**: Force your fans into Performance, Balanced, or Quiet modes (supporting ASUS and Lenovo laptops).\n- **Display Refresh Rate**: Easily query available refresh rates and change your active display's Hz on the fly (100% native Rust Wayland implementation using `zwlr_output_manager_v1` for wlroots compositors like Sway and Hyprland).\n- **Touchpad Toggle**: Quickly enable or disable your touchpad from the terminal when using an external mouse.\n- **Instant Status**: Get a bird's eye view of your hardware state, battery health, and current limits with one simple command.\n\n---\n\n### Installation\n\n**lapctl** is built with Rust. Ensure you have the [Rust toolchain](https://rustup.rs/) installed.\n\n#### Option 1: Arch Linux (AUR)\n\n```bash\nyay -S lapctl-bin\nsudo lapctl install-rules\n```\n\n#### Option 2: crates.io\n\n```bash\ncargo install lapctl\nsudo lapctl install-rules\n```\n\n#### Option 3: From source (using `just`)\n\n```bash\ngit clone https://github.com/S4NKALP/lapctl.git\ncd lapctl\njust install\nsudo lapctl install-rules\n```\n\n_The `install-rules` command automatically sets up the D-Bus policy and starts the `lapctld` background service._\n\n#### Requirements\n\n- **GPU Switching (Optional)**: `xrandr` and `nvidia-settings` are strictly required **ONLY** when using the `lapctl gpu` command on X11 (to route proprietary NVIDIA Optimus drivers). Wayland is auto detected so no extra flags are needed.\n- **Wayland Display**: Built entirely natively using `wayland-client` and `wayland-protocols-wlr` (no `wlr-randr` required!)\n\n#### Limitations\n\n- **GNOME / KDE Plasma (Wayland)**: The display refresh rate feature relies heavily on the `zwlr_output_manager_v1` protocol. This protocol is exclusive to wlroots-based compositors (like Sway and Hyprland). GNOME and KDE use their own disparate internal display protocols, meaning this feature will **not work** out-of-the-box on those Desktop Environments.\n\n---\n\n### Quick Start Guide\n\n```bash\n# Install D-Bus policy \u0026 start daemon (Required for rootless control)\nsudo lapctl install-rules\n\n# From now on, NO sudo is required!\n\n# Manage your GPU\nlapctl gpu integrated       # Max battery\nlapctl gpu hybrid           # Best of both worlds\nlapctl gpu nvidia           # High performance\nlapctl gpu nvidia --no-reboot  # Switch without rebooting (Ctrl+C safe)\nlapctl gpu run steam        # Run 'steam' on dGPU directly while in Hybrid mode\n\n# Prolong battery life\nlapctl battery limit 80\nlapctl battery status\n\n# Tune your power\nlapctl power performance\nlapctl power battery-save\nlapctl power limit-tdp 35  # Stay under 35W\n\n# Adjust your fans\nlapctl cooling quiet\nlapctl cooling performance\n\n# Manage your touchpad\nlapctl touchpad disable\nlapctl touchpad enable\n\n# Manage your display refresh rate\nlapctl display rates\nlapctl display set-rate 144\n\n# Check everything\nlapctl status\n```\n\n---\n\n### Under the Hood\n\nThe project is structured for speed and modularity:\n\n```\nlapctl\n│\n├── src/\n│   ├── main.rs         # The entry point\n│   ├── cli.rs          # Command definition \u0026 parsing\n│   ├── daemon/         # lapctld (D-Bus interface \u0026 logic)\n│   ├── commands/       # CLI feature logic \u0026 proxies\n│   ├── hardware/       # Hardware specific drivers (NVIDIA, etc.)\n│   └── utils/          # System helpers\n│\n└── tests/              # Robust integration \u0026 unit tests\n```\n\n**Safety features:**\n- **Concurrency lock** -- Exclusive file lock (`/var/lock/lapctl.lock`) prevents concurrent GPU switch commands from corrupting state\n- **Interrupt safety** -- If `--no-reboot` GPU switching is interrupted (Ctrl+C, crash), the display manager is automatically restarted via a RAII guard\n- **Atomic writes** -- Cache file is written atomically (temp file + rename) to prevent partial/corrupt state on crash\n\n---\n\n### Development \u0026 Connection\n\nWe love seeing how you use **lapctl**!\n\n- **Contribute**: Found a bug or have a feature idea? [Open an issue](https://github.com/S4NKALP/lapctl/issues) or submit a Pull Request. We're always looking for help supporting more laptop brands!\n- **Testing**: Please ensure all tests pass by running `cargo test` before submitting changes.\n- **Shoutout**: Huge thanks to [EnvyControl](https://github.com/bayasdev/envycontrol) for the inspiration on graphics management.\n\n---\n\n### License\n\nThis project is licensed under the **MIT License**. You are free to use, modify, and distribute it as you see fit. See [LICENSE](LICENSE) for the full text.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003cb\u003eIf you find lapctl useful, please consider starring the repository!\u003c/b\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs4nkalp%2Flapctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs4nkalp%2Flapctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs4nkalp%2Flapctl/lists"}