{"id":25188591,"url":"https://github.com/kleinpanic/bat0daemon","last_synced_at":"2025-07-08T01:33:47.575Z","repository":{"id":258291535,"uuid":"864784536","full_name":"kleinpanic/bat0daemon","owner":"kleinpanic","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-01T01:05:33.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T20:36:40.743Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/kleinpanic.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}},"created_at":"2024-09-29T06:40:30.000Z","updated_at":"2025-02-01T01:05:37.000Z","dependencies_parsed_at":"2025-02-01T02:19:13.765Z","dependency_job_id":"ee9256f8-c579-4c20-af46-58f0d2ed4b0b","html_url":"https://github.com/kleinpanic/bat0daemon","commit_stats":null,"previous_names":["kleinpanic/bat0daemon"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleinpanic%2Fbat0daemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleinpanic%2Fbat0daemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleinpanic%2Fbat0daemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleinpanic%2Fbat0daemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kleinpanic","download_url":"https://codeload.github.com/kleinpanic/bat0daemon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157278,"owners_count":20893221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-02-09T20:29:14.712Z","updated_at":"2025-04-04T10:14:25.273Z","avatar_url":"https://github.com/kleinpanic.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Battery Monitor Daemon\n\nA battery monitor daemon built in C using the GTK framework. The application monitors your system's battery level and provides notifications when the battery is low or critically low. It also implements battery-saving features like reducing screen brightness and managing background processes to help preserve battery life.\n\n---\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n  - [Dependencies](#dependencies)\n  - [Building and Installing the Application](#building-and-installing-the-application)\n- [Configuration](#configuration)\n  - [Adjusting Battery Thresholds](#adjusting-battery-thresholds)\n  - [Configuring Process Management](#configuring-process-management)\n- [Uninstallation](#uninstallation)\n- [Contributing](#contributing)\n\n## Features\n\n---\n\n- **Configurable Battery Thresholds**: Receive notifications when the battery level falls below user-defined thresholds for low and critical levels. Adjust these thresholds easily via a configuration file.\n\n- **Dynamic Monitoring Interval**: The application adjusts its battery level check interval based on the current battery percentage to optimize performance and responsiveness.\n\n- **Battery Saving Mode**:\n  - Reduces screen brightness to 50% when the battery is low.\n  - Suspends high CPU-consuming processes and user daemons to conserve battery life.\n  - Allows users to specify which processes to ignore during suspension.\n\n- **Logging**: Activity is logged to `/tmp/battery_monitor.log` for debugging and monitoring purposes.\n\n- **Systemd Service**: Runs as a user-level systemd service, starting automatically upon login.\n\n- **Version Checking**: Supports version checking for both the application and the accompanying scripts.\n\n---\n\n## Installation\n\n### Dependencies\n\nEnsure you have the following dependencies installed on your system:\n\n- **gcc**: GNU Compiler Collection for compiling the C code.\n- **make**: Utility for directing compilation.\n- **pkg-config**: Helper tool used during compilation.\n- **GTK+ 3 Development Libraries**: Library for creating graphical user interfaces.\n\n**On Debian/Ubuntu:**\n\n```bash\nsudo apt-get update\nsudo apt-get install build-essential pkg-config libgtk-3-dev\n```\n\n**On Fedora:**\n\n```bash\nsudo dnf install gcc make pkgconf-pkg-config gtk3-devel\n```\n\n**On Arch Linux:**\n\n```bash\nsudo pacman -S base-devel pkgconf gtk3\n```\n\n### Building and Installing the Application\n\n1. **Clone the Repository**\n\n   ```bash\n   git clone https://github.com/kleinpanic/bat0daemon.git\n   cd bat0daemon\n   ```\n\n2. **Run the Installation Script**\n\n   ```bash\n   ./install.sh\n   ```\n\n   The `install.sh` script will:\n\n   - Check for and install any missing dependencies.\n   - Build the application using `make`.\n   - Install the `battery_monitor` binary to `/usr/local/bin`.\n   - Install the `battery_daemon.sh` script to `/usr/local/bin`.\n   - Set up a user-level systemd service to run the application automatically on login.\n   - Create a default configuration file at `~/.config/battery_monitor/config.conf` if it does not exist.\n\n**Note**: The `install.sh` script may prompt for your password to use `sudo` for installation.\n\n---\n\n## Configuration\n\nThe application uses a configuration file located at `~/.config/battery_monitor/config.conf`. If the file does not exist, the `install.sh` script will create one with default values.\n\n### Adjusting Battery Thresholds\n\nEdit the configuration file to adjust battery thresholds:\n\n```ini\n# ~/.config/battery_monitor/config.conf\n\nthreshold_low=25\nthreshold_critical=5\nthreshold_high=80\n```\n\n- **threshold_low**: Battery percentage at which the application will send a low battery notification.\n- **threshold_critical**: Battery percentage at which the application will send a critical battery notification.\n- **threshold_high**: Battery percentage above which the application checks the battery level less frequently.\n\n### Configuring Process Management\n\nSpecify processes to ignore when the application suspends high CPU-consuming processes or user daemons:\n\n```ini\nignore_processes_for_kill=process1, process2, process3\nignore_processes_for_sleep=process4, process5, process6\n```\n\n- **ignore_processes_for_kill**: List of processes to ignore when suspending high CPU-consuming processes.\n- **ignore_processes_for_sleep**: List of processes to ignore when suspending user daemons.\n\n**Example**:\n\n```ini\nignore_processes_for_kill=firefox, code\nignore_processes_for_sleep=dropbox, slack\n```\n\n---\n\n## Uninstallation\n\nTo remove the application and its associated files:\n\n1. **Stop and Disable the Systemd Service**\n\n   ```bash\n   systemctl --user stop battery_monitor.service\n   systemctl --user disable battery_monitor.service\n   ```\n\n2. **Remove Installed Files**\n\n   ```bash\n   sudo rm /usr/local/bin/battery_monitor\n   sudo rm /usr/local/bin/battery_daemon.sh\n   ```\n\n3. **Remove the Systemd Service File**\n\n   ```bash\n   rm ~/.config/systemd/user/battery_monitor.service\n   ```\n\n4. **Reload the Systemd Daemon**\n\n   ```bash\n   systemctl --user daemon-reload\n   ```\n\n5. **Remove Configuration and Log Files (Optional)**\n\n   ```bash\n   rm -rf ~/.config/battery_monitor\n   rm /tmp/battery_monitor.log\n   ```\n\n6. **Clean Up Build Files**\n\n   ```bash\n   make clean\n   ```\n\n---\n\n## Contributing\n\nContributions are welcome! If you have ideas for new features, improvements, or bug fixes, feel free to fork the repository and submit a pull request. Let's make this application even better together.\n\n---\n\n**Additional Notes**:\n\n- **Battery Monitoring**: The application dynamically finds the battery device path, supporting systems with different battery naming conventions (e.g., `BAT0`, `BAT1`).\n\n- **Process Suspension**: The application can suspend non-critical background processes to conserve battery life when in battery-saving mode. Critical system processes are automatically excluded.\n\n- **Customization**: Users can tailor the application's behavior extensively through the configuration file.\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkleinpanic%2Fbat0daemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkleinpanic%2Fbat0daemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkleinpanic%2Fbat0daemon/lists"}