nfrastack/dms-tlpControl

May 21, 2026 · View on GitHub

About

TLP Control is a DankMaterialShell (DMS) plugin for laptops running TLP. It surfaces battery state, charge thresholds, health, and live discharge rate on a configurable bar pill, and adds a Control Center detail panel for runtime overrides TLP mode (force AC/BAT/auto), platform profile, energy performance preference (EPP), per-battery start/stop charge thresholds, and "full charge once". It is meant to replace existing Battery bars.

Features

  • Configurable cycling bar pill - click to step through any subset of:
    • Battery level with a dynamic battery icon (charging-aware: battery_full, battery_5_bar, battery_charging_80, etc.)
    • Charge thresholds (42% / 70->80
    • TLP mode (AC / BAT from /run/tlp/last_pwr)
    • Time remaining (3h 14m left / 2h 7m to full / Full)
    • Discharge / charge rate (−12.4 W / +8.2 W)
    • Battery health (Health 99%)
  • Control Center entry "TLP" with a detail panel:
    • Force AC / Force BAT / Auto buttons (tlp ac / tlp bat / tlp start)
    • Platform profile selector (/sys/firmware/acpi/platform_profile_choices, e.g. low-power / balanced / performance) - chips wrap automatically when narrow
    • EPP selector (/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences, e.g. performance / balance_performance / balance_power / power) - applies to all CPUs in one shell loop
    • Per-battery row: capacity, status, live wattage, health %, cycle count, time remaining/to-full, start/stop threshold sliders, Apply setting charge, Full charge once
  • Auto-detects all BAT* devices in /sys/class/power_supply/ (multi-battery laptops supported
  • All read paths are pure sysfs FileView (no privileges required

Maintainer

Table of Contents

Requirements

  • DankMaterialShell 1.5-beta or later
  • TLP installed and running
  • A laptop with at least one /sys/class/power_supply/BAT*
  • coreutils tee for the sudo write path
  • Optional but recommended: amd-pstate-epp or intel_pstate (active mode) for the EPP selector to populate; ACPI platform profile support (/sys/firmware/acpi/platform_profile) for the platform profile selector

Sudo setup

The plugin needs passwordless sudo for three things:

  • The tlp binary (force ac/bat/auto, setcharge, fullcharge)
  • tee writing to /sys/firmware/acpi/platform_profile
  • tee writing to /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference

Set the following sudo rules:

    username ALL=(root) NOPASSWD: tlp, \
                                  tee /sys/firmware/acpi/platform_profile, \
                                  tee /sys/devices/system/cpu/cpu[0-9]*/cpufreq/energy_performance_preference
sudo -n tlp-stat -s
echo balanced       | sudo -n tee /sys/firmware/acpi/platform_profile
echo balance_power  | sudo -n tee /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference

Screenshots

  • Overview Overview

  • Settings Settings

Installation

mkdir -p ~/.config/DankMaterialShell/plugins/
git clone https://github.com/nfrastack/dms-tlpControl ~/.config/DankMaterialShell/plugins/tlpControl
  • Reload DMS, then enable TLP Control in Settings -> Plugins.
  • Add a Widget to a taskbar
  • Add a pill to Control Center

Configuration

KeyTypeDescriptionDefault
sudoCmdstringSudo command. Use doas if you prefer doas. Always invoked with -n (non-interactive).sudo
tlpBinstringTLP binary. Bare tlp if on PATH for the sudo target user, or absolute path.tlp
enabledPillModesarray of stringsBar pill cycle modes in order. Allowed: level, thresholds, mode, time, power, health.All six, in that order
debugLogboolPrint sudo invocations + battery detection to journalctl --user -t dms.false

The settings page lets you toggle each pill mode on/off and reorder them with ▲/▼ buttons; the first enabled mode is the default shown on DMS startup.

Usage

  • Bar pill: click cycles through the modes you've enabled, in your chosen order. The pill icon is dynamic and changes shape with capacity and charging state.
  • Control Center -> TLP: opens the detail panel with all controls.
  • All actions are temporary - TLP re-applies its *_ON_AC / *_ON_BAT config on the next AC↔BAT swap or tlp start. To make changes permanent, edit /etc/tlp.conf.

Permissions

The plugin requests:

  • settings_read - read pill mode order, sudoCmd, tlpBin, debugLog
  • settings_write - save edits from the settings page
  • process - invoke sudo, tee, tlp, tlp-stat, ls /sys/..., wc

Caveats

  • All overrides are temporary - TLP re-applies its PLATFORM_PROFILE_ON_AC/_ON_BAT, CPU_ENERGY_PERF_POLICY_ON_AC/_ON_BAT, and charge thresholds on every power transition or tlp start. To persist changes, edit your tlp configuration.
  • "Full charge once" is a one-shot until next AC unplug - TLP design.
  • Platform profile / EPP sections hide automatically if the relevant sysfs choices file doesn't exist or CPU not running amd-pstate-epp/intel_pstate active.
  • Time remaining and wattage require /sys/class/power_supply/BAT*/power_now and energy_now. Some hardware reports these intermittently or always zero, the plugin gracefully falls back to capacity only display.

Troubleshooting

  • Bar pill stuck at "…": open verbose log, look for tlpControl: BAT0 capacity=… lines. If you see no such lines, sysfs /sys/class/power_supply/BAT0/capacity isn't readable.
  • "Force BAT" / "Apply" do nothing: Add sudo rules as noted above. If any prompts for a password, your sudoers rule isn't matching the actual binary path. Compare which tlp to the path your rule references.
  • Platform profile selector hidden: cat /sys/firmware/acpi/platform_profile_choices returns empty or the file doesn't exist on your hardware.
  • EPP selector hidden: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver should return amd-pstate-epp or intel_pstate. If it's acpi-cpufreq or similar, EPP isn't supported.

Support & Maintenance

  • For community help, tips, and community discussions, visit the Discussions board.
  • For personalized support or a support agreement, see Nfrastack Support.
  • To report bugs, submit a Bug Report. Usage questions may be closed as not-a-bug.
  • Feature requests are welcome, but not guaranteed. For prioritized development, consider a support agreement.
  • Updates are best-effort, with priority given to active production use and support agreements.

License

MIT. See the LICENSE file.