Create a polybar module

  1. Why
  2. Code
    1. Config polybar
    2. Script

Why

I had xfce4 panel, and I miss some informations like the remaining battery.

Code

Config polybar

In the config file ./config.polybar/config.

[module/discharge]
type = custom/script
exec = ~/.config/polybar/discharge.sh
format-underline = ${colors.white}

You also have to tell where gonna be the output.
In the config file:

modules-right = filesystem xbacklight alsa pulseaudio wlan eth battery discharge  date powermenu

You have to add the name of your module, but it can be where you want.

Script

In ./config/polybar/discharge.sh
`

#! /bin/bash

a=$(upower -i `upower -e | grep 'BAT'` |grep "time to")
echo $a

It’s ugly, I will change the text later.

©2021 Peanutstick’s Blog

Built with Hexo and 3-hexo theme