Skip to content

Commit a0e808f

Browse files
committed
feat: show/hide ip address option
1 parent b101fb3 commit a0e808f

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/btop_config.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ namespace Config {
223223

224224
{"base_10_bitrate", "#* \"True\" shows bitrates in base 10 (Kbps, Mbps). \"False\" shows bitrates in binary sizes (Kibps, Mibps, etc.). \"Auto\" uses base_10_sizes."},
225225

226+
{"net_hide_ip", "#* Toggles ip address visibility in the net box."},
227+
226228
{"show_battery", "#* Show battery stats in top right if battery is present."},
227229

228230
{"selected_battery", "#* Which battery to use if multiple are present. \"Auto\" for auto detection."},
@@ -332,6 +334,7 @@ namespace Config {
332334
{"io_graph_combined", false},
333335
{"net_auto", true},
334336
{"net_sync", true},
337+
{"net_hide_ip", false},
335338
{"show_battery", true},
336339
{"show_battery_watts", true},
337340
{"vim_keys", false},

src/btop_draw.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,7 @@ namespace Net {
14671467
if (force_redraw) redraw = true;
14681468
auto net_sync = Config::getB("net_sync");
14691469
auto net_auto = Config::getB("net_auto");
1470+
auto net_hide_ip = Config::getB("net_hide_ip");
14701471
auto tty_mode = Config::getB("tty_mode");
14711472
auto swap_upload_download = Config::getB("swap_upload_download");
14721473
auto& graph_symbol = (tty_mode ? "tty" : Config::getS("graph_symbol_net"));
@@ -1520,7 +1521,7 @@ namespace Net {
15201521
}
15211522

15221523
//? IP or device address
1523-
if (not ip_addr.empty() and cmp_greater(width - i_size - 36, ip_addr.size())) {
1524+
if (not net_hide_ip and not ip_addr.empty() and cmp_greater(width - i_size - 36, ip_addr.size())) {
15241525
out += Mv::to(y, x + 8) + title_left + Theme::c("title") + Fx::b + ip_addr + title_right;
15251526
}
15261527

src/btop_menu.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,10 @@ namespace Menu {
799799
" setting for bitrates",
800800
"",
801801
"True, False, or Auto",},
802+
{"net_hide_ip",
803+
"Hides the IP address in the net box.",
804+
"",
805+
"True or False."},
802806
},
803807
{
804808
{"proc_left",

0 commit comments

Comments
 (0)