Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

etherealxx/batterantix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Batterantix

Simple 'Battery Low' notification for AntiX Linux.
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Prerequisites
  3. Installation
  4. Settings/Customization
  5. Additional Note
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgments

About The Project

AntiX is a great distro. It's lightweight and easy to use. It comes with different flavor, and the Full flavor are jam-packed with many useful tools to do almost everything. However there is one important feature that is forgotten: the low battery notification

It's annoying that sometimes your laptop turn off immediately without warning in the middle of work. This simple script i provided will fix that annoyance. It uses python script and Zenity to send notification popup that warns user when the battery hits certain threshold. Also there is an optional script that turn off your computer if the battery hit the 'critical' threshold.

Language used

  • Python
  • Bash

Prerequisites

If you're on a new device, apt update is mandatory, atleast once. apt upgrade is recommended but not required.

sudo apt update

Then install these two important packages that will be used: git and zenity. git will be used to clone the repo (download the scipt) to your local storage. And zenity will be used to show a popup notification

sudo apt-get install git
sudo apt-get install zenity

Installation

  1. Clone the repository to your local storage
git clone https://github.com/etherealxx/batterantix
  1. Change directory into the script directory
cd batterantix
  1. Allow execute permission on every script there
chmod +x $PWD/*
  1. Edit the ~/.bashrc file, so that the script can be ran everywhere. You can use any text editor you like, here i'll use geany
geany ~/.bashrc

    Add this line to the end of the text file, then save the text file

export PATH=$PATH:/home/$USER/batterantix

    (assuming you didn't move the script's folder, and the git clone happened in     /home/<yourusername>/)

  1. Now edit the startup file so that the scipt will run everytime the laptop boots. (Note that you can use other text editor other than geany)
geany /home/ethereal/.desktop-session/startup

    Add this line to the end of the text file, then save the text file

batterantix.py &

    At this point the main script are ready to go, but the next step to 'automatically turn off the laptop when critical battery' are recommended.

  1. Edit the rc.local file so that the critical battery script will run as superuser everytime the laptop boots. (The shutdown command won't run without superuser. Note that you can use other text editor other than geany
sudo geany /etc/rc.local

    Add this line to the text file before the exit 0 line, then save the text file

batterantixcrit.py &

Finally, restart your laptop. If there's a popup few seconds after boot, the code works and installed successfully.

Settings/Customization

You can edit the line 6 and 7 of batterantix to customize the low battery and critical battery threshold of your likings.

lowBatteryPercentage = 10
criticalBatteryPercentage = 4

Don't forget to also edit the line 6 of batterantixcrit if you want to.

Additional Note

If you, for some reason, still want to continue your project even if the battery is low, and don't want to be annoyed by the notification constantly popping up, type this to your terminal

sudo killbatt.py

It will kill all Batterantix process, and you need to restart your laptop to make the script run normally again.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU GPLv3 License. See LICENSE.md for more information.

Contact

etherealxx - gwathon3@gmail.com

Project Link: https://github.com/etherealxx/batterantix

Acknowledgments

About

Low battery notification script for antiX 22

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages