summaryrefslogtreecommitdiffstats
path: root/src/btop_input.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/btop_input.cpp')
-rw-r--r--src/btop_input.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/btop_input.cpp b/src/btop_input.cpp
index 583582c..ce3ac48 100644
--- a/src/btop_input.cpp
+++ b/src/btop_input.cpp
@@ -271,11 +271,18 @@ namespace Input {
}
else if (key.size() == 1 and isint(key)) {
auto intKey = stoi(key);
+ #ifdef GPU_SUPPORT
+ static const array<string, 10> boxes = {"gpu5", "cpu", "mem", "net", "proc", "gpu0", "gpu1", "gpu2", "gpu3", "gpu4"};
if ((intKey == 0 and Gpu::gpu_names.size() < 5) or (intKey >= 5 and std::cmp_less(Gpu::gpu_names.size(), intKey - 4)))
return;
+ #else
+ static const array<string, 10> boxes = {"", "cpu", "mem", "net", "proc"};
+ if (intKey == 0 or intKey > 4)
+ return;
+ #endif
atomic_wait(Runner::active);
Config::current_preset = -1;
- static const array<string, 10> boxes = {"gpu5", "cpu", "mem", "net", "proc", "gpu0", "gpu1", "gpu2", "gpu3", "gpu4"};
+
Config::toggle_box(boxes.at(intKey));
Draw::calcSizes();
Runner::run("all", false, true);