BartoszCichecki / LenovoLegionToolkit

Lightweight Lenovo Vantage and Hotkeys replacement for Lenovo Legion laptops.
GNU General Public License v3.0
4.85k stars 226 forks source link

[FEAT]: Action trigger at battery percentage #564

Open Xerionius opened 1 year ago

Xerionius commented 1 year ago

Version

2.9.1

OS

Windows 11

Device

Legion 5 Pro 16ACH

Is your feature request related to a problem?

No

How would you like the problem to be solved?

Having a certain battery percentage as a trigger for actions would be great. You should be able to specify at which battery percentage the action should trigger and whether it should trigger on rising or falling battery level. This way you could enable conservation mode on a certain battery percentage to get around the default limit of 60 %. And you could change the refresh rate, resolution and brightness when the battery gets low.

What alternatives have you considered?

Instead of differentiating between rising and falling battery levels, it could also differentiate between "plugged in" and "not plugged in".

Additional information

No response

BartoszCichecki commented 1 year ago

This was discussed before, but can't find the issue now. Anyway, triggering Actions at certain battery percentage is not planned, because it can't be implemented reliably: for example actions won't run when laptop is sleeping or off (naturally).

I see you mention Conservation mode limits - long story short if the 60% limit is too low for you, it kind of indicates that you use your laptop on battery, so why do you use conservation mode? (Previously discussed here: https://github.com/BartoszCichecki/LenovoLegionToolkit/issues/20#issuecomment-988825583)

The alternative you presented is already implemented: there are actions for plugging in AC adapter.

Lastly the idea with adding "Low battery" trigger is good, let me know if you'd be interested in that. (API ref. for myself: https://learn.microsoft.com/en-us/windows/win32/power/pbt-apmbatterylow)

Xerionius commented 1 year ago

I understand the drawbacks and for me it would still be useful. However I agree that it might not make sense for most users, unfortunately.

I use my laptop mostly on AC power but I would like to have it ready to go when I need it. At 60 % the battery just doesn't last long enough to be useful and I feel like 80 or 90 % would be a good compromise, as 90 % already decreases wear significantly compared to 100 %.

With the alternative, I was suggesting still making it dependent on battery percentage, but instead of differentiating between rising and falling, differentiating between battery and AC power, which would be the same thing in practice.

Personally I would not be that interested in a low battery trigger, because I already have set the trigger for AC power disconnection to take some power saving measures.

BartoszCichecki commented 1 year ago

OK, I will keep the issue open but on hold. I need to think if I can fit this into the current architecture without making major changes.

vink2212 commented 1 year ago

I agree with @Xerionius I've wanted a feature like this for a while. Being able to trigger actions at certain battery %ages. A disclaimer that it won't work reliably with the machine sleeping would be good so people understand the limitations of the feature.

bcutter commented 10 months ago

Looking forward to use this too.

Ekscentricitet commented 6 months ago

I am interested in implementing the low battery trigger. I took a look into it and it would take me some time to go through the code base and understand what's happening and how I can integrate a listener for the event you linked. If you have time to sketch what changes have to be made I would give it a try.

Snake-babu commented 1 month ago

After the introduction of LLT CLI, I was able to code a fairly simple python script to achieve this, I will attach it to this comment

charge test.txt