mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-05 05:28:32 +00:00
use clang-format
This commit is contained in:
parent
02ec45dc03
commit
033508a93e
16
src/cmus.cc
16
src/cmus.cc
@ -99,12 +99,12 @@ void cmus_cb::work() {
|
|||||||
|
|
||||||
} else if (strncmp(line, "position ", 9) == 0) {
|
} else if (strncmp(line, "position ", 9) == 0) {
|
||||||
cmus.curtime = line + 9;
|
cmus.curtime = line + 9;
|
||||||
cmus.timeleft =
|
cmus.timeleft = strtol(cmus.totaltime.c_str(), nullptr, 10) -
|
||||||
strtol(cmus.totaltime.c_str(), nullptr, 10) -
|
strtol(cmus.curtime.c_str(), nullptr, 10);
|
||||||
strtol(cmus.curtime.c_str(), nullptr, 10);
|
|
||||||
if (cmus.curtime.size() > 0) {
|
if (cmus.curtime.size() > 0) {
|
||||||
cmus.progress = static_cast<float>(strtol(cmus.curtime.c_str(), nullptr, 10)) /
|
cmus.progress =
|
||||||
strtol(cmus.totaltime.c_str(), nullptr, 10);
|
static_cast<float>(strtol(cmus.curtime.c_str(), nullptr, 10)) /
|
||||||
|
strtol(cmus.totaltime.c_str(), nullptr, 10);
|
||||||
} else {
|
} else {
|
||||||
cmus.progress = 0;
|
cmus.progress = 0;
|
||||||
}
|
}
|
||||||
@ -189,7 +189,8 @@ void print_cmus_totaltime(struct text_object *obj, char *p,
|
|||||||
lround(music_player_interval.get(*state) / active_update_interval()), 1l);
|
lround(music_player_interval.get(*state) / active_update_interval()), 1l);
|
||||||
const cmus_result &cmus =
|
const cmus_result &cmus =
|
||||||
conky::register_cb<cmus_cb>(period)->get_result_copy();
|
conky::register_cb<cmus_cb>(period)->get_result_copy();
|
||||||
format_seconds_short(p, p_max_size, strtol(cmus.totaltime.c_str(), nullptr, 10));
|
format_seconds_short(p, p_max_size,
|
||||||
|
strtol(cmus.totaltime.c_str(), nullptr, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_cmus_timeleft(struct text_object *obj, char *p,
|
void print_cmus_timeleft(struct text_object *obj, char *p,
|
||||||
@ -209,7 +210,8 @@ void print_cmus_curtime(struct text_object *obj, char *p,
|
|||||||
lround(music_player_interval.get(*state) / active_update_interval()), 1l);
|
lround(music_player_interval.get(*state) / active_update_interval()), 1l);
|
||||||
const cmus_result &cmus =
|
const cmus_result &cmus =
|
||||||
conky::register_cb<cmus_cb>(period)->get_result_copy();
|
conky::register_cb<cmus_cb>(period)->get_result_copy();
|
||||||
format_seconds_short(p, p_max_size, strtol(cmus.curtime.c_str(), nullptr, 10));
|
format_seconds_short(p, p_max_size,
|
||||||
|
strtol(cmus.curtime.c_str(), nullptr, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CMUS_PRINT_GENERATOR
|
#undef CMUS_PRINT_GENERATOR
|
||||||
|
@ -525,7 +525,8 @@ void print_cached(struct text_object *obj, char *p, unsigned int p_max_size) {
|
|||||||
p_max_size);
|
p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_free_bufcache(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void print_free_bufcache(struct text_object *obj, char *p,
|
||||||
|
unsigned int p_max_size) {
|
||||||
human_readable(apply_base_multiplier(obj->data.s, info.free_bufcache), p,
|
human_readable(apply_base_multiplier(obj->data.s, info.free_bufcache), p,
|
||||||
p_max_size);
|
p_max_size);
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,13 @@ long cap_scaled_color(long colour) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void scaled_rgb_to_scaled_hcl(long *const rgb, long *hcl) {
|
void scaled_rgb_to_scaled_hcl(long *const rgb, long *hcl) {
|
||||||
long value = rgb[0] > rgb[1] ? std::max(rgb[0], rgb[2]) : std::max(rgb[1], rgb[2]);
|
long value =
|
||||||
long minimum = rgb[0] < rgb[1] ? std::min(rgb[0], rgb[2]) : std::min(rgb[1], rgb[2]);
|
rgb[0] > rgb[1] ? std::max(rgb[0], rgb[2]) : std::max(rgb[1], rgb[2]);
|
||||||
|
long minimum =
|
||||||
|
rgb[0] < rgb[1] ? std::min(rgb[0], rgb[2]) : std::min(rgb[1], rgb[2]);
|
||||||
long chroma = value - minimum;
|
long chroma = value - minimum;
|
||||||
long luma = (2627L * rgb[0] + 6780L * rgb[1] + 593L * rgb[2]) / 10000L; //Use Rec.2020 color space
|
long luma = (2627L * rgb[0] + 6780L * rgb[1] + 593L * rgb[2]) /
|
||||||
|
10000L; // Use Rec.2020 color space
|
||||||
long hue;
|
long hue;
|
||||||
|
|
||||||
if (chroma == 0) {
|
if (chroma == 0) {
|
||||||
@ -112,7 +115,8 @@ void scaled_hcl_to_scaled_rgb(long *const hcl, long *rgb) {
|
|||||||
long luma = hcl[2] / 360L;
|
long luma = hcl[2] / 360L;
|
||||||
|
|
||||||
long h = hue / 60L;
|
long h = hue / 60L;
|
||||||
long x = (chroma * (CONST_SCALE - std::abs(h % CONST_SCALE2 - CONST_SCALE))) / CONST_SCALE;
|
long x = (chroma * (CONST_SCALE - std::abs(h % CONST_SCALE2 - CONST_SCALE))) /
|
||||||
|
CONST_SCALE;
|
||||||
long m;
|
long m;
|
||||||
|
|
||||||
// use Rec.2020 color space
|
// use Rec.2020 color space
|
||||||
@ -153,7 +157,8 @@ void scaled_hcl_to_scaled_rgb(long *const hcl, long *rgb) {
|
|||||||
rgb[2] = cap_scaled_color(rgb[2]);
|
rgb[2] = cap_scaled_color(rgb[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_to_scaled_rgb(unsigned long colour, long *scaled, int redshift, int greenshift) {
|
void rgb_to_scaled_rgb(unsigned long colour, long *scaled, int redshift,
|
||||||
|
int greenshift) {
|
||||||
long red = (colour & redmask) >> redshift;
|
long red = (colour & redmask) >> redshift;
|
||||||
long green = (colour & greenmask) >> greenshift;
|
long green = (colour & greenmask) >> greenshift;
|
||||||
long blue = colour & bluemask;
|
long blue = colour & bluemask;
|
||||||
@ -167,7 +172,8 @@ void rgb_to_scaled_rgb(unsigned long colour, long *scaled, int redshift, int gre
|
|||||||
scaled[2] = to_decimal_scale(blue, blue_max);
|
scaled[2] = to_decimal_scale(blue, blue_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long scaled_rgb_to_rgb(long *const scaled, int redshift, int greenshift) {
|
unsigned long scaled_rgb_to_rgb(long *const scaled, int redshift,
|
||||||
|
int greenshift) {
|
||||||
long red_max = redmask >> redshift;
|
long red_max = redmask >> redshift;
|
||||||
long green_max = greenmask >> greenshift;
|
long green_max = greenmask >> greenshift;
|
||||||
|
|
||||||
@ -200,9 +206,7 @@ std::unique_ptr<unsigned long[]> do_hcl_gradient(int width,
|
|||||||
|
|
||||||
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
|
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
|
||||||
|
|
||||||
if (colour_depth == 0) {
|
if (colour_depth == 0) { set_up_gradient(); }
|
||||||
set_up_gradient();
|
|
||||||
}
|
|
||||||
|
|
||||||
rgb_to_scaled_rgb(first_colour, first_colour_rgb, redshift, greenshift);
|
rgb_to_scaled_rgb(first_colour, first_colour_rgb, redshift, greenshift);
|
||||||
rgb_to_scaled_rgb(last_colour, last_colour_rgb, redshift, greenshift);
|
rgb_to_scaled_rgb(last_colour, last_colour_rgb, redshift, greenshift);
|
||||||
@ -217,9 +221,9 @@ std::unique_ptr<unsigned long[]> do_hcl_gradient(int width,
|
|||||||
colours[width - 1] = last_colour;
|
colours[width - 1] = last_colour;
|
||||||
|
|
||||||
long divisor = width - 1;
|
long divisor = width - 1;
|
||||||
long hueDelta = hueDiff/divisor;
|
long hueDelta = hueDiff / divisor;
|
||||||
long chromaDelta = chromaDiff/divisor;
|
long chromaDelta = chromaDiff / divisor;
|
||||||
long lumaDelta = lumaDiff/divisor;
|
long lumaDelta = lumaDiff / divisor;
|
||||||
|
|
||||||
for (int i = 1; i < (width - 1); i++) {
|
for (int i = 1; i < (width - 1); i++) {
|
||||||
long h = first_colour_hcl[0] + hueDelta;
|
long h = first_colour_hcl[0] + hueDelta;
|
||||||
|
@ -192,7 +192,7 @@ int update_meminfo(void) {
|
|||||||
info.memmax = info.memdirty = info.swap = info.swapfree = info.swapmax =
|
info.memmax = info.memdirty = info.swap = info.swapfree = info.swapmax =
|
||||||
info.memwithbuffers = info.buffers = info.cached = info.memfree =
|
info.memwithbuffers = info.buffers = info.cached = info.memfree =
|
||||||
info.memeasyfree = info.legacymem = info.shmem = info.memavail =
|
info.memeasyfree = info.legacymem = info.shmem = info.memavail =
|
||||||
info.free_bufcache = 0;
|
info.free_bufcache = 0;
|
||||||
|
|
||||||
if (!(meminfo_fp = open_file("/proc/meminfo", &reported))) { return 0; }
|
if (!(meminfo_fp = open_file("/proc/meminfo", &reported))) { return 0; }
|
||||||
|
|
||||||
@ -1585,7 +1585,7 @@ char get_freq(char *p_client_buffer, size_t client_buffer_size,
|
|||||||
|
|
||||||
/* print the CPU scaling governor */
|
/* print the CPU scaling governor */
|
||||||
void print_cpugovernor(struct text_object *obj, char *p,
|
void print_cpugovernor(struct text_object *obj, char *p,
|
||||||
unsigned int p_max_size) {
|
unsigned int p_max_size) {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
unsigned int cpu = obj->data.i;
|
unsigned int cpu = obj->data.i;
|
||||||
|
@ -1032,8 +1032,7 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
|||||||
if (value != -1) {
|
if (value != -1) {
|
||||||
if (nvs->is_percentage) {
|
if (nvs->is_percentage) {
|
||||||
percent_print(p, p_max_size, value);
|
percent_print(p, p_max_size, value);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
snprintf(p, p_max_size, "%d", value);
|
snprintf(p, p_max_size, "%d", value);
|
||||||
}
|
}
|
||||||
} else if (str != nullptr) {
|
} else if (str != nullptr) {
|
||||||
|
@ -419,7 +419,7 @@ void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size,
|
|||||||
if (out_to_stdout.get(*state)) {
|
if (out_to_stdout.get(*state)) {
|
||||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||||
}
|
}
|
||||||
#else /* BUILD_GUI */
|
#else /* BUILD_GUI */
|
||||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ void new_bar(struct text_object *obj, char *p, unsigned int p_max_size,
|
|||||||
if (out_to_stdout.get(*state)) {
|
if (out_to_stdout.get(*state)) {
|
||||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||||
}
|
}
|
||||||
#else /* BUILD_GUI */
|
#else /* BUILD_GUI */
|
||||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
}
|
}
|
||||||
|
27482
tests/catch2/catch.hpp
27482
tests/catch2/catch.hpp
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user