1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00

add new options console_bar_{fill,unfill} (#624)

This commit is contained in:
lasers 2018-08-17 12:46:40 -05:00 committed by GitHub
parent a4cb740508
commit 84e1eec2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 2 deletions

View File

@ -72,6 +72,24 @@
(#).
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>console_bar_fill</option>
</command>
</term>
<listitem>A character to fill the console bars. (default: '#')
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>console_bar_unfill</option>
</command>
</term>
<listitem>A character to unfill the console bars. (default: '.')
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>

View File

@ -273,6 +273,8 @@ void format_seconds_short(char *buf, unsigned int n, long seconds) {
}
conky::simple_config_setting<bool> no_buffers("no_buffers", true, true);
conky::simple_config_setting<std::string> bar_fill("console_bar_fill", "#", false);
conky::simple_config_setting<std::string> bar_unfill("console_bar_unfill", ".", false);
void update_stuff() {
/* clear speeds, addresses and up status in case device was removed and

View File

@ -74,6 +74,8 @@ int round_to_int_temp(float);
unsigned int round_to_int(float);
extern conky::simple_config_setting<bool> no_buffers;
extern conky::simple_config_setting<std::string> bar_fill;
extern conky::simple_config_setting<std::string> bar_unfill;
int open_acpi_temperature(const char *name);
double get_acpi_temperature(int fd);

View File

@ -40,6 +40,7 @@
#include "colours.h"
#include <algorithm>
#include <sstream>
#include "common.h"
struct special_t *specials = nullptr;
@ -697,11 +698,11 @@ static void new_bar_in_shell(struct text_object *obj, char *buffer,
scaledusage = round_to_int(usage * width / b->scale);
for (i = 0; i < scaledusage; i++) {
buffer[i] = '#';
buffer[i] = *(bar_fill.get(*state).c_str());
}
for (; i < width; i++) {
buffer[i] = '_';
buffer[i] = *(bar_unfill.get(*state).c_str());
}
buffer[i] = 0;