ViRb3 / LenovoController

🎮 A lightweight alternative to Lenovo Vantage
MIT License
229 stars 28 forks source link

Offer a command-line interface to allow other apps to trigger power mode, etc #6

Open ViRb3 opened 3 years ago

ViRb3 commented 3 years ago

This will help people who want to develop apps that rely on controlling the hardware features that this app controls. Examples:

tkon99 commented 2 years ago

FYI, it's my first time doing this but I've managed to get a basic CLI working for BatteryMode: https://github.com/tkon99/LenovoController/commit/cdcea5d54b4181d07c1f4e50886afae13a38a255

Soham-Rakhunde commented 2 years ago

@tkon99 hello, can I know where to learn using CLI and especially how did u find vantage features.I mean i wanted to program that everytime I start my legion it should ayto start keyboard backlight and start the conservation mode at 80 percent auto(matically and its a pain in the ass to start the conservation mode every time from the gui. But I cant find any tool to do this or how to write a program or where to find these vantage features. PLease reply

tkon99 commented 2 years ago

@Soham-Rakhunde I don't have time to implement features I will not use, so if you need keyboard LED you will need to implement the CLI yourself.

I also think you misunderstood what I did. Basically the "vantage features" were already implemented in LenovoController (this repo), I then call them from a CLI instead of the GUI so that a script can interface with them. I didn't add new vantage features.

Either way, if you take a look at the code in my fork (link in my comment above) you will find the implementation of the CLI. Adding features can be done by adding a new case in the switch statement. Setting the value of a feature would then be the third argument iirc.

I might implement everything at some point but maybe in a couple months (don't count on it).

PS. I implemented a Python script that gets called every minute by the Windows Task Scheduler (and run as admin), checks the current battery status (charging or not) and then calls the CLI to set the battery mode accordingly (conservation when more than 80 percent).

Soham-Rakhunde commented 2 years ago

Thank you very much I understood it. I will look into the repo and i will try to write the feature. Thanks a lot.

GTMoraes commented 1 year ago

FYI, it's my first time doing this but I've managed to get a basic CLI working for BatteryMode: tkon99@cdcea5d

Hey, I'm using your build and it works ok. However, when Rapid Mode is enabled, it cannot disengage Rapid Mode through CLI, only enable or disable Conservative mode.
If I use "BatteryMode Normal", it stays in Rapid Mode. If I set to Rapid Mode, then change to Conservative, then try to change to Normal, it goes back to Rapid Mode.
If it's set to Normal and I use CLI to change to Rapid mode, it works. If it's set to Conservative and I use to change to Rapid mode, it works. If it's been previously set to Normal, then I change to Conservative, then change to Normal, it works changing to Normal.

Clicking on the GUI icons works fine to change between the three modes, at any previous state.

My device's a Lenovo Yoga 7i 15ITL5