diff --git a/README.md b/README.md index 065ef893c37d3ab1c715632b103625906c38dc3d..ffbed5db7c9074ac6e11125f5d94ffcfa00644cd 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The tresholds and the actions to take are both configurable in `/etc/systemcshee Why not? It was a long and rough day and around 2AM, after 5-6 beers, it seemed to be a good idea to write a daemon for a task I wanted, but mostly for my personal amusement. This is generally intended as a joke, although for me it serves real purpose. -I didn't want to use any 3rd party service for monitoring my battery level, +I didn't want to use any 3rd party service for monitoring my battery level(s), because I know exactly what I want and how I want to do it and what configuration options I wish. Obviously this could have been done with a shell script in a cronjob, but it's not that fun. The task seemed easy enough to do for myself. This wants to be a small and easily usable software, and @@ -23,6 +23,11 @@ it would be really fun if other people used it or did something with it :slight_ Also, this is for learning in a fun, but somewhat productive way. +### Features +For system batteries you can configure three different tresholds (half, low, critical) and for each a corresponding action to take in the config file. For any treshold you can choose ignore it, get a notification, sleep or shut down the system. + +You can also monitor your wireless keyboard and/or mouse. At this time, only one device is supported, but later I want to add support for monitoring multiple wireless or other battery powered devices as well. `batteryd` can notify you if your keyboard or mouse is going to run out of power soon. You most probably want to get a notification, but nothing stops you from configuring sleep or shutdown for it as well :slight_smile: + ### Configuration `batteryd` can be configured with a `batteryd.conf` file located at `/etc/systemcshee/batteryd.conf` diff --git a/batteryd.conf.example b/batteryd.conf.example index fb6fb98a53bba29becd1641a8e58bcdb401ebeef..4ea8e42f1bf40e0887bbdc07db326f1585342204 100644 --- a/batteryd.conf.example +++ b/batteryd.conf.example @@ -4,40 +4,66 @@ # LICENSE: GNU GPL v3.0 # # -# There are three available battery levels: HALF, LOW, CRITICAL and their percentage value can be configured -# The values must be between 0 and 100 (although using 0 would not make much sense) +# There are three available battery levels: HALF, LOW, CRITICAL +# and their percentage value can be configured. +# The values must be between 0 and 100 (but using 0 would not make sense) # The following has to be true for a valid configuration: # TRESHOLD_HALF > TRESHOLD_LOW > TRESHOLD_CRITICAL # # The actions can be as follows: -# - "ignore": it does not do any action, and skips all other actions supplied for the given battery level. -# If no action is supplied for a level, batteryd will default to "ignore" -# - "notify": sends a notification to the user and informs them about the battery percentage via notify-send -# - "sleep": suspends system to RAM after a configured amount of time. (WAIT_TIME_SLEEP) -# - "shutdown": gracefully shuts down the system after a configured amount of time. (WAIT_TIME_SHUTDOWN) -# You can assign more actions to a battery level, separated by commas (no trailing comma and whitespace after comma allowed) -# The daemon will execute the actions in the order they are specified so "shutdown,notify" will not make any sense -# if WAIT_TIME_SHUTDOWN is set to 0 +# - "ignore": it does not do any action, and skips all other actions +# supplied for the given battery level. If no action is +# supplied for a level, batteryd will default to "ignore". +# - "notify": sends a notification to the user and informs them about +# the battery percentage via notify-send. +# - "sleep": suspends system to RAM after a configured amount of time. +# (WAIT_TIME_SLEEP) +# - "shutdown": gracefully shuts down the system after a configured +# amount of time. (WAIT_TIME_SHUTDOWN) +# +# You can assign more actions to a battery level, separated by commas +# (no trailing comma and whitespace after commas allowed). +# For example: ACTION_CRITICAL="notify,shutdown" +# +# The daemon will execute the actions in the order they are specified in, +# so "shutdown,notify" may not make any sense if +# WAIT_TIME_SHUTDOWN is set to 0 +# +# If a "shutdown" or "sleep" action has been started, but in the meantime +# a charger was connected, the action is immediately aborted and the user +# is sent a notification that the sleep or shutdown has been cancelled. +# System battery name (/sys/class/power_supply/<name>, defaults to BAT0) +SYSTEM_BATTERY_NAME=BAT0 -# HALF battery percentage treshold (usually 50%, but who knows!) +# HID battery name (/sys/class/power_supply/<name>) +# Uncomment this option to monitor you battery powered HID +# HID_BATTERY_NAME= + +# HALF battery percentage treshold (defaults to 50, but who knows!) TRESHOLD_HALF=50 -# Action(s) to do at HALF battery +# Action(s) to do at HALF battery (defaults to ignore) ACTION_HALF="notify" -# LOW battery percentage treshold (0-100) +# LOW battery percentage treshold (0-100, defaults to 30) TRESHOLD_LOW=30 -# Action(s) to do at LOW battery -ACTION_LOW="notify" +# Action(s) to do at LOW battery (defaults to ignore) +ACTION_LOW="ignore" # CRITICAL battery percentage treshold (0-100) TRESHOLD_CRITICAL=15 -# Action(s) to do at CRITICAL battery -ACTION_CRITICAL="notify,sleep" +# Action(s) to do at CRITICAL battery (defaults to notify) +ACTION_CRITICAL="notify" + +# Action(s) to do when HID battery is low (defaults to ignore) +ACTION_HID_LOW="ignore" + +# Action(s) to do when HID battery is critical (defaults to notify) +ACTION_HID_CRITICAL="notify" # Waiting times for actions (in seconds, maximum of 300) -# Waiting time for "sleep" action +# Waiting time for "sleep" action (default is 30) WAIT_TIME_SLEEP=30 -# Waiting time for "shutdown" action +# Waiting time for "shutdown" action (default is 60) WAIT_TIME_SHUTDOWN=60