added patches

This commit is contained in:
λmolinae 2025-03-12 08:38:50 -06:00
parent f68f49273e
commit 8c6890f943
13 changed files with 395 additions and 205 deletions

View file

@ -1,10 +1,29 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../slstatus.h"
#include "../util.h"
const char *
battery_icon(const char *bat)
{
unsigned long ul_perc;
const char *perc, *state;
static const char *icons[][11] = {
{ "󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹" },
{ "󰢟", "󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅" },
};
if (!(perc = battery_perc(bat)) || !(state = battery_state(bat)))
return NULL;
ul_perc = strtoul(perc, NULL, 10);
return bprintf("%s %d", icons[state[0] == '+'][ul_perc / 10], ul_perc);
}
#if defined(__linux__)
/*
* https://www.kernel.org/doc/html/latest/power/power_supply_class.html