1
2
Fork
You've already forked dtbd
0
Duct Tape Battery Daemon
  • Rust 97.2%
  • Shell 2.8%
2026年05月10日 01:18:01 +03:00
src oops 2026年05月10日 01:18:01 +03:00
.gitignore Initial commit 2025年10月11日 22:25:57 +03:00
Cargo.lock exit instead of killing if already running 2026年05月07日 12:05:32 +03:00
Cargo.toml oops 2026年05月10日 01:18:01 +03:00
LICENSE and some of this 2025年10月11日 22:30:51 +03:00
README.md add multiplatform notices (my first Codeberg star yay) 2026年02月12日 16:11:05 +02:00

what a catchy name rdsq/dtbd not a single vowel

Duct Tape Battery Daemon (dtbd)

What does a programmer do when they don't find a tool that they need and feel too lazy to search better? That's right, they write their own

So anyway, this is a thing for Linux that sends you notifications when your battery is low or it's time to unplug the charger

Usage

Install it:

cargo install --git https://codeberg.org/rdsq/dtbd

And then you just call it with ~/.cargo/bin/dtbd

For example, you can add this to Hyprland:

exec-once = ~/.cargo/bin/dtbd

Config

You can configure this thing (how unexpected!)

Normally it looks for config at ~/.config/dtbd/dtbd.toml but can be set explicitly with --config option

In a config file, you define the sectors of battery or something. So the thing looks like:

# this is the default config
[[low]]
percent = 20 # below which it sends a notification
message = "Battery low (20%)" # the text of the notification
[[low]]
percent = 10
message = "Battery low (10%)"
[[low]]
percent = 5
message = "Battery low (5%)"
subtitle = "your last warning " # additional text
[[charged]] # (you can skip this one if you prefer)
percent = 80 # above which sends a notification (but only when charging)
message = "Battery charged (80%)"
subtitle = "Take care of your battery health"
[general_low]
urgency = "normal" # can be "low" | "normal" | "critical"
icon = "battery-low-symbolic" # the icon of the notification, from default icon theme
[general_charged]
urgency = "normal" # can also be defined in each entry individually
icon = "battery-level-100-charged-symbolic" # this one too

Usage (complicated)

Since this is a duct tape battery daemon, it consists of a few components: dtbd-listener, dtbd-finder, dtbd-main

  • dtbd-listener listens to upower and tries to guess when battery status updates
  • dtbd-finder finds the battery directory on the system
  • dtbd-main is the main thing that sends notifications

And dtbd is the duct tape of this battery daemon, putting it all together in its default order, though you can make your own. You can see the script at src/script.sh

If you want to test your configuration without waiting or ruining your battery, you can just run dtbd-main and pass any battery status you want to its stdin. It expects input in format <percent> <status>, for example 37 Discharging, or 37 d for short

Operating Systems

This project was created for Linux/XDG, so it assumes Linux, but because it is duct tape some components should theoretically work on other systems too, where "theoretically" means "untested and probably not something you'd want to do because that's out of scope of this project and you might not need it there"

  • dtbd-listener should work where UPower works, so XDG
  • dtbd-finder assumes Linux sysfs, so nope
  • dtbd-main uses notify_rust which works on XDG (Linux, BSD, etc.) and to limited extent on macOS and Windows. dtbd-main also assumes XDG config directory conventions so maybe override that with --config on non XDG systems
  • dtbd relies on dtbd-finder, so will not work by default