diff --git a/src/btop_draw.cpp b/src/btop_draw.cpp index 3c3a41e..3ae4210 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) { @@ -232,8 +232,8 @@ namespace Draw { const string title, const string title2, const int num) { string out; if (line_color.empty()) line_color = Theme::c("div_line"); - const auto& tty_mode = Config::getB("tty_mode"); - const auto& rounded = Config::getB("rounded_corners"); + const auto tty_mode = Config::getB("tty_mode"); + const 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); @@ -504,16 +504,16 @@ namespace Cpu { if (Runner::stopping) return ""; if (force_redraw) redraw = true; const bool show_temps = (Config::getB("check_temp") and got_sensors); - auto& single_graph = Config::getB("cpu_single_graph"); + auto single_graph = Config::getB("cpu_single_graph"); const 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; @@ -725,14 +725,14 @@ namespace Mem { string draw(const mem_info& mem, const bool force_redraw, const 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(); @@ -979,9 +979,9 @@ namespace Net { string draw(const net_info& net, const bool force_redraw, const 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) { @@ -1090,7 +1090,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) { @@ -1147,16 +1147,16 @@ namespace Proc { string draw(const vector& plist, const bool force_redraw, const bool data_same) { if (Runner::stopping) return ""; - auto& proc_tree = Config::getB("proc_tree"); + auto proc_tree = Config::getB("proc_tree"); const bool show_detailed = (Config::getB("show_detailed") and cmp_equal(Proc::detailed.last_pid, Config::getI("detailed_pid"))); const 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_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; @@ -1263,7 +1263,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") @@ -1557,10 +1557,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(); @@ -1629,9 +1629,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_input.cpp b/src/btop_input.cpp index 43d7a6d..3a09152 100644 --- a/src/btop_input.cpp +++ b/src/btop_input.cpp @@ -238,8 +238,8 @@ namespace Input { void process(const string& key) { if (key.empty()) return; try { - auto& filtering = Config::getB("proc_filtering"); - auto& vim_keys = Config::getB("vim_keys"); + auto filtering = Config::getB("proc_filtering"); + auto vim_keys = Config::getB("vim_keys"); auto help_key = (vim_keys ? "H" : "h"); auto kill_key = (vim_keys ? "K" : "k"); //? Global input actions diff --git a/src/btop_menu.cpp b/src/btop_menu.cpp index 71696f1..3ca22da 100644 --- a/src/btop_menu.cpp +++ b/src/btop_menu.cpp @@ -929,7 +929,7 @@ namespace Menu { static int selected{}; // defaults to 0 static vector colors_selected; static vector colors_normal; - auto& tty_mode = Config::getB("tty_mode"); + auto tty_mode = Config::getB("tty_mode"); if (bg.empty()) selected = 0; int retval = Changed; @@ -1034,8 +1034,8 @@ namespace Menu { {"cpu_sensor", std::cref(Cpu::available_sensors)}, {"selected_battery", std::cref(Config::available_batteries)}, }; - auto& tty_mode = Config::getB("tty_mode"); - auto& vim_keys = Config::getB("vim_keys"); + auto tty_mode = Config::getB("tty_mode"); + auto vim_keys = Config::getB("vim_keys"); if (max_items == 0) { for (const auto& cat : categories) { if ((int)cat.size() > max_items) max_items = cat.size(); diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index c8b2fe1..3bed684 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -808,10 +808,10 @@ namespace Mem { auto collect(const bool no_update) -> mem_info& { if (Runner::stopping or (no_update and not current_mem.percent.at("used").empty())) return current_mem; - auto& show_swap = Config::getB("show_swap"); - auto& swap_disk = Config::getB("swap_disk"); - auto& show_disks = Config::getB("show_disks"); - auto& zfs_arc_cached = Config::getB("zfs_arc_cached"); + auto show_swap = Config::getB("show_swap"); + auto swap_disk = Config::getB("swap_disk"); + auto show_disks = Config::getB("show_disks"); + auto zfs_arc_cached = Config::getB("zfs_arc_cached"); auto totalMem = get_totalMem(); auto& mem = current_mem; @@ -899,9 +899,9 @@ namespace Mem { try { auto& disks_filter = Config::getS("disks_filter"); bool filter_exclude = false; - auto& use_fstab = Config::getB("use_fstab"); - auto& only_physical = Config::getB("only_physical"); - auto& zfs_hide_datasets = Config::getB("zfs_hide_datasets"); + auto use_fstab = Config::getB("use_fstab"); + auto only_physical = Config::getB("only_physical"); + auto zfs_hide_datasets = Config::getB("zfs_hide_datasets"); auto& disks = mem.disks; ifstream diskread; @@ -1327,8 +1327,8 @@ namespace Net { auto collect(const bool no_update) -> net_info& { auto& net = current_net; auto& config_iface = Config::getS("net_iface"); - auto& net_sync = Config::getB("net_sync"); - auto& net_auto = Config::getB("net_auto"); + auto net_sync = Config::getB("net_sync"); + auto net_auto = Config::getB("net_auto"); auto new_timestamp = time_ms(); if (not no_update and errors < 3) {