Git Product home page Git Product logo

batterycm-switcher's Introduction

Batterycm-Switcher

an advanced Ideapad Laptops conservation mode adjustment tool

What is the conservation mode?

Conservation mode is a battery protected mode in most Lenovo Ideapad Laptops. This mode work for disconnecting battery from your computer when AC power adapter is using. That mean battery overcharging can be avoid directly so that purging AC power adapter is unnecessary.

How to setup batterycm-switcher?

  • Required dependencies for this utility
    • bash: for running shell script
    • coreutils: for basic commands
    • man-db: for man page support
    • polkit/policykit-1: for access sysfs
    • vim: for config editing support
    • git(make): for clone this repos
    • gzip(make): for package man page
    • make(make): for make this utility
    • xz/xz-utils(make): for harden library support
    • acpid(optional): for capture function key support
    • espeak(optional): for voice prompt support
    • systemd(optional): for system service support
  • For ArchLinux users, the package batterycm-switcher is available from AUR.
    git clone https://aur.archlinux.org/batterycm-switcher.git
    cd batterycm-switcher
    makepkg -csi
  • For another distributions.
    • First install the required dependencies:
      • For Debian, some packages have different names:
        • xz is provided by xz-utils
        • polkit is provided by polkit-1.
      • For other distributions, you should correct it by yourself.
    • Than clone this repos and make it:
      git clone https://github.com/supdrewin/batterycm-switcher.git
      cd batterycm-switcher
      make
      sudo make install
  • For preview features, also see the branch testing.

How to use batterycm-switcher?

After install this utility, type batterycm-switcher help to get more information for using batterycm-switcher.

BATTERYCM-SWITCHER(1)                     User Commands                     BATTERYCM-SWITCHER(1)

NAME
       batterycm-switcher - an advanced Ideapad Laptops conservation mode adjustment tool

SYNOPSIS
       batterycm-switcher [ OPTION ]

DESCRIPTION
       This manual page documents briefly the batterycm-switcher command.
       Batterycm-Switcher  is  a useful commandline utility (CLI) to switch the conservation mode
       of Ideapad Laptops.  And it also provides series features to advanced users.

OPTIONS
       call   call the function  key  receive  backend,  this  require  `acpid`  and  'enable_re‐
              ceive_funkey'  =  1.   To enable show status using sound, it also needed to install
              `espeak` and change the config option 'enable_sound_prompt' = 1.

       config Use `config` to enter config editing, the editor used is vim, which most  powerful.
              You can special your own vimrc to use from the CUSTOMS section.

       debug  Use  `debug`  to view the log of batterycm-switcher, the default loging location is
              '/var/tmp/batterycm-switcher.log'.  You can change this location from config.  It's
              actually  depending  on  config  option 'batterycm_debug_level' != 0.  To enter the
              full debug mode, change the 'batterycm_debug_level' to 1.

       on / off
              Both optoins to turn on/off the battery conservation mode.

       auto / noauto
              Both options to enable/disable the Charging Threshold service, the default  thresh‐
              old  value  is 95%.  To custom the value, use `batterycm-switcher config` and go to
              the CUSTOMS section.

       enable / disable
              Both options to enable/disable the systemd service, which Batterycm-Switcher  Func‐
              tion  Key  Backend  Service.   An  backend service capture the function key opening
              Lenovo Vantage in Windows, the keycode depending on your hardware.

       help   This option will jump to show this man page, you can also do this:
              `man batterycm-switcher`, which function is same as help.

       status This option to show current status of conservation mode, it will return  a  message
              whether the mode on/off.

       version
              This  option  to  show  current version of batterycm-switcher, program name will be
              shown as the core module name of batterycm-switcher.

NOTES
       While no options special, batterycm will switch the conservation mode according to current
       mode.  If current mode is on, turning off, otherwise turning on.

       It's  necessary  to  know  that  `batterycm-charger.service`  is conflict with `batterycm-
       switcher.service` and other commands.  So I highly NOT recommend  use  both  at  the  same
       time.

       Don't  reporting  it as a bug if you don't have the `ideapad_laptop` driver.  Use `lsmod |
       grep ideapad_laptop` to have a try, no any reasons to directly uninstall this utility.

SEE ALSO
       batterycm-charger(1)

BUGS
       <https://github.com/supdrewin/batterycm-switcher/issues>

AUTHORS
       Supdrewin <https://github.com/supdrewin>

1.2.0                                       2021-08-28                      BATTERYCM-SWITCHER(1)

Some special features of this utility

  • supports running in tmpfs
  • secure environment for runtime
  • supports charging threshold (optional)
  • voice for mode switching (optional: require espeak)
  • function key to switch mode (optional: require acpid)

Help to improve this utility

  • Click here to report issues
  • Click here to pull requests

batterycm-switcher's People

Contributors

supdrewin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gousasin

batterycm-switcher's Issues

Feature suggestion: smart activation/deactivation

Would be nice to be able to deactivate conservation mode for exactly one charging cycle. So the trigger to reactivate it could be one of the following:-

  1. Fully charged
  2. Charge drops below a threshold (95%?)
  3. Goes on to battery power

The reasoning is that the reason to disable conservation mode is normally because you need the battery life (for a movie binge perhaps), but when that's done, the next time you plug in you may be using the laptop for hours and want conservation mode on.

What does the systemd service file do?

The basic functions are good (on/off, status). I don't understand what batterycm-switcher.service does though, as its not running, and starting it just results in an immediate:-

systemd[1]: Started Batterycm-Switcher Function Key Backend Service.
systemd[1]: batterycm-switcher.service: Deactivated successfully.

And yes I do have acpid.service running.

Also I'm guessing the config_charging_threshold doesn't apply for Lenovo laptops (only for huawei)?

ASUS laptop

Hello
I need a lot of this program and mode
Someone can introduce me another program

This tool messed my battery

Hi, So I wanted to run this command with --help flag. But instead it just run. Immediately after % of my battery disappeared and when I run it again it show up again. But... oddly enough when my battery is discharging now sometimes the number will go up by 1% and then drop by 1 % all that when the laptop is unplugged.

What this tool did when run without parameters?
How can I revert what this tool did?
Thank you...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.