summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraristocratos <gnmjpl@gmail.com>2023-07-26 14:38:48 +0200
committeraristocratos <gnmjpl@gmail.com>2023-07-26 14:38:48 +0200
commitaca2e4be7568186e122f1506fa25bdfb8c4f7f2a (patch)
tree2a7a8ff52cf96d2df47b44221dceff7aa0dfceb9 /src
parent33faa01910309895763011dce2a3194b889a0b6a (diff)
Fix whitespace indent -> tab indent
Diffstat (limited to 'src')
-rw-r--r--src/btop.cpp62
-rw-r--r--src/btop_config.cpp10
-rw-r--r--src/btop_config.hpp6
-rw-r--r--src/btop_draw.cpp200
-rw-r--r--src/btop_draw.hpp28
-rw-r--r--src/btop_input.cpp20
-rw-r--r--src/btop_input.hpp2
-rw-r--r--src/btop_menu.cpp74
-rw-r--r--src/btop_menu.hpp12
-rw-r--r--src/btop_shared.cpp10
-rw-r--r--src/btop_shared.hpp108
-rw-r--r--src/btop_theme.cpp62
-rw-r--r--src/btop_theme.hpp6
-rw-r--r--src/btop_tools.cpp242
-rw-r--r--src/btop_tools.hpp58
-rw-r--r--src/freebsd/btop_collect.cpp78
-rw-r--r--src/linux/btop_collect.cpp118
-rw-r--r--src/osx/btop_collect.cpp54
-rw-r--r--src/osx/sensors.cpp6
-rw-r--r--src/osx/sensors.hpp2
-rw-r--r--src/osx/smc.cpp22
-rw-r--r--src/osx/smc.hpp4
22 files changed, 592 insertions, 592 deletions
diff --git a/src/btop.cpp b/src/btop.cpp
index 55594da..73e42ee 100644
--- a/src/btop.cpp
+++ b/src/btop.cpp
@@ -4,7 +4,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -93,9 +93,9 @@ namespace Global {
string exit_error_msg;
atomic<bool> thread_exception (false);
- bool debuginit{}; // defaults to false
- bool debug{}; // defaults to false
- bool utf_force{}; // defaults to false
+ bool debuginit{}; // defaults to false
+ bool debug{}; // defaults to false
+ bool utf_force{}; // defaults to false
uint64_t start_time;
@@ -105,8 +105,8 @@ namespace Global {
atomic<bool> should_sleep (false);
atomic<bool> _runner_started (false);
- bool arg_tty{}; // defaults to false
- bool arg_low_color{}; // defaults to false
+ bool arg_tty{}; // defaults to false
+ bool arg_low_color{}; // defaults to false
int arg_preset = -1;
}
@@ -355,14 +355,14 @@ namespace Runner {
pthread_mutex_t& pt_mutex;
public:
int status;
- thread_lock(pthread_mutex_t& mtx) : pt_mutex(mtx) {
- pthread_mutex_init(&pt_mutex, NULL);
- status = pthread_mutex_lock(&pt_mutex);
- }
- ~thread_lock() {
- if (status == 0)
- pthread_mutex_unlock(&pt_mutex);
- }
+ thread_lock(pthread_mutex_t& mtx) : pt_mutex(mtx) {
+ pthread_mutex_init(&pt_mutex, NULL);
+ status = pthread_mutex_lock(&pt_mutex);
+ }
+ ~thread_lock() {
+ if (status == 0)
+ pthread_mutex_unlock(&pt_mutex);
+ }
};
//* Wrapper for raising priviliges when using SUID bit
@@ -370,18 +370,18 @@ namespace Runner {
int status = -1;
public:
gain_priv() {
- if (Global::real_uid != Global::set_uid)
- this->status = seteuid(Global::set_uid);
+ if (Global::real_uid != Global::set_uid)
+ this->status = seteuid(Global::set_uid);
}
~gain_priv() {
- if (status == 0)
- status = seteuid(Global::real_uid);
+ if (status == 0)
+ status = seteuid(Global::real_uid);
}
};
string output;
string empty_bg;
- bool pause_output{}; // defaults to false
+ bool pause_output{}; // defaults to false
sigset_t mask;
pthread_t runner_id;
pthread_mutex_t mtx;
@@ -437,7 +437,7 @@ namespace Runner {
}
//? ------------------------------- Secondary thread: async launcher and drawing ----------------------------------
- void * _runner(void *) {
+ void * _runner(void *) {
//? Block some signals in this thread to avoid deadlock from any signal handlers trying to stop this thread
sigemptyset(&mask);
// sigaddset(&mask, SIGINT);
@@ -480,8 +480,8 @@ namespace Runner {
//! DEBUG stats
if (Global::debug) {
- if (debug_bg.empty() or redraw)
- Runner::debug_bg = Draw::createBox(2, 2, 33, 8, "", true, "μs");
+ if (debug_bg.empty() or redraw)
+ Runner::debug_bg = Draw::createBox(2, 2, 33, 8, "", true, "μs");
@@ -517,7 +517,7 @@ namespace Runner {
if (Global::debug) debug_timer("cpu", draw_done);
}
catch (const std::exception& e) {
- throw std::runtime_error("Cpu:: -> " + string{e.what()});
+ throw std::runtime_error("Cpu:: -> " + string{e.what()});
}
}
@@ -537,7 +537,7 @@ namespace Runner {
if (Global::debug) debug_timer("mem", draw_done);
}
catch (const std::exception& e) {
- throw std::runtime_error("Mem:: -> " + string{e.what()});
+ throw std::runtime_error("Mem:: -> " + string{e.what()});
}
}
@@ -557,7 +557,7 @@ namespace Runner {
if (Global::debug) debug_timer("net", draw_done);
}
catch (const std::exception& e) {
- throw std::runtime_error("Net:: -> " + string{e.what()});
+ throw std::runtime_error("Net:: -> " + string{e.what()});
}
}
@@ -577,12 +577,12 @@ namespace Runner {
if (Global::debug) debug_timer("proc", draw_done);
}
catch (const std::exception& e) {
- throw std::runtime_error("Proc:: -> " + string{e.what()});
+ throw std::runtime_error("Proc:: -> " + string{e.what()});
}
}
}
catch (const std::exception& e) {
- Global::exit_error_msg = "Exception in runner thread -> " + string{e.what()};
+ Global::exit_error_msg = "Exception in runner thread -> " + string{e.what()};
Global::thread_exception = true;
Input::interrupt = true;
stopping = true;
@@ -659,7 +659,7 @@ namespace Runner {
//? ------------------------------------------ Secondary thread end -----------------------------------------------
//* Runs collect and draw in a secondary thread, unlocks and locks config to update cached values
- void run(const string& box, bool no_update, bool force_redraw) {
+ void run(const string& box, bool no_update, bool force_redraw) {
atomic_wait_for(active, true, 5000);
if (active) {
Logger::error("Stall in Runner thread, restarting!");
@@ -827,7 +827,7 @@ int main(int argc, char **argv) {
}
else {
string found;
- bool set_failure{}; // defaults to false
+ bool set_failure{}; // defaults to false
for (const auto loc_env : array{"LANG", "LC_ALL"}) {
if (std::getenv(loc_env) != NULL and str_to_upper(s_replace((string)std::getenv(loc_env), "-", "")).ends_with("UTF8")) {
found = std::getenv(loc_env);
@@ -923,7 +923,7 @@ int main(int argc, char **argv) {
Shared::init();
}
catch (const std::exception& e) {
- Global::exit_error_msg = "Exception in Shared::init() -> " + string{e.what()};
+ Global::exit_error_msg = "Exception in Shared::init() -> " + string{e.what()};
clean_quit(1);
}
@@ -1035,7 +1035,7 @@ int main(int argc, char **argv) {
}
}
catch (const std::exception& e) {
- Global::exit_error_msg = "Exception in main loop -> " + string{e.what()};
+ Global::exit_error_msg = "Exception in main loop -> " + string{e.what()};
clean_quit(1);
}
diff --git a/src/btop_config.cpp b/src/btop_config.cpp
index e5e8d13..25b68dd 100644
--- a/src/btop_config.cpp
+++ b/src/btop_config.cpp
@@ -4,7 +4,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -103,7 +103,7 @@ namespace Config {
{"proc_left", "#* Show proc box on left side of screen instead of right."},
- {"proc_filter_kernel", "#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop)."},
+ {"proc_filter_kernel", "#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop)."},
{"cpu_graph_upper", "#* Sets the CPU stat shown in upper half of the CPU graph, \"total\" is always available.\n"
"#* Select from a list of detected attributes from the options menu."},
@@ -234,7 +234,7 @@ namespace Config {
{"proc_cpu_graphs", true},
{"proc_info_smaps", false},
{"proc_left", false},
- {"proc_filter_kernel", false},
+ {"proc_filter_kernel", false},
{"cpu_invert_lower", true},
{"cpu_single_graph", false},
{"cpu_bottom", false},
@@ -383,7 +383,7 @@ namespace Config {
return false;
}
catch (const std::exception& e) {
- validError = string{e.what()};
+ validError = string{e.what()};
return false;
}
@@ -503,7 +503,7 @@ namespace Config {
boolsTmp.clear();
}
catch (const std::exception& e) {
- Global::exit_error_msg = "Exception during Config::unlock() : " + string{e.what()};
+ Global::exit_error_msg = "Exception during Config::unlock() : " + string{e.what()};
clean_quit(1);
}
diff --git a/src/btop_config.hpp b/src/btop_config.hpp
index bbebc9b..95c6b68 100644
--- a/src/btop_config.hpp
+++ b/src/btop_config.hpp
@@ -4,7 +4,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -65,7 +65,7 @@ namespace Config {
bool _locked(const string& name);
//* Return bool for config key <name>
- inline bool getB(const string& name) { return bools.at(name); }
+ inline bool getB(const string& name) { return bools.at(name); }
//* Return integer for config key <name>
inline const int& getI(const string& name) { return ints.at(name); }
@@ -81,7 +81,7 @@ namespace Config {
bool stringValid(const string& name, const string& value);
//* Set config key <name> to bool <value>
- inline void set(const string& name, bool value) {
+ inline void set(const string& name, bool value) {
if (_locked(name)) boolsTmp.insert_or_assign(name, value);
else bools.at(name) = value;
}
diff --git a/src/btop_draw.cpp b/src/btop_draw.cpp
index a31651c..44e8aa2 100644
--- a/src/btop_draw.cpp
+++ b/src/btop_draw.cpp
@@ -106,8 +106,8 @@ namespace Draw {
if (redraw) banner.clear();
if (banner.empty()) {
string b_color, bg, fg, oc, letter;
- auto lowcolor = Config::getB("lowcolor");
- auto tty_mode = Config::getB("tty_mode");
+ auto lowcolor = Config::getB("lowcolor");
+ auto tty_mode = Config::getB("tty_mode");
for (size_t z = 0; const auto& line : Global::Banner_src) {
if (const auto w = ulen(line[1]); w > width) width = w;
if (tty_mode) {
@@ -217,7 +217,7 @@ namespace Draw {
return first + Fx::bl + "█" + Fx::ubl + uresize(text.substr(pos), limit - ulen(first));
}
catch (const std::exception& e) {
- Logger::error("In TextEdit::operator() : " + string{e.what()});
+ Logger::error("In TextEdit::operator() : " + string{e.what()});
}
}
return text.substr(0, pos) + Fx::bl + "█" + Fx::ubl + text.substr(pos);
@@ -227,16 +227,16 @@ namespace Draw {
this->text.clear();
}
- string createBox(const int x, const int y, const int width,
- const int height, string line_color, bool fill,
- const string title, const string title2, const int num) {
+ string createBox(const int x, const int y, const int width,
+ const int height, string line_color, bool fill,
+ const string title, const string title2, const int num) {
string out;
- if (line_color.empty())
- line_color = Theme::c("div_line");
+ if (line_color.empty())
+ line_color = Theme::c("div_line");
- auto tty_mode = Config::getB("tty_mode");
- auto rounded = Config::getB("rounded_corners");
+ auto tty_mode = Config::getB("tty_mode");
+ auto rounded = Config::getB("rounded_corners");
const string numbering = (num == 0) ? "" : Theme::c("hi_fg") + (tty_mode ? std::to_string(num) : Symbols::superscript.at(clamp(num, 0, 9)));
const auto& right_up = (tty_mode or not rounded ? Symbols::right_up : Symbols::round_right_up);
const auto& left_up = (tty_mode or not rounded ? Symbols::left_up : Symbols::round_left_up);
@@ -246,12 +246,12 @@ namespace Draw {
out = Fx::reset + line_color;
//? Draw horizontal lines
- for (const int& hpos : {y, y + height - 1}) {
+ for (const int& hpos : {y, y + height - 1}) {
out += Mv::to(hpos, x) + Symbols::h_line * (width - 1);
}
//? Draw vertical lines and fill if enabled
- for (const int& hpos : iota(y + 1, y + height - 1)) {
+ for (const int& hpos : iota(y + 1, y + height - 1)) {
out += Mv::to(hpos, x) + Symbols::v_line
+ ((fill) ? string(width - 2, ' ') : Mv::r(width - 2))
+ Symbols::v_line;
@@ -289,8 +289,8 @@ namespace Draw {
{"/uptime", ""}
};
- static time_t c_time{}; // defaults to 0
- static size_t clock_len{}; // defaults to 0
+ static time_t c_time{}; // defaults to 0
+ static size_t clock_len{}; // defaults to 0
static string clock_str;
if (auto n_time = time(NULL); not force and n_time == c_time)
@@ -303,7 +303,7 @@ namespace Draw {
}
auto& out = Global::clock;
- auto cpu_bottom = Config::getB("cpu_bottom");
+ auto cpu_bottom = Config::getB("cpu_bottom");
const auto& x = Cpu::x;
const auto y = (cpu_bottom ? Cpu::y + Cpu::height - 1 : Cpu::y);
const auto& width = Cpu::width;
@@ -343,8 +343,8 @@ namespace Draw {
//* Meter class ------------------------------------------------------------------------------------------------------------>
Meter::Meter() {}
- Meter::Meter(const int width, const string& color_gradient, bool invert)
- : width(width), color_gradient(color_gradient), invert(invert) {}
+ Meter::Meter(const int width, const string& color_gradient, bool invert)
+ : width(width), color_gradient(color_gradient), invert(invert) {}
string Meter::operator()(int value) {
if (width < 1) return "";
@@ -366,7 +366,7 @@ namespace Draw {
//* Graph class ------------------------------------------------------------------------------------------------------------>
void Graph::_create(const deque<long long>& data, int data_offset) {
- bool mult = (data.size() - data_offset > 1);
+ bool mult = (data.size() - data_offset > 1);
const auto& graph_symbol = Symbols::graph_symbols.at(symbol + '_' + (invert ? "down" : "up"));
array<int, 2> result;
const float mod = (height == 1) ? 0.3 : 0.1;
@@ -436,11 +436,11 @@ namespace Draw {
Graph::Graph() {}
- Graph::Graph(int width, int height, const string& color_gradient,
- const deque<long long>& data, const string& symbol,
- bool invert, bool no_zero, long long max_value, long long offset)
- : width(width), height(height), color_gradient(color_gradient),
- invert(invert), no_zero(no_zero), offset(offset) {
+ Graph::Graph(int width, int height, const string& color_gradient,
+ const deque<long long>& data, const string& symbol,
+ bool invert, bool no_zero, long long max_value, long long offset)
+ : width(width), height(height), color_gradient(color_gradient),
+ invert(invert), no_zero(no_zero), offset(offset) {
if (Config::getB("tty_mode") or symbol == "tty") this->symbol = "tty";
else if (symbol != "default") this->symbol = symbol;
else this->symbol = Config::getS("graph_symbol");
@@ -464,7 +464,7 @@ namespace Draw {
this->_create(data, data_offset);
}
- string& Graph::operator()(const deque<long long>& data, bool data_same) {
+ string& Graph::operator()(const deque<long long>& data, bool data_same) {
if (data_same) return out;
//? Make room for new characters on graph
@@ -504,26 +504,26 @@ namespace Cpu {
vector<Draw::Graph> core_graphs;
vector<Draw::Graph> temp_graphs;
- string draw(const cpu_info& cpu, bool force_redraw, bool data_same) {
+ string draw(const cpu_info& cpu, bool force_redraw, bool data_same) {
if (Runner::stopping) return "";
if (force_redraw) redraw = true;
- bool show_temps = (Config::getB("check_temp") and got_sensors);
- auto single_graph = Config::getB("cpu_single_graph");
- bool hide_cores = show_temps and (cpu_temp_only or not Config::getB("show_coretemp"));
+ bool show_temps = (Config::getB("check_temp") and got_sensors);
+ auto single_graph = Config::getB("cpu_single_graph");
+ bool hide_cores = show_temps and (cpu_temp_only or not Config::getB("show_coretemp"));
const int extra_width = (hide_cores ? max(6, 6 * b_column_size) : 0);
auto& graph_up_field = Config::getS("cpu_graph_upper");
auto& graph_lo_field = Config::getS("cpu_graph_lower");
- auto tty_mode = Config::getB("tty_mode");
+ auto tty_mode = Config::getB("tty_mode");
auto& graph_symbol = (tty_mode ? "tty" : Config::getS("graph_symbol_cpu"));
auto& graph_bg = Symbols::graph_symbols.at((graph_symbol == "default" ? Config::getS("graph_symbol") + "_up" : graph_symbol + "_up")).at(6);
auto& temp_scale = Config::getS("temp_scale");
- auto cpu_bottom = Config::getB("cpu_bottom");
+ auto cpu_bottom = Config::getB("cpu_bottom");
const string& title_left = Theme::c("cpu_box") + (cpu_bottom ? Symbols::title_left_down : Symbols::title_left);
const string& title_right = Theme::c("cpu_box") + (cpu_bottom ? Symbols::title_right_down : Symbols::title_right);
static int bat_pos = 0, bat_len = 0;
- if (cpu.cpu_percent.at("total").empty()
- or cpu.core_percent.at(0).empty()
- or (show_temps and cpu.temp.at(0).empty())) return "";
+ if (cpu.cpu_percent.at("total").empty()
+ or cpu.core_percent.at(0).empty()
+ or (show_temps and cpu.temp.at(0).empty())) return "";
string out;
out.reserve(width * height);
@@ -550,15 +550,15 @@ namespace Cpu {
//? Graphs & meters
graph_upper = Draw::Graph{x + width - b_width - 3, graph_up_height, "cpu", cpu.cpu_percent.at(graph_up_field), graph_symbol, false, true};
cpu_meter = Draw::Meter{b_width - (show_temps ? 23 - (b_column_size <= 1 and b_columns == 1 ? 6 : 0) : 11), "cpu"};
- if (not single_graph) {
- graph_lower = Draw::Graph{
- x + width - b_width - 3,
- graph_low_height, "cpu",
- cpu.cpu_percent.at(graph_lo_field),
- graph_symbol,
- Config::getB("cpu_invert_lower"), true
- };
- }
+ if (not single_graph) {
+ graph_lower = Draw::Graph{
+ x + width - b_width - 3,
+ graph_low_height, "cpu",
+ cpu.cpu_percent.at(graph_lo_field),
+ graph_symbol,
+ Config::getB("cpu_invert_lower"), true
+ };
+ }
if (mid_line) {
out += Mv::to(y + graph_up_height + 1, x) + Fx::ub + Theme::c("cpu_box") + Symbols::div_left + Theme::c("div_line")
@@ -587,8 +587,8 @@ namespace Cpu {
//? Draw battery if enabled and present
if (Config::getB("show_battery") and has_battery) {
- static int old_percent{}; // defaults to = 0
- static long old_seconds{}; // defaults to = 0
+ static int old_percent{}; // defaults to = 0
+ static long old_seconds{}; // defaults to = 0
static string old_status;
static Draw::Meter bat_meter {10, "cpu", true};
static const unordered_flat_map<string, string> bat_symbols = {
@@ -659,7 +659,7 @@ namespace Cpu {
}
out += Theme::c("div_line") + Symbols::v_line;
- } catch (const std::exception& e) { throw std::runtime_error("graphs, clock, meter : " + string{e.what()}); }
+ } catch (const std::exception& e) { throw std::runtime_error("graphs, clock, meter : " + string{e.what()}); }
//? Core text and graphs
int cx = 0, cy = 1, cc = 0, core_width = (b_column_size == 0 ? 2 : 3);
@@ -741,17 +741,17 @@ namespace Mem {
unordered_flat_map<string, Draw::Meter> disk_meters_free;
unordered_flat_map<string, Draw::Graph> io_graphs;
- string draw(const mem_info& mem, bool force_redraw, bool data_same) {
+ string draw(const mem_info& mem, bool force_redraw, bool data_same) {
if (Runner::stopping) return "";
if (force_redraw) redraw = true;
- auto show_swap = Config::getB("show_swap");
- auto swap_disk = Config::getB("swap_disk");
- auto show_disks = Config::getB("show_disks");
- auto show_io_stat = Config::getB("show_io_stat");
- auto io_mode = Config::getB("io_mode");
- auto io_graph_combined = Config::getB("io_graph_combined");
- auto use_graphs = Config::getB("mem_graphs");
- auto tty_mode = Config::getB("tty_mode");
+ auto show_swap = Config::getB("show_swap");
+ auto swap_disk = Config::getB("swap_disk");
+ auto show_disks = Config::getB("show_disks");
+ auto show_io_stat = Config::getB("show_io_stat");
+ auto io_mode = Config::getB("io_mode");
+ auto io_graph_combined = Config::getB("io_graph_combined");
+ auto use_graphs = Config::getB("mem_graphs");
+ auto tty_mode = Config::getB("tty_mode");
auto& graph_symbol = (tty_mode ? "tty" : Config::getS("graph_symbol_mem"));
auto& graph_bg = Symbols::graph_symbols.at((graph_symbol == "default" ? Config::getS("graph_symbol") + "_up" : graph_symbol + "_up")).at(6);
auto totalMem = Mem::get_totalMem();
@@ -817,20 +817,20 @@ namespace Mem {
if (io_graph_combined) {
deque<long long> combined(disk.io_read.size(), 0);
rng::transform(disk.io_read, disk.io_write, combined.begin(), std::plus<long long>());
- io_graphs[name] = Draw::Graph{
- disks_width - (io_mode ? 0 : 6),
- disks_io_h, "available", combined,
- graph_symbol, false, true, speed};
+ io_graphs[name] = Draw::Graph{
+ disks_width - (io_mode ? 0 : 6),
+ disks_io_h, "available", combined,
+ graph_symbol, false, true, speed};
}
else {
- io_graphs[name + "_read"] = Draw::Graph{
- disks_width, half_height, "free",
- disk.io_read, graph_symbol, false,
- true, speed};
- io_graphs[name + "_write"] = Draw::Graph{
- disks_width, disks_io_h - half_height,
- "used", disk.io_write, graph_symbol,
- true, true, speed};
+ io_graphs[name + "_read"] = Draw::Graph{
+ disks_width, half_height, "free",
+ disk.io_read, graph_symbol, false,
+ true, speed};
+ io_graphs[name + "_write"] = Draw::Graph{
+ disks_width, disks_io_h - half_height,
+ "used", disk.io_write, graph_symbol,
+ true, true, speed};
}
}
}
@@ -900,7 +900,7 @@ namespace Mem {
if (show_disks) {
const auto& disks = mem.disks;
cx = mem_width; cy = 0;
- bool big_disk = disks_width >= 25;
+ bool big_disk = disks_width >= 25;
divider = Mv::l(1) + Theme::c("div_line") + Symbols::div_left + Symbols::h_line * disks_width + Theme::c("mem_box") + Fx::ub + Symbols::div_right + Mv::l(disks_width);
const string hu_div = Theme::c("div_line") + Symbols::h_line + Theme::c("main_fg");
if (io_mode) {
@@ -995,12 +995,12 @@ namespace Net {
unordered_flat_map<string, Draw::Graph> graphs;
string box;
- string draw(const net_info& net, bool force_redraw, bool data_same) {
+ string draw(const net_info& net, bool force_redraw, bool data_same) {
if (Runner::stopping) return "";
if (force_redraw) redraw = true;
- auto net_sync = Config::getB("net_sync");
- auto net_auto = Config::getB("net_auto");
- auto tty_mode = Config::getB("tty_mode");
+ auto net_sync = Config::getB("net_sync");
+ auto net_auto = Config::getB("net_auto");
+ auto tty_mode = Config::getB("tty_mode");
auto& graph_symbol = (tty_mode ? "tty" : Config::getS("graph_symbol_net"));
string ip_addr = (net.ipv4.empty() ? net.ipv6 : net.ipv4);
if (old_ip != ip_addr) {
@@ -1022,13 +1022,13 @@ namespace Net {
graphs.clear();
if (net.bandwidth.at("download").empty() or net.bandwidth.at("upload").empty())
return out + Fx::reset;
- graphs["download"] = Draw::Graph{
- width - b_width - 2, u_graph_height, "download",
- net.bandwidth.at("download"), graph_symbol,
- false, true, down_max};
- graphs["upload"] = Draw::Graph{
- width - b_width - 2, d_graph_height, "upload",
- net.bandwidth.at("upload"), graph_symbol, true, true, up_max};
+ graphs["download"] = Draw::Graph{
+ width - b_width - 2, u_graph_height, "download",
+ net.bandwidth.at("download"), graph_symbol,
+ false, true, down_max};
+ graphs["upload"] = Draw::Graph{
+ width - b_width - 2, d_graph_height, "upload",
+ net.bandwidth.at("upload"), graph_symbol, true, true, up_max};
//? Interface selector and buttons
@@ -1109,7 +1109,7 @@ namespace Proc {
auto selected = Config::getI("proc_selected");
auto last_selected = Config::getI("proc_last_selected");
const int select_max = (Config::getB("show_detailed") ? Proc::select_max - 8 : Proc::select_max);
- auto vim_keys = Config::getB("vim_keys");
+ auto vim_keys = Config::getB("vim_keys");
int numpids = Proc::numpids;
if ((cmd_key == "up" or (vim_keys and cmd_key == "k")) and selected > 0) {
@@ -1164,18 +1164,18 @@ namespace Proc {
return (not changed ? -1 : selected);
}
- string draw(const vector<proc_info>& plist, bool force_redraw, bool data_same) {
+ string draw(const vector<proc_info>& plist, bool force_redraw, bool data_same) {
if (Runner::stopping) return "";
- auto proc_tree = Config::getB("proc_tree");
- bool show_detailed = (Config::getB("show_detailed") and cmp_equal(Proc::detailed.last_pid, Config::getI("detailed_pid")));
- bool proc_gradient = (Config::getB("proc_gradient") and not Config::getB("lowcolor") and Theme::gradients.contains("proc"));
- auto proc_colors = Config::getB("proc_colors");
- auto tty_mode = Config::getB("tty_mode");
+ auto proc_tree = Config::getB("proc_tree");
+ bool show_detailed = (Config::getB("show_detailed") and cmp_equal(Proc::detailed.last_pid, Config::getI("detailed_pid")));
+ bool proc_gradient = (Config::getB("proc_gradient") and not Config::getB("lowcolor") and Theme::gradients.contains("proc"));
+ auto proc_colors = Config::getB("proc_colors");
+ auto tty_mode = Config::getB("tty_mode");
auto& graph_symbol = (tty_mode ? "tty" : Config::getS("graph_symbol_proc"));
auto& graph_bg = Symbols::graph_symbols.at((graph_symbol == "default" ? Config::getS("graph_symbol") + "_up" : graph_symbol + "_up")).at(6);
- auto mem_bytes = Config::getB("proc_mem_bytes");
- auto vim_keys = Config::getB("vim_keys");
- auto show_graphs = Config::getB("proc_cpu_graphs");
+ auto mem_bytes = Config::getB("proc_mem_bytes");
+ auto vim_keys = Config::getB("vim_keys");
+ auto show_graphs = Config::getB("proc_cpu_graphs");
start = Config::getI("proc_start");
selected = Config::getI("proc_selected");
const int y = show_detailed ? Proc::y + 8 : Proc::y;
@@ -1210,7 +1210,7 @@ namespace Proc {
//? Detailed box
if (show_detailed) {
- bool alive = detailed.status != "Dead";
+ bool alive = detailed.status != "Dead";
dgraph_x = x;
dgraph_width = max(width / 3, width - 121);
d_width = width - dgraph_width - 1;
@@ -1282,7 +1282,7 @@ namespace Proc {
}
//? Filter
- auto filtering = Config::getB("proc_filtering"); // ? filter(20) : Config::getS("proc_filter"))
+ auto filtering = Config::getB("proc_filtering"); // ? filter(20) : Config::getS("proc_filter"))
const auto filter_text = (filtering) ? filter(max(6, width - 58)) : uresize(Config::getS("proc_filter"), max(6, width - 58));
out += Mv::to(y, x+9) + title_left + (not filter_text.empty() ? Fx::b : "") + Theme::c("hi_fg") + 'f'
+ Theme::c("title") + (not filter_text.empty() ? ' ' + filter_text : "ilter")
@@ -1363,7 +1363,7 @@ namespace Proc {
//? Draw details box if shown
if (show_detailed) {
- bool alive = detailed.status != "Dead";
+ bool alive = detailed.status != "Dead";
const int item_fit = floor((double)(d_width - 2) / 10);
const int item_width = floor((double)(d_width - 2) / min(item_fit, 8));
@@ -1422,7 +1422,7 @@ namespace Proc {
}
//? Update graphs for processes with above 0.0% cpu usage, delete if below 0.1% 10x times
- bool has_graph = show_graphs ? p_counters.contains(p.pid) : false;
+ bool has_graph = show_graphs ? p_counters.contains(p.pid) : false;
if (show_graphs and ((p.cpu_p > 0 and not has_graph) or (not data_same and has_graph))) {
if (not has_graph) {
p_graphs[p.pid] = Draw::Graph{5, 1, "", {}, graph_symbol};
@@ -1579,10 +1579,10 @@ namespace Draw {
void calcSizes() {
atomic_wait(Runner::active);
Config::unlock();
- auto boxes = Config::getS("shown_boxes");
- auto cpu_bottom = Config::getB("cpu_bottom");
- auto mem_below_net = Config::getB("mem_below_net");
- auto proc_left = Config::getB("proc_left");
+ auto boxes = Config::getS("shown_boxes");
+ auto cpu_bottom = Config::getB("cpu_bottom");
+ auto mem_below_net = Config::getB("mem_below_net");
+ auto proc_left = Config::getB("proc_left");
Cpu::box.clear();
Mem::box.clear();
@@ -1612,7 +1612,7 @@ namespace Draw {
//* Calculate and draw cpu box outlines
if (Cpu::shown) {
using namespace Cpu;
- bool show_temp = (Config::getB("check_temp") and got_sensors);
+ bool show_temp = (Config::getB("check_temp") and got_sensors);
width = round((double)Term::width * width_p / 100);
height = max(8, (int)ceil((double)Term::height * (trim(boxes) == "cpu" ? 100 : height_p) / 100));
x = 1;
@@ -1651,9 +1651,9 @@ namespace Draw {
//* Calculate and draw mem box outlines
if (Mem::shown) {
using namespace Mem;
- auto show_disks = Config::getB("show_disks");
- auto swap_disk = Config::getB("swap_disk");
- auto mem_graphs = Config::getB("mem_graphs");
+ auto show_disks = Config::getB("show_disks");
+ auto swap_disk = Config::getB("swap_disk");
+ auto mem_graphs = Config::getB("mem_graphs");
width = round((double)Term::width * (Proc::shown ? width_p : 100) / 100);
height = ceil((double)Term::height * (100 - Cpu::height_p * Cpu::shown - Net::height_p * Net::shown) / 100) + 1;
diff --git a/src/btop_draw.hpp b/src/btop_draw.hpp
index 5fafa63..af57ed8 100644
--- a/src/btop_draw.hpp
+++ b/src/btop_draw.hpp
@@ -66,8 +66,8 @@ namespace Draw {
//* An editable text field
class TextEdit {
- size_t pos{}; // defaults to 0
- size_t upos{}; // defaults to 0
+ size_t pos{}; // defaults to 0
+ size_t upos{}; // defaults to 0
bool numeric;
public:
string text;
@@ -79,11 +79,11 @@ namespace Draw {
};
//* Create a box and return as a string
- string createBox(const int x, const int y, const int width,
- const int height, string line_color = "", bool fill = false,
- const string title = "", const string title2 = "", const int num = 0);
+ string createBox(const int x, const int y, const int width,
+ const int height, string line_color = "", bool fill = false,
+ const string title = "", const string title2 = "", const int num = 0);
- bool update_clock(bool force = false);
+ bool update_clock(bool force = false);
//* Class holding a percentage meter
class Meter {
@@ -93,7 +93,7 @@ namespace Draw {
array<string, 101> cache;
public:
Meter();
- Meter(const int width, const string& color_gradient, bool invert = false);
+ Meter(const int width, const string& color_gradient, bool invert = false);
//* Return a string representation of the meter with given value
string operator()(int value);
@@ -115,15 +115,15 @@ namespace Draw {
public:
Graph();
- Graph(int width, int height,
- const string& color_gradient,
- const deque<long long>& data,
- const string& symbol="default",
- bool invert=false, bool no_zero=false,
- long long max_value=0, long long offset=0);
+ Graph(int width, int height,
+ const string& color_gradient,
+ const deque<long long>& data,
+ const string& symbol="default",
+ bool invert=false, bool no_zero=false,
+ long long max_value=0, long long offset=0);
//* Add last value from back of <data> and return string representation of graph
- string& operator()(const deque<long long>& data, bool data_same=false);
+ string& operator()(const deque<long long>& data, bool data_same=false);
//* Return string representation of graph
string& operator()();
diff --git a/src/btop_input.cpp b/src/btop_input.cpp
index 3ec8c73..ebdee3b 100644
--- a/src/btop_input.cpp
+++ b/src/btop_input.cpp
@@ -4,7 +4,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unles