Home

Awesome

Wezterm Battery Module

A battery module for Wezterm that provides information about battery status, including charge levels and remaining time.

This module is designed to enhance your terminal experience by displaying battery statistics in a visually appealing way.

Requirements

Features

Installation

To use this module in your WezTerm configuration, include it as a plugin:

local wezterm = require("wezterm")
local config = wezterm.config_builder()
local battery = wezterm.plugin.require("https://github.com/rootiest/battery.wez")
battery.invert = true -- Optionally invert the color brightness
battery.apply_to_config(config) -- Optionally apply the necessary config settings

Usage

Get Battery Information

You can get detailed battery information using the following functions:

Configuration Options

You can set the invert option to change the color brightness of the battery icons/text to match your terminal's background:

battery.invert = true  -- Enable color brightness inversion

Applications

tabline.wez

To use the battery module in the tabline.wez plugin, use the following method:

local wezterm = require("wezterm")
local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez")

local battery = wezterm.plugin.require("https://github.com/rootiest/battery.wez")
battery.invert = true -- Optionally invert the color brightness

tabline.setup({
  -- etc
  sections = {
    -- etc
    tabline_z = {
      batteries.get_battery_icons,
    },
  },
})

This will add the battery icons to the end of the tabline.

Native tab-bar

To use the battery module in the native tab-bar, use the following method:

local wezterm = require("wezterm")
local config = wezterm.config_builder()

local battery = wezterm.plugin.require("https://github.com/rootiest/battery.wez")
battery.apply_to_config(config) -- Optionally apply the necessary config settings

wezterm.on("update-right-status", function(window, _)
  window:set_right_status(battery.get_battery_icons())
end)

This will add the battery icons to the right status bar.

API Reference

Module: battery

License

This project is licensed under the MIT License. See the LICENSE file for more details.