btop/src/btop_menu.cpp

1632 lines
52 KiB
C++
Raw Normal View History

2021-07-21 03:17:34 +02:00
/* Copyright 2021 Aristocratos (jakob@qvantnet.com)
Licensed under the Apache License, Version 2.0 (the "License");
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
indent = tab
tab-size = 4
*/
#include <deque>
#include <unordered_map>
2021-07-21 03:17:34 +02:00
#include <array>
#include <signal.h>
#include <errno.h>
2021-09-12 15:58:23 +02:00
#include <cmath>
#include <filesystem>
2021-07-21 03:17:34 +02:00
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
#include "btop_menu.hpp"
#include "btop_tools.hpp"
#include "btop_config.hpp"
#include "btop_theme.hpp"
#include "btop_draw.hpp"
#include "btop_shared.hpp"
2021-07-21 03:17:34 +02:00
2022-10-02 23:29:05 +02:00
using std::array;
using std::ceil;
using std::max;
using std::min;
using std::ref;
using std::views::iota;
using namespace Tools;
2022-10-02 23:29:05 +02:00
2021-09-12 15:58:23 +02:00
namespace fs = std::filesystem;
2021-07-21 03:17:34 +02:00
namespace Menu {
atomic<bool> active (false);
string bg;
2022-10-02 23:29:05 +02:00
bool redraw{true};
int currentMenu = -1;
msgBox messageBox;
int signalToSend{};
int signalKillRet{};
2021-07-21 03:17:34 +02:00
const array<string, 32> P_Signals = {
Squashed commit of the following: commit 0267eba2bbebd6f166b24358159d7fb094fae052 Merge: 50bbab0 e81cf2b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit 50bbab05122b2f8c35c90e4a6e01d5c52e5eca60 Merge: 9edbf27 5a14c7b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit 5a14c7b6fa41a7fe7061c0aa2f2d0c0fe530e495 Merge: 979506f 71eb414 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit 979506f18ecdc1475b882d7dadc220386169b7db Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit 71eb4142e8204303af091555067b93d82e5dcec1 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit e81cf2b7ff4111e279e1111127e49c6858d83d5e Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commit f9452ff6d56af721fb5526ede11206c7d3b885b8 Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit 9edbf27f1b6d5844a97325fcda732762ba086a99 Merge: 2a864f6 ff1f51c Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commit ff1f51ccbb6d6133292e57ba1b8edb8b6c941fc9 Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit 2a864f6f2ea60df16b3f015885eb3c18a48b9b78 Merge: 636eb25 b2bf8ef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commit b2bf8ef504f29650f8fe0adab41c3cac35b67567 Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit 636eb25f5e31a7af337b024873b2ceb42650ebdb Merge: 260c0f6 b5ba2fc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commit b5ba2fc9635e540142d3dd3eccd866865c9393fd Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit 260c0f662313fe0d0df859645f5731af04fc9fa7 Merge: 52bfff7 e6a06eb Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commit e6a06eb729f11fb8b14f104a041c8504772a8c95 Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit 52bfff7ceb3d259b1a71002fcbfb20261294bdd7 Merge: 1f72e56 19dbbe1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit 19dbbe1a17f7e6453709c37a23859e5d73591e53 Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit 1f72e56c7d6e70f8851134c0a28e17fb0a824a71 Merge: 278a0e6 cdcf8bc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commit cdcf8bc92978c826d9c1768b547df3b7484003f2 Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 9b4e85f08dc3be40d8f4904093cd2bdd096e60fa Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 889623874ef6233610ed529bff18e1ba2c407e14 Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit 278a0e6b171a5f967e0680f679c20d9fc8d58c6f Merge: d16adc9 e89519f Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commit e89519fbb2cd53ddb06ab0a39093c19fc595277c Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commit d16adc9fd03322d46f1b84e5ebe7d426f726a5cc Merge: 2c3ac48 f34b408 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commit f34b40892fef31f657cbe8066c8b0d41ed37c0fc Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit 6027cedd424e963bc6fe9017252ed4f1c9f8634b Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit 2c3ac4855de49563edd4ef199b0be74babc7ce32 Merge: f90dc37 5c6a281 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commit f90dc37c26024f28c2a88d87d041fca1f1b5db1e Merge: 0cac861 68a49c1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit 5c6a2810021c352584a0834c95eff4ece7454c0e Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit 68a49c10a63371b65beb670f7a55ccb43fe38311 Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit 0cac8619105521999d603efaeb7d7eed8c38d746 Merge: 31be436 f798acd Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commit f798acdaf71455684883df0ffb31d29293f788b2 Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit 31be4362ce122182862ac338a9a479cde3a4c8e2 Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commit fc523fd1d0ef49443367056e30653933efc8920c Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
2023-11-25 21:01:11 +01:00
"0",
#ifdef __linux__
#if defined(__hppa__)
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "SIGSTKFLT", "SIGFPE",
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGXCPU",
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGUSR1",
"SIGUSR2", "SIGCHLD", "SIGPWR", "SIGVTALRM",
"SIGPROF", "SIGIO", "SIGWINCH", "SIGSTOP",
"SIGTSTP", "SIGCONT", "SIGTTIN", "SIGTTOU",
"SIGURG", "SIGXFSZ", "SIGSYS"
#elif defined(__mips__)
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGUSR1",
"SIGUSR2", "SIGCHLD", "SIGPWR", "SIGWINCH",
"SIGURG", "SIGIO", "SIGSTOP", "SIGTSTP",
"SIGCONT", "SIGTTIN", "SIGTTOU", "SIGVTALRM",
"SIGPROF", "SIGXCPU", "SIGXFSZ"
#elif defined(__alpha__)
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGURG",
"SIGSTOP", "SIGTSTP", "SIGCONT", "SIGCHLD",
"SIGTTIN", "SIGTTOU", "SIGIO", "SIGXCPU",
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
"SIGPWR", "SIGUSR1", "SIGUSR2"
#elif defined (__sparc__)
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGURG",
"SIGSTOP", "SIGTSTP", "SIGCONT", "SIGCHLD",
"SIGTTIN", "SIGTTOU", "SIGIO", "SIGXCPU",
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
"SIGLOST", "SIGUSR1", "SIGUSR2"
#else
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE",
"SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2",
Squashed commit of the following: commit 0267eba2bbebd6f166b24358159d7fb094fae052 Merge: 50bbab0 e81cf2b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit 50bbab05122b2f8c35c90e4a6e01d5c52e5eca60 Merge: 9edbf27 5a14c7b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit 5a14c7b6fa41a7fe7061c0aa2f2d0c0fe530e495 Merge: 979506f 71eb414 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit 979506f18ecdc1475b882d7dadc220386169b7db Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit 71eb4142e8204303af091555067b93d82e5dcec1 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit e81cf2b7ff4111e279e1111127e49c6858d83d5e Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commit f9452ff6d56af721fb5526ede11206c7d3b885b8 Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit 9edbf27f1b6d5844a97325fcda732762ba086a99 Merge: 2a864f6 ff1f51c Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commit ff1f51ccbb6d6133292e57ba1b8edb8b6c941fc9 Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit 2a864f6f2ea60df16b3f015885eb3c18a48b9b78 Merge: 636eb25 b2bf8ef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commit b2bf8ef504f29650f8fe0adab41c3cac35b67567 Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit 636eb25f5e31a7af337b024873b2ceb42650ebdb Merge: 260c0f6 b5ba2fc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commit b5ba2fc9635e540142d3dd3eccd866865c9393fd Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit 260c0f662313fe0d0df859645f5731af04fc9fa7 Merge: 52bfff7 e6a06eb Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commit e6a06eb729f11fb8b14f104a041c8504772a8c95 Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit 52bfff7ceb3d259b1a71002fcbfb20261294bdd7 Merge: 1f72e56 19dbbe1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit 19dbbe1a17f7e6453709c37a23859e5d73591e53 Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit 1f72e56c7d6e70f8851134c0a28e17fb0a824a71 Merge: 278a0e6 cdcf8bc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commit cdcf8bc92978c826d9c1768b547df3b7484003f2 Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 9b4e85f08dc3be40d8f4904093cd2bdd096e60fa Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 889623874ef6233610ed529bff18e1ba2c407e14 Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit 278a0e6b171a5f967e0680f679c20d9fc8d58c6f Merge: d16adc9 e89519f Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commit e89519fbb2cd53ddb06ab0a39093c19fc595277c Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commit d16adc9fd03322d46f1b84e5ebe7d426f726a5cc Merge: 2c3ac48 f34b408 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commit f34b40892fef31f657cbe8066c8b0d41ed37c0fc Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit 6027cedd424e963bc6fe9017252ed4f1c9f8634b Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit 2c3ac4855de49563edd4ef199b0be74babc7ce32 Merge: f90dc37 5c6a281 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commit f90dc37c26024f28c2a88d87d041fca1f1b5db1e Merge: 0cac861 68a49c1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit 5c6a2810021c352584a0834c95eff4ece7454c0e Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit 68a49c10a63371b65beb670f7a55ccb43fe38311 Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit 0cac8619105521999d603efaeb7d7eed8c38d746 Merge: 31be436 f798acd Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commit f798acdaf71455684883df0ffb31d29293f788b2 Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit 31be4362ce122182862ac338a9a479cde3a4c8e2 Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commit fc523fd1d0ef49443367056e30653933efc8920c Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
2023-11-25 21:01:11 +01:00
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT",
"SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP",
"SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU",
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
"SIGIO", "SIGPWR", "SIGSYS"
#endif
#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__APPLE__)
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGURG",
"SIGSTOP", "SIGTSTP", "SIGCONT", "SIGCHLD",
"SIGTTIN", "SIGTTOU", "SIGIO", "SIGXCPU",
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
"SIGINFO", "SIGUSR1", "SIGUSR2"
#else
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
"SIGTRAP", "SIGABRT", "7", "SIGFPE",
"SIGKILL", "10", "SIGSEGV", "12",
"SIGPIPE", "SIGALRM", "SIGTERM", "16",
"17", "18", "19", "20",
"21", "22", "23", "24",
"25", "26", "27", "28",
"29", "30", "31"
#endif
};
std::unordered_map<string, Input::Mouse_loc> mouse_mappings;
2021-09-12 15:58:23 +02:00
const array<array<string, 3>, 3> menu_normal = {
array<string, 3>{
"┌─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐",
"│ │├─┘ │ ││ ││││└─┐",
"└─┘┴ ┴ ┴└─┘┘└┘└─┘"
},
{
"┬ ┬┌─┐┬ ┌─┐",
"├─┤├┤ │ ├─┘",
"┴ ┴└─┘┴─┘┴ "
},
{
"┌─┐ ┬ ┬ ┬┌┬┐",
"│─┼┐│ │ │ │ ",
"└─┘└└─┘ ┴ ┴ "
}
};
const array<array<string, 3>, 3> menu_selected = {
array<string, 3>{
"╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗",
"║ ║╠═╝ ║ ║║ ║║║║╚═╗",
"╚═╝╩ ╩ ╩╚═╝╝╚╝╚═╝"
},
{
"╦ ╦╔═╗╦ ╔═╗",
"╠═╣║╣ ║ ╠═╝",
"╩ ╩╚═╝╩═╝╩ "
},
{
"╔═╗ ╦ ╦ ╦╔╦╗ ",
"║═╬╗║ ║ ║ ║ ",
"╚═╝╚╚═╝ ╩ ╩ "
}
};
const array<int, 3> menu_width = {19, 12, 12};
const vector<array<string, 2>> help_text = {
{"Mouse 1", "Clicks buttons and selects in process list."},
{"Mouse scroll", "Scrolls any scrollable list/text under cursor."},
{"Esc, m", "Toggles main menu."},
{"p", "Cycle view presets forwards."},
{"shift + p", "Cycle view presets backwards."},
2021-09-12 15:58:23 +02:00
{"1", "Toggle CPU box."},
{"2", "Toggle MEM box."},
{"3", "Toggle NET box."},
{"4", "Toggle PROC box."},
2023-05-13 00:27:23 +02:00
{"5", "Toggle GPU box."},
2021-09-12 15:58:23 +02:00
{"d", "Toggle disks view in MEM box."},
{"F2, o", "Shows options."},
{"F1, ?, h", "Shows this window."},
2021-09-12 15:58:23 +02:00
{"ctrl + z", "Sleep program and put in background."},
{"ctrl + r", "Reloads config file from disk."},
2021-09-12 15:58:23 +02:00
{"q, ctrl + c", "Quits program."},
{"+, -", "Add/Subtract 100ms to/from update timer."},
{"Up, Down", "Select in process list."},
{"Enter", "Show detailed information for selected process."},
{"Spacebar", "Expand/collapse the selected process in tree view."},
{"Pg Up, Pg Down", "Jump 1 page in process list."},
{"Home, End", "Jump to first or last page in process list."},
{"Left, Right", "Select previous/next sorting column."},
{"b, n", "Select previous/next network device."},
{"i", "Toggle disks io mode with big graphs."},
{"z", "Toggle totals reset for current network device"},
{"a", "Toggle auto scaling for the network graphs."},
{"y", "Toggle synced scaling mode for network graphs."},
{"f, /", "To enter a process filter. Start with ! for regex."},
2021-09-12 15:58:23 +02:00
{"delete", "Clear any entered filter."},
{"c", "Toggle per-core cpu usage of processes."},
{"r", "Reverse sorting order in processes box."},
{"e", "Toggle processes tree view."},
Squashed commit of the following: commit 0267eba2bbebd6f166b24358159d7fb094fae052 Merge: 50bbab0 e81cf2b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit 50bbab05122b2f8c35c90e4a6e01d5c52e5eca60 Merge: 9edbf27 5a14c7b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit 5a14c7b6fa41a7fe7061c0aa2f2d0c0fe530e495 Merge: 979506f 71eb414 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit 979506f18ecdc1475b882d7dadc220386169b7db Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit 71eb4142e8204303af091555067b93d82e5dcec1 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit e81cf2b7ff4111e279e1111127e49c6858d83d5e Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commit f9452ff6d56af721fb5526ede11206c7d3b885b8 Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit 9edbf27f1b6d5844a97325fcda732762ba086a99 Merge: 2a864f6 ff1f51c Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commit ff1f51ccbb6d6133292e57ba1b8edb8b6c941fc9 Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit 2a864f6f2ea60df16b3f015885eb3c18a48b9b78 Merge: 636eb25 b2bf8ef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commit b2bf8ef504f29650f8fe0adab41c3cac35b67567 Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit 636eb25f5e31a7af337b024873b2ceb42650ebdb Merge: 260c0f6 b5ba2fc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commit b5ba2fc9635e540142d3dd3eccd866865c9393fd Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit 260c0f662313fe0d0df859645f5731af04fc9fa7 Merge: 52bfff7 e6a06eb Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commit e6a06eb729f11fb8b14f104a041c8504772a8c95 Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit 52bfff7ceb3d259b1a71002fcbfb20261294bdd7 Merge: 1f72e56 19dbbe1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit 19dbbe1a17f7e6453709c37a23859e5d73591e53 Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit 1f72e56c7d6e70f8851134c0a28e17fb0a824a71 Merge: 278a0e6 cdcf8bc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commit cdcf8bc92978c826d9c1768b547df3b7484003f2 Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 9b4e85f08dc3be40d8f4904093cd2bdd096e60fa Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 889623874ef6233610ed529bff18e1ba2c407e14 Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit 278a0e6b171a5f967e0680f679c20d9fc8d58c6f Merge: d16adc9 e89519f Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commit e89519fbb2cd53ddb06ab0a39093c19fc595277c Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commit d16adc9fd03322d46f1b84e5ebe7d426f726a5cc Merge: 2c3ac48 f34b408 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commit f34b40892fef31f657cbe8066c8b0d41ed37c0fc Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit 6027cedd424e963bc6fe9017252ed4f1c9f8634b Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit 2c3ac4855de49563edd4ef199b0be74babc7ce32 Merge: f90dc37 5c6a281 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commit f90dc37c26024f28c2a88d87d041fca1f1b5db1e Merge: 0cac861 68a49c1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit 5c6a2810021c352584a0834c95eff4ece7454c0e Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit 68a49c10a63371b65beb670f7a55ccb43fe38311 Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit 0cac8619105521999d603efaeb7d7eed8c38d746 Merge: 31be436 f798acd Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commit f798acdaf71455684883df0ffb31d29293f788b2 Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit 31be4362ce122182862ac338a9a479cde3a4c8e2 Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commit fc523fd1d0ef49443367056e30653933efc8920c Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
2023-11-25 21:01:11 +01:00
{"%", "Toggles memory display mode in processes box."},
2021-09-12 15:58:23 +02:00
{"Selected +, -", "Expand/collapse the selected process in tree view."},
{"Selected t", "Terminate selected process with SIGTERM - 15."},
{"Selected k", "Kill selected process with SIGKILL - 9."},
{"Selected s", "Select or enter signal to send to process."},
{"", " "},
{"", "For bug reporting and project updates, visit:"},
{"", "https://github.com/aristocratos/btop"},
};
const vector<vector<vector<string>>> categories = {
{
{"color_theme",
"Set color theme.",
"",
"Choose from all theme files in (usually)",
"\"/usr/[local/]share/btop/themes\" and",
"\"~/.config/btop/themes\".",
"",
"\"Default\" for builtin default theme.",
"\"TTY\" for builtin 16-color theme.",
"",
"For theme updates see:",
"https://github.com/aristocratos/btop"},
{"theme_background",
"If the theme set background should be shown.",
"",
"Set to False if you want terminal background",
"transparency."},
{"truecolor",
"Sets if 24-bit truecolor should be used.",
"",
"Will convert 24-bit colors to 256 color",
"(6x6x6 color cube) if False.",
"",
"Set to False if your terminal doesn't have",
"truecolor support and can't convert to",
"256-color."},
{"force_tty",
"TTY mode.",
"",
"Set to true to force tty mode regardless",
"if a real tty has been detected or not.",
"",
"Will force 16-color mode and TTY theme,",
"set all graph symbols to \"tty\" and swap",
"out other non tty friendly symbols."},
{"vim_keys",
"Enable vim keys.",
"Set to True to enable \"h,j,k,l\" keys for",
"directional control in lists.",
"",
"Conflicting keys for",
"h (help) and k (kill)",
"is accessible while holding shift."},
{"presets",
"Define presets for the layout of the boxes.",
"",
"Preset 0 is always all boxes shown with",
"default settings.",
"Max 9 presets.",
"",
"Format: \"box_name:P:G,box_name:P:G\"",
"P=(0 or 1) for alternate positions.",
"G=graph symbol to use for box.",
"",
2022-10-16 03:19:50 +02:00
"Use whitespace \" \" as separator between",
"different presets.",
"",
"Example:",
"\"mem:0:tty,proc:1:default cpu:0:braille\""},
2021-09-12 15:58:23 +02:00
{"shown_boxes",
"Manually set which boxes to show.",
"",
"Available values are \"cpu mem net proc\".",
#ifdef GPU_SUPPORT
"Or \"gpu0\" through \"gpu5\" for GPU boxes.",
#endif
"Separate values with whitespace.",
2021-09-12 15:58:23 +02:00
"",
"Toggle between presets with key \"p\"."},
{"update_ms",
"Update time in milliseconds.",
"",
"Recommended 2000 ms or above for better",
"sample times for graphs.",
"",
"Min value: 100 ms",
"Max value: 86400000 ms = 24 hours."},
{"rounded_corners",
"Rounded corners on boxes.",
"",
"True or False",
"",
"Is always False if TTY mode is ON."},
{"graph_symbol",
"Default symbols to use for graph creation.",
"",
"\"braille\", \"block\" or \"tty\".",
"",
"\"braille\" offers the highest resolution but",
"might not be included in all fonts.",
"",
"\"block\" has half the resolution of braille",
"but uses more common characters.",
"",
"\"tty\" uses only 3 different symbols but will",
"work with most fonts.",
"",
"Note that \"tty\" only has half the horizontal",
"resolution of the other two,",
"so will show a shorter historical view."},
{"clock_format",
"Draw a clock at top of screen.",
"(Only visible if cpu box is enabled!)",
"",
"Formatting according to strftime, empty",
"string to disable.",
"",
"Custom formatting options:",
"\"/host\" = hostname",
"\"/user\" = username",
"\"/uptime\" = system uptime",
"",
"Examples of strftime formats:",
"\"%X\" = locale HH:MM:SS",
"\"%H\" = 24h hour, \"%I\" = 12h hour",
"\"%M\" = minute, \"%S\" = second",
"\"%d\" = day, \"%m\" = month, \"%y\" = year"},
2022-01-16 13:39:50 +01:00
{"base_10_sizes",
"Use base 10 for bits and bytes sizes.",
"",
"Uses KB = 1000 instead of KiB = 1024,",
"MB = 1000KB instead of MiB = 1024KiB,",
"and so on.",
"",
"True or False."},
2021-09-12 15:58:23 +02:00
{"background_update",
"Update main ui when menus are showing.",
"",
"True or False.",
"",
"Set this to false if the menus is flickering",
"too much for a comfortable experience."},
{"show_battery",
"Show battery stats.",
"(Only visible if cpu box is enabled!)",
"",
"Show battery stats in the top right corner",
"if a battery is present."},
{"selected_battery",
"Select battery.",
"",
"Which battery to use if multiple are present.",
"Can be both batteries and UPS.",
"",
"\"Auto\" for auto detection."},
2023-12-14 22:19:22 +01:00
{"show_battery_watts",
"Show battery power.",
"",
"Show discharge power when discharging.",
"Show charging power when charging."},
2021-09-12 15:58:23 +02:00
{"log_level",
"Set loglevel for error.log",
"",
"\"ERROR\", \"WARNING\", \"INFO\" and \"DEBUG\".",
"",
"The level set includes all lower levels,",
"i.e. \"DEBUG\" will show all logging info."}
},
{
{"cpu_bottom",
"Cpu box location.",
"",
"Show cpu box at bottom of screen instead",
"of top."},
{"graph_symbol_cpu",
"Graph symbol to use for graphs in cpu box.",
"",
"\"default\", \"braille\", \"block\" or \"tty\".",
"",
"\"default\" for the general default symbol.",},
{"cpu_graph_upper",
"Cpu upper graph.",
"",
2023-06-26 13:10:31 +02:00
"Sets the CPU/GPU stat shown in upper half of",
2021-09-12 15:58:23 +02:00
"the CPU graph.",
"",
2023-06-26 13:10:31 +02:00
"CPU:",
"\"total\" = Total cpu usage. (Auto)",
2021-09-12 15:58:23 +02:00
"\"user\" = User mode cpu usage.",
"\"system\" = Kernel mode cpu usage.",
2023-06-26 13:10:31 +02:00
"+ more depending on kernel.",
#ifdef GPU_SUPPORT
2023-06-26 13:10:31 +02:00
"",
"GPU:",
"\"gpu-totals\" = GPU usage split by device.",
"\"gpu-vram-totals\" = VRAM usage split by GPU.",
"\"gpu-pwr-totals\" = Power usage split by GPU.",
"\"gpu-average\" = Avg usage of all GPUs.",
"\"gpu-vram-total\" = VRAM usage of all GPUs.",
"\"gpu-pwr-total\" = Power usage of all GPUs.",
"Not all stats are supported on all devices."
#endif
},
2021-09-12 15:58:23 +02:00
{"cpu_graph_lower",
"Cpu lower graph.",
"",
2023-06-26 13:10:31 +02:00
"Sets the CPU/GPU stat shown in lower half of",
2021-09-12 15:58:23 +02:00
"the CPU graph.",
"",
2023-06-26 13:10:31 +02:00
"CPU:",
2021-09-12 15:58:23 +02:00
"\"total\" = Total cpu usage.",
"\"user\" = User mode cpu usage.",
"\"system\" = Kernel mode cpu usage.",
2023-06-26 13:10:31 +02:00
"+ more depending on kernel.",
#ifdef GPU_SUPPORT
2023-06-26 13:10:31 +02:00
"",
"GPU:",
"\"gpu-totals\" = GPU usage split/device. (Auto)",
2023-06-26 13:10:31 +02:00
"\"gpu-vram-totals\" = VRAM usage split by GPU.",
"\"gpu-pwr-totals\" = Power usage split by GPU.",
"\"gpu-average\" = Avg usage of all GPUs.",
"\"gpu-vram-total\" = VRAM usage of all GPUs.",
"\"gpu-pwr-total\" = Power usage of all GPUs.",
"Not all stats are supported on all devices."
#endif
},
2021-09-12 15:58:23 +02:00
{"cpu_invert_lower",
"Toggles orientation of the lower CPU graph.",
"",
"True or False."},
{"cpu_single_graph",
"Completely disable the lower CPU graph.",
"",
"Shows only upper CPU graph and resizes it",
"to fit to box height.",
"",
"True or False."},
#ifdef GPU_SUPPORT
{"show_gpu_info",
"Show gpu info in cpu box.",
"",
"Toggles gpu stats in cpu box and the",
"gpu graph (if \"cpu_graph_lower\" is set to",
"\"Auto\").",
"",
"\"Auto\" to show when no gpu box is shown.",
"\"On\" to always show.",
"\"Off\" to never show."},
#endif
2021-09-12 15:58:23 +02:00
{"check_temp",
"Enable cpu temperature reporting.",
"",
"True or False."},
{"cpu_sensor",
2023-06-26 13:10:31 +02:00
"Cpu temperature sensor.",
2021-09-12 15:58:23 +02:00
"",
"Select the sensor that corresponds to",
"your cpu temperature.",
"",
"Set to \"Auto\" for auto detection."},
{"show_coretemp",
"Show temperatures for cpu cores.",
"",
"Only works if check_temp is True and",
"the system is reporting core temps."},
{"cpu_core_map",
"Custom mapping between core and coretemp.",
"",
"Can be needed on certain cpus to get correct",
"temperature for correct core.",
"",
2021-09-17 14:25:54 +02:00
"Use lm-sensors or similar to see which cores",
"are reporting temperatures on your machine.",
"",
2021-09-12 15:58:23 +02:00
"Format: \"X:Y\"",
"X=core with wrong temp.",
"Y=core with correct temp.",
"Use space as separator between multiple",
"entries.",
"",
"Example: \"4:0 5:1 6:3\""},
{"temp_scale",
"Which temperature scale to use.",
"",
"Celsius, default scale.",
"",
"Fahrenheit, the american one.",
"",
"Kelvin, 0 = absolute zero, 1 degree change",
"equals 1 degree change in Celsius.",
"",
2024-01-14 03:26:02 +01:00
"Rankine, 0 = absolute zero, 1 degree change",
2021-09-12 15:58:23 +02:00
"equals 1 degree change in Fahrenheit."},
{"show_cpu_freq",
2023-06-26 13:10:31 +02:00
"Show CPU frequency.",
2021-09-12 15:58:23 +02:00
"",
"Can cause slowdowns on systems with many",
"cores and certain kernel versions."},
{"custom_cpu_name",
"Custom cpu model name in cpu percentage box.",
"",
"Empty string to disable."},
{"show_uptime",
"Shows the system uptime in the CPU box.",
"",
"Can also be shown in the clock by using",
"\"/uptime\" in the formatting.",
"",
"True or False."},
},
#ifdef GPU_SUPPORT
2023-06-26 13:10:31 +02:00
{
{"nvml_measure_pcie_speeds",
"Measure PCIe throughput on NVIDIA cards.",
"",
"May impact performance on certain cards.",
"",
"True or False."},
{"graph_symbol_gpu",
"Graph symbol to use for graphs in gpu box.",
"",
"\"default\", \"braille\", \"block\" or \"tty\".",
"",
"\"default\" for the general default symbol.",},
{"gpu_mirror_graph",
"Horizontally mirror the GPU graph.",
"",
"True or False."},
{"custom_gpu_name0",
"Custom gpu0 model name in gpu stats box.",
"",
"Empty string to disable."},
{"custom_gpu_name1",
"Custom gpu1 model name in gpu stats box.",
"",
"Empty string to disable."},
{"custom_gpu_name2",
"Custom gpu2 model name in gpu stats box.",
"",
"Empty string to disable."},
{"custom_gpu_name3",
"Custom gpu3 model name in gpu stats box.",
"",
"Empty string to disable."},
{"custom_gpu_name4",
"Custom gpu4 model name in gpu stats box.",
"",
"Empty string to disable."},
{"custom_gpu_name5",
"Custom gpu5 model name in gpu stats box.",
"",
"Empty string to disable."},
},
#endif
2021-09-12 15:58:23 +02:00
{
{"mem_below_net",
"Mem box location.",
"",
"Show mem box below net box instead of above."},
{"graph_symbol_mem",
"Graph symbol to use for graphs in mem box.",
"",
"\"default\", \"braille\", \"block\" or \"tty\".",
"",
"\"default\" for the general default symbol.",},
{"mem_graphs",
"Show graphs for memory values.",
"",
"True or False."},
{"show_disks",
"Split memory box to also show disks.",
"",
"True or False."},
{"show_io_stat",
"Toggle IO activity graphs.",
"",
"Show small IO graphs that for disk activity",
2021-09-17 14:25:54 +02:00
"(disk busy time) when not in IO mode.",
2021-09-12 15:58:23 +02:00
"",
"True or False."},
{"io_mode",
"Toggles io mode for disks.",
"",
"Shows big graphs for disk read/write speeds",
"instead of used/free percentage meters.",
"",
"True or False."},
{"io_graph_combined",
"Toggle combined read and write graphs.",
"",
"Only has effect if \"io mode\" is True.",
"",
"True or False."},
{"io_graph_speeds",
"Set top speeds for the io graphs.",
"",
"Manually set which speed in MiB/s that",
"equals 100 percent in the io graphs.",
2021-09-17 14:25:54 +02:00
"(100 MiB/s by default).",
2021-09-12 15:58:23 +02:00
"",
"Format: \"device:speed\" separate disks with",
2021-09-17 14:25:54 +02:00
"whitespace \" \".",
2021-09-12 15:58:23 +02:00
"",
"Example: \"/dev/sda:100, /dev/sdb:20\"."},
{"show_swap",
"If swap memory should be shown in memory box.",
"",
"True or False."},
{"swap_disk",
"Show swap as a disk.",
"",
"Ignores show_swap value above.",
"Inserts itself after first disk."},
{"only_physical",
"Filter out non physical disks.",
"",
"Set this to False to include network disks,",
"RAM disks and similar.",
"",
"True or False."},
{"use_fstab",
"(Linux) Read disks list from /etc/fstab.",
2021-09-12 15:58:23 +02:00
"",
"This also disables only_physical.",
"",
"True or False."},
{"zfs_hide_datasets",
"(Linux) Hide ZFS datasets in disks list.",
2022-07-01 17:35:41 +02:00
"",
"Setting this to True will hide all datasets,",
"and only show ZFS pools.",
"",
"(IO stats will be calculated per-pool)",
"",
2022-07-01 17:35:41 +02:00
"True or False."},
{"disk_free_priv",
"(Linux) Type of available disk space.",
"",
"Set to true to show how much disk space is",
"available for privileged users.",
"",
"Set to false to show available for normal",
"users."},
2021-09-12 15:58:23 +02:00
{"disks_filter",
"Optional filter for shown disks.",
"",
"Should be full path of a mountpoint.",
"Separate multiple values with",
"whitespace \" \".",
"",
"Begin line with \"exclude=\" to change to",
"exclude filter.",
2024-01-14 03:26:02 +01:00
"Otherwise defaults to \"most include\" filter.",
2021-09-12 15:58:23 +02:00
"",
"Example:",
"\"exclude=/boot /home/user\""},
{"zfs_arc_cached",
"(Linux) Count ZFS ARC as cached memory.",
"",
"Add ZFS ARC used to cached memory and",
"ZFS ARC available to available memory.",
"These are otherwise reported by the Linux",
"kernel as used memory.",
"",
"True or False."},
2021-09-12 15:58:23 +02:00
},
{
{"graph_symbol_net",
"Graph symbol to use for graphs in net box.",
"",
"\"default\", \"braille\", \"block\" or \"tty\".",
"",
"\"default\" for the general default symbol.",},
{"net_download",
"Fixed network graph download value.",
"",
"Value in Mebibits, default \"100\".",
2021-09-12 15:58:23 +02:00
"",
"Can be toggled with auto button."},
{"net_upload",
"Fixed network graph upload value.",
"",
"Value in Mebibits, default \"100\".",
2021-09-12 15:58:23 +02:00
"",
"Can be toggled with auto button."},
{"net_auto",
"Start in network graphs auto rescaling mode.",
"",
"Ignores any values set above at start and",
"rescales down to 10Kibibytes at the lowest.",
"",
"True or False."},
{"net_sync",
"Network scale sync.",
"",
"Syncs the scaling for download and upload to",
"whichever currently has the highest scale.",
"",
"True or False."},
{"net_iface",
"Network Interface.",
"",
"Manually set the starting Network Interface.",
2021-09-17 14:25:54 +02:00
"",
2021-09-12 15:58:23 +02:00
"Will otherwise automatically choose the NIC",
"with the highest total download since boot."},
},
{
{"proc_left",
"Proc box location.",
"",
"Show proc box on left side of screen",
"instead of right."},
{"graph_symbol_proc",
"Graph symbol to use for graphs in proc box.",
"",
"\"default\", \"braille\", \"block\" or \"tty\".",
"",
"\"default\" for the general default symbol.",},
{"proc_sorting",
"Processes sorting option.",
"",
"Possible values:",
"\"pid\", \"program\", \"arguments\", \"threads\",",
"\"user\", \"memory\", \"cpu lazy\" and",
"\"cpu direct\".",
2021-09-12 15:58:23 +02:00
"",
"\"cpu lazy\" updates top process over time.",
"\"cpu direct\" updates top process",
2021-09-12 15:58:23 +02:00
"directly."},
{"proc_reversed",
"Reverse processes sorting order.",
"",
"True or False."},
{"proc_tree",
"Processes tree view.",
"",
"Set true to show processes grouped by",
"parents with lines drawn between parent",
"and child process."},
Squashed commit of the following: commit 0267eba2bbebd6f166b24358159d7fb094fae052 Merge: 50bbab0 e81cf2b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit 50bbab05122b2f8c35c90e4a6e01d5c52e5eca60 Merge: 9edbf27 5a14c7b Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit 5a14c7b6fa41a7fe7061c0aa2f2d0c0fe530e495 Merge: 979506f 71eb414 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit 979506f18ecdc1475b882d7dadc220386169b7db Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit 71eb4142e8204303af091555067b93d82e5dcec1 Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit e81cf2b7ff4111e279e1111127e49c6858d83d5e Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commit f9452ff6d56af721fb5526ede11206c7d3b885b8 Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit 9edbf27f1b6d5844a97325fcda732762ba086a99 Merge: 2a864f6 ff1f51c Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commit ff1f51ccbb6d6133292e57ba1b8edb8b6c941fc9 Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit 2a864f6f2ea60df16b3f015885eb3c18a48b9b78 Merge: 636eb25 b2bf8ef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commit b2bf8ef504f29650f8fe0adab41c3cac35b67567 Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit 636eb25f5e31a7af337b024873b2ceb42650ebdb Merge: 260c0f6 b5ba2fc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commit b5ba2fc9635e540142d3dd3eccd866865c9393fd Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit 260c0f662313fe0d0df859645f5731af04fc9fa7 Merge: 52bfff7 e6a06eb Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commit e6a06eb729f11fb8b14f104a041c8504772a8c95 Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit 52bfff7ceb3d259b1a71002fcbfb20261294bdd7 Merge: 1f72e56 19dbbe1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit 19dbbe1a17f7e6453709c37a23859e5d73591e53 Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit 1f72e56c7d6e70f8851134c0a28e17fb0a824a71 Merge: 278a0e6 cdcf8bc Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commit cdcf8bc92978c826d9c1768b547df3b7484003f2 Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 9b4e85f08dc3be40d8f4904093cd2bdd096e60fa Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit 889623874ef6233610ed529bff18e1ba2c407e14 Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit 278a0e6b171a5f967e0680f679c20d9fc8d58c6f Merge: d16adc9 e89519f Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commit e89519fbb2cd53ddb06ab0a39093c19fc595277c Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commit d16adc9fd03322d46f1b84e5ebe7d426f726a5cc Merge: 2c3ac48 f34b408 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commit f34b40892fef31f657cbe8066c8b0d41ed37c0fc Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit 6027cedd424e963bc6fe9017252ed4f1c9f8634b Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit 2c3ac4855de49563edd4ef199b0be74babc7ce32 Merge: f90dc37 5c6a281 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commit f90dc37c26024f28c2a88d87d041fca1f1b5db1e Merge: 0cac861 68a49c1 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit 5c6a2810021c352584a0834c95eff4ece7454c0e Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit 68a49c10a63371b65beb670f7a55ccb43fe38311 Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit 0cac8619105521999d603efaeb7d7eed8c38d746 Merge: 31be436 f798acd Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commit f798acdaf71455684883df0ffb31d29293f788b2 Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit 31be4362ce122182862ac338a9a479cde3a4c8e2 Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commit fc523fd1d0ef49443367056e30653933efc8920c Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
2023-11-25 21:01:11 +01:00
{"proc_aggregate",
"Aggregate child's resources in parent.",
"",
"In tree-view, include all child resources",
"with the parent even while expanded."},
2021-09-12 15:58:23 +02:00
{"proc_colors",
"Enable colors in process view.",
"",
"True or False."},
{"proc_gradient",
"Enable process view gradient fade.",
"",
"Fades from top or current selection.",
"Max fade value is equal to current themes",
"\"inactive_fg\" color value."},
{"proc_per_core",
"Process usage per core.",
"",
"If process cpu usage should be of the core",
"it's running on or usage of the total",
"available cpu power.",
"",
"If true and process is multithreaded",
"cpu usage can reach over 100%."},
{"proc_mem_bytes",
"Show memory as bytes in process list.",
" ",
"Will show percentage of total memory",
"if False."},
{"proc_cpu_graphs",
"Show cpu graph for each process.",
"",
"True or False"},
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
{"proc_filter_kernel",
"(Linux) Filter kernel processes from output.",
"",
"Set to 'True' to filter out internal",
"processes started by the Linux kernel."},
2021-09-12 15:58:23 +02:00
}
2021-07-21 03:17:34 +02:00
};
2021-09-12 15:58:23 +02:00
msgBox::msgBox() {}
msgBox::msgBox(int width, int boxtype, vector<string> content, string title)
: width(width), boxtype(boxtype) {
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
auto tty_mode = Config::getB("tty_mode");
auto rounded = Config::getB("rounded_corners");
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);
const auto& right_down = (tty_mode or not rounded ? Symbols::right_down : Symbols::round_right_down);
const auto& left_down = (tty_mode or not rounded ? Symbols::left_down : Symbols::round_left_down);
height = content.size() + 7;
x = Term::width / 2 - width / 2;
y = Term::height/2 - height/2;
if (boxtype == 2) selected = 1;
button_left = left_up + Symbols::h_line * 6 + Mv::l(7) + Mv::d(2) + left_down + Symbols::h_line * 6 + Mv::l(7) + Mv::u(1) + Symbols::v_line;
button_right = Symbols::v_line + Mv::l(7) + Mv::u(1) + Symbols::h_line * 6 + right_up + Mv::l(7) + Mv::d(2) + Symbols::h_line * 6 + right_down + Mv::u(2);
box_contents = Draw::createBox(x, y, width, height, Theme::c("hi_fg"), true, title) + Mv::d(1);
for (const auto& line : content) {
2022-02-09 15:45:28 +01:00
box_contents += Mv::save + Mv::r(max((size_t)0, (width / 2) - (Fx::uncolor(line).size() / 2) - 1)) + line + Mv::restore + Mv::d(1);
}
}
string msgBox::operator()() {
string out;
int pos = width / 2 - (boxtype == 0 ? 6 : 14);
auto& first_color = (selected == 0 ? Theme::c("hi_fg") : Theme::c("div_line"));
out = Mv::d(1) + Mv::r(pos) + Fx::b + first_color + button_left + (selected == 0 ? Theme::c("title") : Theme::c("main_fg") + Fx::ub)
+ (boxtype == 0 ? " Ok " : " Yes ") + first_color + button_right;
mouse_mappings["button1"] = Input::Mouse_loc{y + height - 4, x + pos + 1, 3, 12 + (boxtype > 0 ? 1 : 0)};
if (boxtype > 0) {
auto& second_color = (selected == 1 ? Theme::c("hi_fg") : Theme::c("div_line"));
out += Mv::r(2) + second_color + button_left + (selected == 1 ? Theme::c("title") : Theme::c("main_fg") + Fx::ub)
+ " No " + second_color + button_right;
mouse_mappings["button2"] = Input::Mouse_loc{y + height - 4, x + pos + 15 + (boxtype > 0 ? 1 : 0), 3, 12};
}
return box_contents + out + Fx::reset;
}
//? Process input
int msgBox::input(string key) {
if (key.empty()) return Invalid;
if (is_in(key, "escape", "backspace", "q") or key == "button2") {
return No_Esc;
}
else if (key == "button1" or (boxtype == 0 and str_to_upper(key) == "O")) {
return Ok_Yes;
}
else if (is_in(key, "enter", "space")) {
return selected + 1;
}
else if (boxtype == 0) {
return Invalid;
}
else if (str_to_upper(key) == "Y") {
return Ok_Yes;
}
else if (str_to_upper(key) == "N") {
return No_Esc;
}
else if (is_in(key, "right", "tab")) {
if (++selected > 1) selected = 0;
return Select;
}
else if (is_in(key, "left", "shift_tab")) {
if (--selected < 0) selected = 1;
return Select;
}
return Invalid;
}
void msgBox::clear() {
box_contents.clear();
box_contents.shrink_to_fit();
button_left.clear();
button_left.shrink_to_fit();
button_right.clear();
button_right.shrink_to_fit();
if (mouse_mappings.contains("button1")) mouse_mappings.erase("button1");
if (mouse_mappings.contains("button2")) mouse_mappings.erase("button2");
}
enum menuReturnCodes {
NoChange,
Changed,
2021-09-12 15:58:23 +02:00
Closed,
Switch
};
int signalChoose(const string& key) {
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
auto s_pid = (Config::getB("show_detailed") and Config::getI("selected_pid") == 0 ? Config::getI("detailed_pid") : Config::getI("selected_pid"));
static int x{};
static int y{};
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
static int selected_signal = -1;
2022-10-02 23:29:05 +02:00
if (bg.empty()) selected_signal = -1;
auto& out = Global::overlay;
int retval = Changed;
if (redraw) {
x = Term::width/2 - 40;
y = Term::height/2 - 9;
bg = Draw::createBox(x + 2, y, 78, 19, Theme::c("hi_fg"), true, "signals");
2021-09-12 15:58:23 +02:00
bg += Mv::to(y+2, x+3) + Theme::c("title") + Fx::b + cjust("Send signal to PID " + to_string(s_pid) + " ("
+ uresize((s_pid == Config::getI("detailed_pid") ? Proc::detailed.entry.name : Config::getS("selected_name")), 30) + ")", 76);
}
2021-09-12 15:58:23 +02:00
else if (is_in(key, "escape", "q")) {
return Closed;
}
2021-09-12 15:58:23 +02:00
else if (key.starts_with("button_")) {
if (int new_select = stoi(key.substr(7)); new_select == selected_signal)
goto ChooseEntering;
else
selected_signal = new_select;
}
else if (is_in(key, "enter", "space") and selected_signal >= 0) {
2021-09-12 15:58:23 +02:00
ChooseEntering:
signalKillRet = 0;
if (s_pid < 1) {
signalKillRet = ESRCH;
menuMask.set(SignalReturn);
}
else if (kill(s_pid, selected_signal) != 0) {
signalKillRet = errno;
menuMask.set(SignalReturn);
}
return Closed;
}
else if (key.size() == 1 and isdigit(key.at(0)) and selected_signal < 10) {
selected_signal = std::min(std::stoi((selected_signal < 1 ? key : to_string(selected_signal) + key)), 64);
}
else if (key == "backspace" and selected_signal != -1) {
selected_signal = (selected_signal < 10 ? -1 : selected_signal / 10);
}
else if (is_in(key, "up", "k") and selected_signal != 16) {
2021-09-12 15:58:23 +02:00
if (selected_signal == 1) selected_signal = 31;
else if (selected_signal < 6) selected_signal += 25;
else {
bool offset = (selected_signal > 16);
selected_signal -= 5;
if (selected_signal <= 16 and offset) selected_signal--;
}
}
else if (is_in(key, "down", "j")) {
2021-09-12 15:58:23 +02:00
if (selected_signal == 31) selected_signal = 1;
else if (selected_signal < 1 or selected_signal == 16) selected_signal = 1;
else if (selected_signal > 26) selected_signal -= 25;
else {
bool offset = (selected_signal < 16);
selected_signal += 5;
if (selected_signal >= 16 and offset) selected_signal++;
if (selected_signal > 31) selected_signal = 31;
}
}
else if (is_in(key, "left", "h") and selected_signal > 0 and selected_signal != 16) {
2021-09-12 15:58:23 +02:00
if (--selected_signal < 1) selected_signal = 31;
else if (selected_signal == 16) selected_signal--;
}
else if (is_in(key, "right", "l") and selected_signal <= 31 and selected_signal != 16) {
2021-09-12 15:58:23 +02:00
if (++selected_signal > 31) selected_signal = 1;
else if (selected_signal == 16) selected_signal++;
}
else {
retval = NoChange;
}
2021-09-12 15:58:23 +02:00
if (retval == Changed) {
int cy = y+4, cx = x+4;
out = bg + Mv::to(cy++, x+3) + Theme::c("main_fg") + Fx::ub
+ rjust("Enter signal number: ", 48) + Theme::c("hi_fg") + (selected_signal >= 0 ? to_string(selected_signal) : "") + Theme::c("main_fg") + Fx::bl + "" + Fx::ubl;
2021-09-12 15:58:23 +02:00
auto sig_str = to_string(selected_signal);
for (int count = 0, i = 0; const auto& sig : P_Signals) {
if (count == 0 or count == 16) { count++; continue; }
if (i++ % 5 == 0) { ++cy; cx = x+4; }
out += Mv::to(cy, cx);
if (count == selected_signal) out += Theme::c("selected_bg") + Theme::c("selected_fg") + Fx::b + ljust(to_string(count), 3) + ljust('(' + sig + ')', 12) + Fx::reset;
else out += Theme::c("hi_fg") + ljust(to_string(count), 3) + Theme::c("main_fg") + ljust('(' + sig + ')', 12);
if (redraw) mouse_mappings["button_" + to_string(count)] = {cy, cx, 1, 15};
count++;
cx += 15;
}
2021-09-12 15:58:23 +02:00
cy++;
out += Mv::to(++cy, x+3) + Fx::b + Theme::c("hi_fg") + rjust( "↑ ↓ ← →", 33, true) + Theme::c("main_fg") + Fx::ub + " | To choose signal.";
out += Mv::to(++cy, x+3) + Fx::b + Theme::c("hi_fg") + rjust("0-9", 33) + Theme::c("main_fg") + Fx::ub + " | Enter manually.";
out += Mv::to(++cy, x+3) + Fx::b + Theme::c("hi_fg") + rjust("ENTER", 33) + Theme::c("main_fg") + Fx::ub + " | To send signal.";
mouse_mappings["enter"] = {cy, x, 1, 73};
out += Mv::to(++cy, x+3) + Fx::b + Theme::c("hi_fg") + rjust("ESC or \"q\"", 33) + Theme::c("main_fg") + Fx::ub + " | To abort.";
mouse_mappings["escape"] = {cy, x, 1, 73};
2021-09-12 15:58:23 +02:00
out += Fx::reset;
}
return (redraw ? Changed : retval);
}
int sizeError(const string& key) {
if (redraw) {
vector<string> cont_vec;
cont_vec.push_back(Fx::b + Theme::g("used")[100] + "Error:" + Theme::c("main_fg") + Fx::ub);
cont_vec.push_back("Terminal size to small to" + Fx::reset);
cont_vec.push_back("display menu or box!" + Fx::reset);
messageBox = Menu::msgBox{45, 0, cont_vec, "error"};
Global::overlay = messageBox();
}
auto ret = messageBox.input(key);
if (ret == msgBox::Ok_Yes or ret == msgBox::No_Esc) {
messageBox.clear();
return Closed;
}
else if (redraw) {
return Changed;
}
return NoChange;
}
int signalSend(const string& key) {
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
auto s_pid = (Config::getB("show_detailed") and Config::getI("selected_pid") == 0 ? Config::getI("detailed_pid") : Config::getI("selected_pid"));
if (s_pid == 0) return Closed;
if (redraw) {
atomic_wait(Runner::active);
auto& p_name = (s_pid == Config::getI("detailed_pid") ? Proc::detailed.entry.name : Config::getS("selected_name"));
vector<string> cont_vec = {
Fx::b + Theme::c("main_fg") + "Send signal: " + Fx::ub + Theme::c("hi_fg") + to_string(signalToSend)
+ (signalToSend > 0 and signalToSend <= 32 ? Theme::c("main_fg") + " (" + P_Signals.at(signalToSend) + ')' : ""),
Fx::b + Theme::c("main_fg") + "To PID: " + Fx::ub + Theme::c("hi_fg") + to_string(s_pid) + Theme::c("main_fg") + " ("
+ uresize(p_name, 16) + ')' + Fx::reset,
};
messageBox = Menu::msgBox{50, 1, cont_vec, (signalToSend > 1 and signalToSend <= 32 and signalToSend != 17 ? P_Signals.at(signalToSend) : "signal")};
Global::overlay = messageBox();
}
auto ret = messageBox.input(key);
if (ret == msgBox::Ok_Yes) {
signalKillRet = 0;
if (kill(s_pid, signalToSend) != 0) {
signalKillRet = errno;
menuMask.set(SignalReturn);
}
messageBox.clear();
return Closed;
}
else if (ret == msgBox::No_Esc) {
messageBox.clear();
return Closed;
}
else if (ret == msgBox::Select) {
Global::overlay = messageBox();
return Changed;
}
else if (redraw) {
return Changed;
}
return NoChange;
}
int signalReturn(const string& key) {
if (redraw) {
vector<string> cont_vec;
cont_vec.push_back(Fx::b + Theme::g("used")[100] + "Failure:" + Theme::c("main_fg") + Fx::ub);
if (signalKillRet == EINVAL) {
cont_vec.push_back("Unsupported signal!" + Fx::reset);
}
else if (signalKillRet == EPERM) {
cont_vec.push_back("Insufficient permissions to send signal!" + Fx::reset);
}
else if (signalKillRet == ESRCH) {
cont_vec.push_back("Process not found!" + Fx::reset);
}
else {
cont_vec.push_back("Unknown error! (errno: " + to_string(signalKillRet) + ')' + Fx::reset);
}
messageBox = Menu::msgBox{50, 0, cont_vec, "error"};
Global::overlay = messageBox();
}
auto ret = messageBox.input(key);
if (ret == msgBox::Ok_Yes or ret == msgBox::No_Esc) {
messageBox.clear();
return Closed;
}
else if (redraw) {
return Changed;
}
return NoChange;
}
int mainMenu(const string& key) {
2021-09-12 15:58:23 +02:00
enum MenuItems { Options, Help, Quit };
static int y{};
static int selected{};
2021-09-12 15:58:23 +02:00
static vector<string> colors_selected;
static vector<string> colors_normal;
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
auto tty_mode = Config::getB("tty_mode");
2021-09-12 15:58:23 +02:00
if (bg.empty()) selected = 0;
int retval = Changed;
if (redraw) {
y = Term::height/2 - 10;
bg = Draw::banner_gen(y, 0, true);
if (not tty_mode) {
colors_selected = {
Theme::hex_to_color(Global::Banner_src.at(0).at(0)),
Theme::hex_to_color(Global::Banner_src.at(2).at(0)),
Theme::hex_to_color(Global::Banner_src.at(4).at(0))
};
colors_normal = {
Theme::hex_to_color("#CC"),
Theme::hex_to_color("#AA"),
Theme::hex_to_color("#80")
};
}
}
else if (is_in(key, "escape", "q", "m", "mouse_click")) {
2021-09-12 15:58:23 +02:00
return Closed;
}
else if (key.starts_with("button_")) {
if (int new_select = key.back() - '0'; new_select == selected)
goto MainEntering;
else
selected = new_select;
}
else if (is_in(key, "enter", "space")) {
MainEntering:
switch (selected) {
case Options:
menuMask.set(Menus::Options);
currentMenu = Menus::Options;
return Switch;
case Help:
menuMask.set(Menus::Help);
currentMenu = Menus::Help;
return Switch;
case Quit:
Squashed commit of the following: commit c2c4fe47db3002c3433114954c22bd92b149bea0 Author: aristocratos <admin@qvantnet.com> Date: Sat Nov 13 23:15:53 2021 +0100 Changes from main + fixes commit bd5d86708907397f7fc40868ff3665e23f24bb8a Author: aristocratos <admin@qvantnet.com> Date: Sat Nov 13 21:24:01 2021 +0100 Fixes commit dc5f0606cbe6f4d61bec3621c25190f1241b3fce Author: aristocratos <admin@qvantnet.com> Date: Sat Nov 13 20:51:06 2021 +0100 Fixed leak in Proc::collect() commit 8b59ab6e1120439a070b07a4255b10bd7d5197cf Author: aristocratos <admin@qvantnet.com> Date: Sat Nov 13 19:59:56 2021 +0100 Fixed process cpu usage calculation commit 53c8a0325b7567b84da2f01ebd5acad33db4c0cb Author: aristocratos <admin@qvantnet.com> Date: Mon Oct 25 13:01:53 2021 +0200 Cpu temp set to average of pACC and eACC for mac m1 commit 940cd0a5131253b0595b233f9da350101211d3cb Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 24 21:12:16 2021 +0200 limit cpu temp to 20 commit 254ceb9c2df0374ad07a6ca1e867ef40a60efc24 Author: aristocratos <admin@qvantnet.com> Date: Sun Oct 24 11:24:04 2021 +0200 Fixed up Makefile commit 6fa3bf41d757edbb311b99292b26aa45e83d9b9d Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 21 13:12:45 2021 +0200 Makefile fixed WARNFLAGS commit 2c98e2ca2927d772674c130dcc527f3318daf150 Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 21 13:08:12 2021 +0200 Updated Makefile commit e69780e9bce7af37ba6a85843db0e97c55c61395 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 20 23:26:09 2021 +0200 fix build commit de6216792154477a5ab7f564c9467761daf842e2 Merge: a590dd3 a0ee404 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 20 23:10:36 2021 +0200 Merge branch 'main' into OSX commit a590dd3f67c9f2f8f8dc3fa49920a40a5e8b369d Author: aristocratos <admin@qvantnet.com> Date: Mon Oct 18 11:20:12 2021 +0200 Ignore format-truncation commit 4c30742d412cf552de22b3746a68cd62bfe867f2 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 18 10:08:01 2021 +0200 comments about temp sensors commit 46030de77cb1409eb8b0247c331408a240b0227a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 18 08:10:37 2021 +0200 available = total - used commit 4c228de0ef8a75275178bad081e568f85fc579fd Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 17 22:19:41 2021 +0200 use sysconf to get arg_max - seems simpler commit c60fc29f0f62831730c04c23cd9ffbefef50a1d8 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 17 22:10:50 2021 +0200 arg_max should be int on macos commit 0b5a931a6d5e8d1a434e88e8fd0613ab948995fa Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 17 22:01:42 2021 +0200 only fetch max_args once commit 71d5cd5fd91511a90e43e5e6dbf7a1b6a3c3f9c8 Author: aristocratos <admin@qvantnet.com> Date: Sat Oct 16 23:24:07 2021 +0200 Reverted mutexes back to custom atomic bool based locks commit 3f34a67df68f3f451cb48b023b7cd42ccf933ce4 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 16 21:47:55 2021 +0200 these helpers can be static commit fc19c46c8aab03e252f60f6f9447d7e1861cbcb9 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 16 21:44:49 2021 +0200 code cleanup: put the code in .cpp to enable incremental build commit c252c618c043c4b85783f56363121877d0db0727 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 16 21:09:21 2021 +0200 don't crash on intel commit 9f88187c29821148c7a5272926d204bd3eb39f89 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 16 21:06:18 2021 +0200 small improvement commit 808f09c97465e8cf511f7690b40a69cd8a2efa15 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 16 20:59:48 2021 +0200 don't iterate 3 times commit d8408336e3b8336025a087a2bf79a2d15f51ee66 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 16 20:59:27 2021 +0200 remove debug commit 4f078c3beb960fe06f4d8b44b9c913e2aacf7625 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 13 23:38:27 2021 +0200 more temperature (M1 + intel) commit 289880aaa6d1a3625c01e9d7643138343b29db53 Merge: 88a2528 3ffb212 Author: aristocratos <admin@qvantnet.com> Date: Sat Oct 16 19:37:09 2021 +0200 Merge branch 'OSX' of github.com:aristocratos/btop into OSX commit 88a2528ca3a2390f2c94c7f1a18ba982a5e5f2b2 Author: aristocratos <admin@qvantnet.com> Date: Sat Oct 16 19:34:10 2021 +0200 Merge changes from main commit 3ffb21203aa3f4ad978533a3f2b1e67e636381ea Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 16 19:20:45 2021 +0200 release a bit more - still has negative temps for 2 cores on my system commit 70b48710626ba22df496ba741625ce03cba6abbd Author: aristocratos <admin@qvantnet.com> Date: Sat Oct 16 01:59:44 2021 +0200 Fixed leaks in Mem and attempt at fixing leaks in sensors.cpp commit fbae907720afbae47162666b6b0aea974be80c07 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Oct 15 23:41:37 2021 +0200 temperature sensors via IOKit commit cef0f0a68daa88a380000ce200a364e4701ba93a Author: aristocratos <admin@qvantnet.com> Date: Fri Oct 15 18:39:17 2021 +0200 Process command line arguments commit 921cfa01ffc104c57f2825d0bca648233ddff191 Author: aristocratos <admin@qvantnet.com> Date: Wed Oct 13 23:20:15 2021 +0200 Re-enable setuid and set default SU_GROUP to wheel for OSX commit a416c888c7356634ef7a5286130a56160d72f50a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 13 21:16:41 2021 +0200 temperature commit e7afe00ce7960bfe6fb6ba2a9a2f5d498c5b4fca Author: aristocratos <admin@qvantnet.com> Date: Wed Oct 13 12:54:43 2021 +0200 Cpu usage working again commit 4193ef8921617e48ce07ce95d898386f7dd77f43 Author: aristocratos <admin@qvantnet.com> Date: Wed Oct 13 10:36:51 2021 +0200 Fixed cpu lazy sorting commit 93fcb6ff04d84c008ed9f7d28918eb9eb8adf740 Author: aristocratos <admin@qvantnet.com> Date: Tue Oct 12 22:22:45 2021 +0200 Update README.md commit 683354cd2ed8add79c6940e51800431e8b020635 Merge: 8a399c4 6d724d6 Author: aristocratos <admin@qvantnet.com> Date: Tue Oct 12 22:19:30 2021 +0200 Merge pull request #80 from ShrirajHegde/OSX Add github workflow for MacOS commit 8a399c499af87883a7e4b2cf7f6d193f76909923 Author: aristocratos <admin@qvantnet.com> Date: Tue Oct 12 21:50:46 2021 +0200 pointer to smart pointer, first pass commit 772605003af9c1c00f163ff75279cd0055074c96 Author: aristocratos <admin@qvantnet.com> Date: Tue Oct 12 18:54:38 2021 +0200 Fixed detailed memory not updating commit 28cb67753332fe8c93d23cbf8e4db636fc6823d6 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 11 22:19:25 2021 +0200 more memory free-up - still leaks like crazy commit 304457863f6cdccf82fbe1cca3078c7f5d9f97cd Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 11 21:48:07 2021 +0200 more RAII cleanup commit 82e2e3c55c23e37dbf226952cca4587df3522fa3 Author: aristocratos <admin@qvantnet.com> Date: Mon Oct 11 12:40:25 2021 +0200 Removed non present cpu fields and fixed calculation for selectable cpu field graphs commit 68603f2b37e34828f78f0f675f66bd835dae8325 Author: aristocratos <admin@qvantnet.com> Date: Mon Oct 11 10:57:04 2021 +0200 RAII Wrappers for Cpu::get_battery() commit d5cb24fbeb19ae57507e1715aa402b2dc33f9b6b Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 10 20:23:11 2021 +0200 RAII commit 8fad5a61bee973c22f3a11fd7fee2c4e40390bbb Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 9 21:44:16 2021 +0200 get more disk IO stats commit 7fa903cf160b391fb316ea32a60984921a174066 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 9 21:43:48 2021 +0200 fix build commit 98036db660e306626d41fb1b67d9938d9ffe168a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 9 21:18:25 2021 +0200 remove unnecessary uptime param commit aae7ae35caec64ba611d9b78b24c0ad2716f333e Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 9 21:07:23 2021 +0200 remove debug logging commit 5187420b04973edcdd25c1b639795a2c8539b2d9 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 9 21:06:43 2021 +0200 fix process elapsed time commit 89582c0ea6e9bdd7a658b5583d2ce2c5deeee8b0 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 9 21:06:29 2021 +0200 don't double free commit 6d724d6155bad8c084e4c9bdb1d7dda13543a5ac Author: Shriraj Hegde <shriraj.hegde@gmail.com> Date: Sat Oct 9 21:46:33 2021 +0530 Change Upload filename commit 4f94ecc8ad7d7cdb7daed82fd98a5634d723ec6b Author: Shriraj Hegde <shriraj.hegde@gmail.com> Date: Sat Oct 9 21:40:11 2021 +0530 Fix upload path commit e1d6d0a1f224474417078a0a1b98a6c4b5c94a53 Author: Shriraj Hegde <shriraj.hegde@gmail.com> Date: Sat Oct 9 21:36:13 2021 +0530 Skip installing gcc via Homebrew Change job name commit 02cdd9d759d163519048d24746273e4eda2149d0 Author: Shriraj Hegde <shriraj.hegde@gmail.com> Date: Sat Oct 9 21:30:40 2021 +0530 Fix uploading Remove distclean commit 39eb6c396fc31f798d23c21e7f4b313930dca982 Author: Shriraj Hegde <shriraj.hegde@gmail.com> Date: Sat Oct 9 21:26:57 2021 +0530 Disable static compilation commit 099592bccdafe8d8d8c421bcad3e036cbea580ce Author: aristocratos <admin@qvantnet.com> Date: Sat Oct 9 17:52:10 2021 +0200 Ignore empty pid 0 to fix tree mode commit a28e17556e74bb618fc2b6eb74f250b139406cdd Author: Shriraj Hegde <shriraj.hegde@gmail.com> Date: Sat Oct 9 21:17:11 2021 +0530 Add workflow for MacOS commit aee9179c0a98bce54b55c8bb8ebdc1ac99bad69e Author: aristocratos <admin@qvantnet.com> Date: Sat Oct 9 17:36:46 2021 +0200 Disable failed tty mode detection for OSX commit 4b7b98058d7190a494fa522834217d786d71e5fb Author: aristocratos <admin@qvantnet.com> Date: Sat Oct 9 11:28:32 2021 +0200 Fixed disk io and added io activity based on read/write commit bfa0629e7d1e50f88d9a1207930e2f39270fc189 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Oct 8 22:28:10 2021 +0200 fill in 0 for ioticks commit a016ff8a039634bc37a22a4a84b31055b3cfab37 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Oct 8 22:16:01 2021 +0200 disk io from IOreg. Does not show any io though commit f98606c6db09d50c7ae234437ea03eda2cc8739c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Oct 8 09:32:06 2021 +0200 per process IO stats commit c8b50ed4883103f66c9ed869fd0252d48f18f58f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Oct 8 00:11:08 2021 +0200 don't show autofs, it's useless commit c4df64d4409c511847d76b37a0794b8bb4f6942d Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 7 18:41:49 2021 +0200 Fixed compile time display for gmake and command timings commit b3e6f495f76bd71fba3442a557df22afdd3e642d Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 7 18:26:15 2021 +0200 Fixed clk_tck -> clkTck commit e53799188ffc24f3948e7ced375b7fbb53911247 Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 7 18:25:14 2021 +0200 Fixed better detection for OSX commit b864edf984e8f0daa0f10a6ee305074c68efeb42 Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 7 18:24:37 2021 +0200 Fixed cumulative cpu usage commit 6a3c5d9b976c711461d08c373483c84bb69db257 Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 7 13:20:30 2021 +0200 Proc::collect() better cpu percent accurazy commit 84d0596294432baef1b10f7d3a566a07382f69d3 Merge: 3564f8e 98e1e87 Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 7 12:56:55 2021 +0200 Merge branch 'OSX' of github.com:aristocratos/btop into OSX commit 3564f8e4c26f04ec89482606e68a452a3e5f9693 Author: aristocratos <admin@qvantnet.com> Date: Thu Oct 7 12:56:27 2021 +0200 Proc::collect() fixed cputimes and cpu percentage calc commit 98e1e874059fe69968d4bb7e4685f292e3b7fd65 Merge: 60c5636 d96fdd7 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Thu Oct 7 11:32:41 2021 +0200 Merge branch 'main' into OSX commit 60c5636cd7c18e6c806cb4cd88846db10092dd57 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 22:45:54 2021 +0200 fix warning commit 489e446152ce00f8e92db8c4e10759f96e38f17f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 22:38:40 2021 +0200 details + process states commit 7e5a808c731772bab35204f2e286975fca334f54 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 22:38:19 2021 +0200 avoid details crash commit 9c9da4606b3f93c0701b820a875fb3db5d0c3daf Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 21:03:21 2021 +0200 fix quit on macos commit ec7415384d9d9b42892a1e36ff55bf7a117a253b Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 00:41:37 2021 +0200 fix mistake in makefile commit 5ac8fa4c8a8f73efac6ac1f15e458ed3b2c1164b Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 18:56:13 2021 +0200 don't show /dev commit d901bbebd94ec45c45431fcd1ab37a974f783d9b Author: aristocratos <gnmjpl@gmail.com> Date: Wed Oct 6 17:27:51 2021 +0200 Ignore tags and other branches commit c7f1e71e29bafb5334cd4e256c662e5ee6303b1b Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 16:00:41 2021 +0200 comment commit b9d58e3faf5b60ad4f5f65454b454ff52deb5eaa Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 15:55:58 2021 +0200 impossible to get CPU freq on M1 apparently commit 66072711c24b2694c4a0054c58829095ed97ada2 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 15:33:43 2021 +0200 detect full commit 6bb0e930a2c44b4fb7d0d02a40f210fa12fdc657 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 00:38:46 2021 +0200 CPU freq in GHz commit a5f10f1a0ff9d10fa8d9d3038aa160b2380aa294 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 15:13:18 2021 +0200 check array length commit 155c848b97e1385bd29eaba91a87ecfb1d846bf7 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 15:05:20 2021 +0200 switch to other way to get CPU freq (still does not work) commit cf51ba2ebe88dddd943040ced484581dc260c3c8 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 14:45:44 2021 +0200 remove some warnings commit 775dff5f72b0631bba0ed01d72374d8c1d1cd059 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 14:16:45 2021 +0200 fix link commit 8c67967775fb98bda80eee40cb6833a00bfb93a1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 14:16:38 2021 +0200 reduce diff more commit 70b47d2ca8a7e0927cf9613e8fe776d2405f60ee Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 14:10:23 2021 +0200 reduce diff with main branch commit ca9cb48054c5850cbb3c23d368e04644a1885de0 Merge: d0c6c0a c66b46f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 13:49:20 2021 +0200 Merge remote-tracking branch 'origin/main' into OSX commit c66b46f850d31c100226e519c55b39df9129aeb8 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 13:41:57 2021 +0200 battery state via CoreFoundation commit d0c6c0a362d8dc4f76e2901d7b406a70d8a69b6b Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 10:51:36 2021 +0200 all disks + load averages commit ca67526dc175dba7d98193a6462e70ef1acab194 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 10:33:55 2021 +0200 show all disks commit 56119f99a95ca541d6ab744a9ded54c84e0a3184 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 00:17:41 2021 +0200 procs sorting/filtering commit 8d86011d72a07b3f86f6b525b026b805667a3172 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 23:42:17 2021 +0200 battery states commit a9b64d62e4abf96fe3edcfa660871caef2041d0f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 23:24:59 2021 +0200 battery hack works on M1 commit ce5103114246f5549017ef4823442a0ea916e1dd Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 23:18:22 2021 +0200 ugly hack to get battery commit d5e6725c6cd6973cc75dfe2993892e1c25ac8d38 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 22:42:42 2021 +0200 CPU stuff commit 5c02bd8c8380c5c74837b982987b7bf31103245f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 21:25:42 2021 +0200 network commit d5da9d49835cdb23ad5830c000e1b93fcb8f46fd Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 15:43:05 2021 +0200 correct cached size commit 5f11aba504254d86ed9a2319967590d50988e16f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 12:03:48 2021 +0200 vm stats from syscall + swap commit 776fc968529e8e7e38fc3168c83b2727198722ad Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 10:48:07 2021 +0200 seems to work indeed commit 7b40e2835a085bfe0d5eb40f367a1ed50353e4d9 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 10:46:14 2021 +0200 allow override optimization flag commit 005ea24e4c9bcc6608671a0635126bf10bdece34 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 10:09:24 2021 +0200 update Makefile commit af8cec9debac328645f0f4e2f136e4572d88332e Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 15:32:55 2021 +0200 some more params commit 7ebe4f7594599ccafbf72a004ce37f965549f64d Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 15:15:55 2021 +0200 show more disks commit e50a56394a3702b6616d03694f5d23a5f7ba2f1c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 14:52:56 2021 +0200 disks show something commit 6497a8c2021b67057dfed26488aec0d82e919a90 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 09:15:35 2021 +0200 reformat commit 28e152b80c07c1fb9a4049cca8510f8bdc31adbb Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 23:21:13 2021 +0200 decrease diff with upstream commit 40da88e9ca91f3db540b63b15da5bc34dc9175e9 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 22:56:14 2021 +0200 try to get disks to show commit eaf2bb56a503fd2bf3787bfd90b5bc8640b7d628 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 22:42:01 2021 +0200 don't crash on deque::back() commit f66b6f712c361fafbe6d0cfd8f8c0838dc1bb4d2 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 22:08:21 2021 +0200 cpu freq, name & process uid/name commit 34a8a61f4de964d3137637b045be8738c4b1b6e5 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 21:46:11 2021 +0200 basic process info commit 29bb2dcc5fcc6b946511068f036590c18fb459ce Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 21:45:39 2021 +0200 initialize mutex (needed on macos apparently and not on linux) commit fb5970b0005793d760e652348d6acc30fb570f70 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 2 23:53:41 2021 +0200 comment commit 49d16cdddd56ba5631269eb2ffbec87d9f36f81e Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 2 23:51:29 2021 +0200 extract delimiters commit 3db9d6647650bd836201b8150e320a7fbf28e3c2 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 2 23:48:28 2021 +0200 first infos on macos: memory used & free commit f8acb2f8542429677116799ddb5f442488cf3f4f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Sep 28 23:37:03 2021 +0200 make it compile on macos (M1 - arm64). Does not run though commit bbba17cd35248e4e9ec9bfc1b113758cfcffde1f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 10:51:36 2021 +0200 all disks + load averages commit 548203e93dfaf3ec9f24086bee08aac85891c4df Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 10:33:55 2021 +0200 show all disks commit 0ab2be39857fb3dcdb13b49bc9155f17c7d82a4e Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Oct 6 00:17:41 2021 +0200 procs sorting/filtering commit 096104c90b571e931a3a7d9c813dbfc9aa47e212 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 23:42:17 2021 +0200 battery states commit 0ad93684c2a72293b23d6a2163c9ec51b499dfa3 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 23:24:59 2021 +0200 battery hack works on M1 commit c75b0f1cea34e6c4c70332ba7e2572ec9b70deef Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 23:18:22 2021 +0200 ugly hack to get battery commit 600b4f72b3bbbcd85bf5d148942bce7be8cf0b72 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 22:42:42 2021 +0200 CPU stuff commit 4eb812d52c6e179ae386df0156021d7c35cbe5a3 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 21:25:42 2021 +0200 network commit 899be68a78270216bfdcca5f0c87668a87c8792f Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 15:43:05 2021 +0200 correct cached size commit a1c7f935e3a5661688c0de1ad3226f7bc43b9979 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 12:03:48 2021 +0200 vm stats from syscall + swap commit bd1050a7404f9766a0125523c868a27d5cfac8e8 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 10:48:07 2021 +0200 seems to work indeed commit 5094b73758ee88617e8d5ce876211e1efa298769 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 10:46:14 2021 +0200 allow override optimization flag commit 8811270332bc2276cd18c1116f4d3c2d64a6f721 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Oct 5 10:09:24 2021 +0200 update Makefile commit 42f966f448b9ad571db7849dc8fd525e0fe72309 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 15:32:55 2021 +0200 some more params commit c1e6d6a62e2810f80fac372e666ec169540b0591 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 15:15:55 2021 +0200 show more disks commit 50fcdaa8543f717bf36146cfa38636fd39009f23 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 14:52:56 2021 +0200 disks show something commit 264bf2d7da0e3fabb5987cddee73762e52170a51 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Mon Oct 4 09:15:35 2021 +0200 reformat commit 1fd625086ba42e9440c463ae940563d934b8b5c3 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 23:21:13 2021 +0200 decrease diff with upstream commit 17f9f3703c1dd52a86176131a2239cd52ee285bd Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 22:56:14 2021 +0200 try to get disks to show commit 8462ae6431fcfe1985d1bbb4404452ddc03cc1de Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 22:42:01 2021 +0200 don't crash on deque::back() commit 78bce5b5a6c1c0f3b38f802acad49ec2e32482d6 Merge: 53e379d f9505a4 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 22:08:34 2021 +0200 Merge branch 'aristocratos:main' into main commit 53e379d74dffe2282b089450728501b51d13d199 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 22:08:21 2021 +0200 cpu freq, name & process uid/name commit 2a44b307ef9e947c1007a86988876668a5731e64 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 21:46:11 2021 +0200 basic process info commit 66534eb5b50753217687de0414d390bcb2a14cf1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sun Oct 3 21:45:39 2021 +0200 initialize mutex (needed on macos apparently and not on linux) commit 0983917f26948d83fd8da103903ec99f88058d87 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 2 23:53:41 2021 +0200 comment commit 9732507248b30139d4af54615945c0b4737cff7d Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 2 23:51:29 2021 +0200 extract delimiters commit 6e704ce8387041c33022459fb6a084362f82a72c Merge: fe4db7c 7bfbd83 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 2 23:48:43 2021 +0200 Merge branch 'main' of github.com:joske/btop commit fe4db7c16cd349053385eda62e9f2df2e7344d3d Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Sat Oct 2 23:48:28 2021 +0200 first infos on macos: memory used & free commit 7bfbd83a476c8cbe3b74e22b1e44f201026bf9d1 Merge: 8c8139b a15f961 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Oct 1 17:05:26 2021 +0200 Merge branch 'aristocratos:main' into main commit 8c8139bd1df0849061b5e1425a3138d5f45ec149 Merge: 679d21c a246c09 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Sep 29 21:50:00 2021 +0200 Merge branch 'aristocratos:main' into main commit 679d21cd223b1928e8dde95cac25e8bfb412bedf Merge: 4c70c5b a49b8f9 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Sep 29 20:23:34 2021 +0200 Merge branch 'aristocratos:main' into main commit 4c70c5bdd98bfcc0ae9d9d9e8e3713dc8af71d03 Merge: 84a9746 c70667e Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Sep 29 08:30:05 2021 +0200 Merge branch 'aristocratos:main' into main commit 84a974695afaadc53d1d8576ea66255166ede482 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Tue Sep 28 23:37:03 2021 +0200 make it compile on macos (M1 - arm64). Does not run though Co-authored-by: Jos Dehaes <jos.dehaes@gmail.com>
2021-11-13 23:31:01 +01:00
clean_quit(0);
2021-09-12 15:58:23 +02:00
}
}
else if (is_in(key, "down", "tab", "mouse_scroll_down", "j")) {
2021-09-12 15:58:23 +02:00
if (++selected > 2) selected = 0;
}
else if (is_in(key, "up", "shift_tab", "mouse_scroll_up", "k")) {
2021-09-12 15:58:23 +02:00
if (--selected < 0) selected = 2;
}
else {
retval = NoChange;
}
if (retval == Changed) {
auto& out = Global::overlay;
out = bg + Fx::reset + Fx::b;
auto cy = y + 7;
for (const auto& i : iota(0, 3)) {
if (tty_mode) out += (i == selected ? Theme::c("hi_fg") : Theme::c("main_fg"));
const auto& menu = (not tty_mode and i == selected ? menu_selected[i] : menu_normal[i]);
const auto& colors = (i == selected ? colors_selected : colors_normal);
if (redraw) mouse_mappings["button_" + to_string(i)] = {cy, Term::width/2 - menu_width[i]/2, 3, menu_width[i]};
for (int ic = 0; const auto& line : menu) {
out += Mv::to(cy++, Term::width/2 - menu_width[i]/2) + (tty_mode ? "" : colors[ic++]) + line;
}
}
out += Fx::reset;
}
return (redraw ? Changed : retval);
}
2021-09-12 15:58:23 +02:00
int optionsMenu(const string& key) {
2021-09-12 15:58:23 +02:00
enum Predispositions { isBool, isInt, isString, is2D, isBrowseable, isEditable};
static int y{};
static int x{};
static int height{};
static int page{};
static int pages{};
static int selected{};
static int select_max{};
static int item_height{};
static int selected_cat{};
static int max_items{};
static int last_sel{};
static bool editing{};
2021-09-12 15:58:23 +02:00
static Draw::TextEdit editor;
static string warnings;
static bitset<8> selPred;
static const std::unordered_map<string, std::reference_wrapper<const vector<string>>> optionsList = {
2021-09-12 15:58:23 +02:00
{"color_theme", std::cref(Theme::themes)},
{"log_level", std::cref(Logger::log_levels)},
{"temp_scale", std::cref(Config::temp_scales)},
{"proc_sorting", std::cref(Proc::sort_vector)},
{"graph_symbol", std::cref(Config::valid_graph_symbols)},
{"graph_symbol_cpu", std::cref(Config::valid_graph_symbols_def)},
{"graph_symbol_mem", std::cref(Config::valid_graph_symbols_def)},
{"graph_symbol_net", std::cref(Config::valid_graph_symbols_def)},
{"graph_symbol_proc", std::cref(Config::valid_graph_symbols_def)},
{"cpu_graph_upper", std::cref(Cpu::available_fields)},
{"cpu_graph_lower", std::cref(Cpu::available_fields)},
{"cpu_sensor", std::cref(Cpu::available_sensors)},
{"selected_battery", std::cref(Config::available_batteries)},
#ifdef GPU_SUPPORT
{"show_gpu_info", std::cref(Config::show_gpu_values)},
{"graph_symbol_gpu", std::cref(Config::valid_graph_symbols_def)},
#endif
2021-09-12 15:58:23 +02:00
};
Squashed commit of the following: commit c296ac13cd4c16a11e137c309b7452bab096312e Merge: 9a1e760 091c30a Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:29:57 2023 +0200 Merge pull request #590 from nobounce/dangling-reference-config Convert parameters and config keys to std::string_view commit 9a1e760a661c9a160dd83e6d3ab710bf36b19b04 Merge: 9c8af4d 22e64ca Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:20:18 2023 +0200 Merge pull request #602 from jfouquart/main Fix getting zfs pool name with '.' char in freebsd commit 9c8af4df436c2847eefa66d2e0eb7ebfd75d70cf Merge: 8a49d8c 2217cbe Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:55 2023 +0200 Merge pull request #601 from joske/cleanup [macos] don't check /sys on macos commit 8a49d8cf456d0a15db65e7dc704d627b75a0fe43 Merge: 1556388 008fcd8 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:18:07 2023 +0200 Merge pull request #600 from joske/makefile [macos/freebsd] support gcc13 commit 1556388c83644d122fab9241aa876232d94d1928 Merge: 1b126f5 d17e1a2 Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Aug 26 19:14:00 2023 +0200 Merge pull request #599 from joske/main [macos] fix temp sensor on system with many cores commit d17e1a2dac79458940319d7117a21bdcd73ed53c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 16:18:39 2023 +0200 fix some warnings commit 4d8aa6b11896dac99f81019e6dea11cc8d8856f1 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Fri Aug 25 15:52:58 2023 +0200 fix core check commit 22e64caaff3d5877b7a494980a8ee3f17ea8f824 Author: Jonathan Fouquart <jfouquart@hotmail.fr> Date: Fri Aug 25 09:37:49 2023 +0200 Fix getting zfs pool name with '.' char in freebsd commit 2217cbe143dd5aa45dbd50b4dc829577e2e1ccda Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:01:04 2023 +0200 [macos] don't check /sys on macos commit 008fcd889e862f1d378d331dab51b3d3ce9d9f3c Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 16:05:00 2023 +0200 also add g++13 commit 0fdca5eb0385253969e029fdfcf1fb9cff83ea33 Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:54:07 2023 +0200 support gcc13 commit dcbdb7360d44b4071ec0fe0757a0875a12147c8a Author: Jos Dehaes <jos.dehaes@gmail.com> Date: Wed Aug 23 15:46:47 2023 +0200 [macos] fix temp sensor on system with many cores commit 1b126f55e38de76a2cca796593ef1554828d61e6 Author: aristocratos <gnmjpl@gmail.com> Date: Fri Aug 4 01:08:27 2023 +0200 Update Makefile for partial static compilation on freebsd commit c8ec6bbb000a865f14c50414e456955c473a2f3a Author: aristocratos <gnmjpl@gmail.com> Date: Thu Aug 3 23:08:33 2023 +0200 Fix freebsd nullptr changes and makefile for gcc12 and newer commit 8a33aab5885f828d7d0d2523aff31f9c33170332 Merge: 94e5c02 e4abcef Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sun Jul 30 13:21:48 2023 +0200 Merge pull request #539 from nobounce/replace-NULL-nullptr Modernize using nullptr. commit 94e5c02d113f3fc8956d63ef4f0eecebfbf31b9d Author: aristocratos <gnmjpl@gmail.com> Date: Thu Jul 27 20:51:21 2023 +0200 Better text editing commit 091c30ab2be074836bb8d9a4f658cec9a5b36303 Author: nobounce <steffen.winter@proton.me> Date: Thu Jul 27 14:17:54 2023 +0200 Convert parameters and config keys to std::string_view Using std::string_view instead of std::string& silences a new warning from GCC 13, -Wdangling-reference Also switch return type of `getI` from int& to int, trivial types are cheaper to copy by value commit e4abcefbf92e5d94ad169e1e47c0fbec7279fa6f Author: nobounce <steffen.winter@proton.me> Date: Wed Jul 26 16:19:17 2023 +0200 Use nullptr instead of NULL. See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf TLDR: NULL is of type int and relies on proper implicit pointer conversion which may lead to issues when using overloaded functions It is also considered a 'best practise' for modern C++ and conveys the programmers intention more precisly. commit d53307f14cfa9cb416a3d1c8919d4f61cbb20bf7 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files commit 594f42b9ebf886b70f6cdf0fb909d53eb6c5407f Merge: aca2e4b 53d6eba Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Jul 26 15:38:01 2023 +0200 Merge pull request #584 from nobounce/nb/fix-ci-path Fix path to Linux CI file in itself commit aca2e4be7568186e122f1506fa25bdfb8c4f7f2a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:38:48 2023 +0200 Fix whitespace indent -> tab indent commit 33faa01910309895763011dce2a3194b889a0b6a Author: aristocratos <gnmjpl@gmail.com> Date: Wed Jul 26 14:34:15 2023 +0200 Revert fmt submodule to static fmt folder in include commit 53d6ebabc052a618001fa857eff25d5252a89210 Author: nobounce <steffen.winter@proton.me> Date: Sun Jul 23 19:53:36 2023 +0200 Fix path to Linux CI file in itself The CI file has a list of dependent files including itself. The path was not updated when the CI was split into different files
2023-08-26 20:29:43 +02:00
auto tty_mode = Config::getB("tty_mode");
auto vim_keys = Config::getB("vim_keys");
2021-09-12 15:58:23 +02:00
if (max_items == 0) {
for (const auto& cat : categories) {
if ((int)cat.size() > max_items) max_items = cat.size();
}
}
if (bg.empty()) {
page = selected = selected_cat = last_sel = 0;
redraw = true;
Theme::updateThemes();
}
int retval = Changed;
bool recollect{};
bool screen_redraw{};
bool theme_refresh{};
2021-09-12 15:58:23 +02:00
2021-09-17 14:25:54 +02:00
//? Draw background if needed else process input
2021-09-12 15:58:23 +02:00
if (redraw) {
mouse_mappings.clear();
selPred.reset();
y = max(1, Term::height/2 - 3 - max_items);
x = Term::width/2 - 39;
height = min(Term::height - 7, max_items * 2 + 4);
if (height % 2 != 0) height--;
bg = Draw::banner_gen(y, 0, true)
+ Draw::createBox(x, y + 6, 78, height, Theme::c("hi_fg"), true, "tab" + Symbols::right)
+ Mv::to(y+8, x) + Theme::c("hi_fg") + Symbols::div_left + Theme::c("div_line") + Symbols::h_line * 29
+ Symbols::div_up + Symbols::h_line * (78 - 32) + Theme::c("hi_fg") + Symbols::div_right
+ Mv::to(y+6+height - 1, x+30) + Symbols::div_down + Theme::c("div_line");
for (const auto& i : iota(0, height - 4)) {
bg += Mv::to(y+9 + i, x + 30) + Symbols::v_line;
}
}
else if (not warnings.empty() and not key.empty()) {
auto ret = messageBox.input(key);
if (ret == msgBox::msgReturn::Ok_Yes or ret == msgBox::msgReturn::No_Esc) {
warnings.clear();
messageBox.clear();
}
}
else if (editing and not key.empty()) {
if (is_in(key, "escape", "mouse_click")) {
editor.clear();
editing = false;
}
else if (key == "enter") {
const auto& option = categories[selected_cat][item_height * page + selected][0];
if (selPred.test(isString) and Config::stringValid(option, editor.text)) {
Config::set(option, editor.text);
if (option == "custom_cpu_name" or option.starts_with("custom_gpu_name"))
2023-06-26 13:10:31 +02:00
screen_redraw = true;
else if (is_in(option, "shown_boxes", "presets")) {
screen_redraw = true;
Config::current_preset = -1;
}
2021-09-17 14:25:54 +02:00
else if (option == "clock_format") {
Draw::update_clock(true);
screen_redraw = true;
}
else if (option == "cpu_core_map") {
atomic_wait(Runner::active);
Cpu::core_mapping = Cpu::get_core_mapping();
}
2021-09-12 15:58:23 +02:00
}
else if (selPred.test(isInt) and Config::intValid(option, editor.text)) {
Config::set(option, stoi(editor.text));
}
else
warnings = Config::validError;
editor.clear();
editing = false;
}
else if (not editor.command(key))
retval = NoChange;
}
else if (key == "mouse_click") {
const auto [mouse_x, mouse_y] = Input::mouse_pos;
if (mouse_x < x or mouse_x > x + 80 or mouse_y < y + 6 or mouse_y > y + 6 + height) {
return Closed;
}
else if (mouse_x < x + 30 and mouse_y > y + 8) {
auto m_select = ceil((double)(mouse_y - y - 8) / 2) - 1;
if (selected != m_select)
selected = m_select;
else if (selPred.test(isEditable))
goto mouseEnter;
else retval = NoChange;
}
}
else if (is_in(key, "enter", "e", "E") and selPred.test(isEditable)) {
mouseEnter:
const auto& option = categories[selected_cat][item_height * page + selected][0];
editor = Draw::TextEdit{Config::getAsString(option), selPred.test(isInt)};
editing = true;
mouse_mappings.clear();
}
else if (is_in(key, "escape", "q", "o", "backspace")) {
return Closed;
}
else if (is_in(key, "down", "mouse_scroll_down") or (vim_keys and key == "j")) {
2021-09-12 15:58:23 +02:00
if (++selected > select_max or selected >= item_height) {
if (page < pages - 1) page++;
else if (pages > 1) page = 0;
selected = 0;
}
}
else if (is_in(key, "up", "mouse_scroll_up") or (vim_keys and key == "k")) {
2021-09-12 15:58:23 +02:00
if (--selected < 0) {
if (page > 0) page--;
else if (pages > 1) page = pages - 1;
selected = item_height - 1;
}
}
else if (pages > 1 and key == "page_down") {
if (++page >= pages) page = 0;
selected = 0;
}
else if (pages > 1 and key == "page_up") {
if (--page < 0) page = pages - 1;
selected = 0;
}
else if (key == "tab") {
if (++selected_cat >= (int)categories.size()) selected_cat = 0;
page = selected = 0;
}
else if (key == "shift_tab") {
if (--selected_cat < 0) selected_cat = (int)categories.size() - 1;
page = selected = 0;
}
2023-06-26 13:10:31 +02:00
else if (is_in(key, "1", "2", "3", "4", "5", "6") or key.starts_with("select_cat_")) {
2021-09-12 15:58:23 +02:00
selected_cat = key.back() - '0' - 1;
page = selected = 0;
}
else if (is_in(key, "left", "right") or (vim_keys and is_in(key, "h", "l"))) {
2021-09-12 15:58:23 +02:00
const auto& option = categories[selected_cat][item_height * page + selected][0];
if (selPred.test(isInt)) {
const int mod = (option == "update_ms" ? 100 : 1);
long value = Config::getI(option);
if (key == "right" or (vim_keys and key == "l")) value += mod;
2021-09-12 15:58:23 +02:00
else value -= mod;
if (Config::intValid(option, to_string(value)))
Config::set(option, static_cast<int>(value));
else {
warnings = Config::validError;
}
}
else if (selPred.test(isBool)) {
Config::flip(option);
screen_redraw = true;
if (option == "truecolor") {
theme_refresh = true;
Config::flip("lowcolor");
}
else if (option == "force_tty") {
theme_refresh = true;
Config::flip("tty_mode");
}
else if (is_in(option, "rounded_corners", "theme_background"))
theme_refresh = true;
2021-09-17 14:25:54 +02:00
else if (option == "background_update") {
Runner::pause_output = false;
}
2022-01-16 13:39:50 +01:00
else if (option == "base_10_sizes") {
recollect = true;
}
2021-09-12 15:58:23 +02:00
}
else if (selPred.test(isBrowseable)) {
auto& optList = optionsList.at(option).get();
int i = v_index(optList, Config::getS(option));
2021-11-04 12:44:11 +01:00
if ((key == "right" or (vim_keys and key == "l")) and ++i >= (int)optList.size()) i = 0;
else if ((key == "left" or (vim_keys and key == "h")) and --i < 0) i = optList.size() - 1;
2021-09-12 15:58:23 +02:00
Config::set(option, optList.at(i));
if (option == "color_theme")
theme_refresh = true;
2021-09-17 14:25:54 +02:00
else if (option == "log_level") {
Logger::set(optList.at(i));
Logger::info("Logger set to " + optList.at(i));
}
else if (is_in(option, "proc_sorting", "cpu_sensor", "show_gpu_info") or option.starts_with("graph_symbol") or option.starts_with("cpu_graph_"))
2021-09-12 15:58:23 +02:00
screen_redraw = true;
}
else
retval = NoChange;
}
else {
retval = NoChange;
}
2021-09-17 14:25:54 +02:00
//? Draw the menu
2021-09-12 15:58:23 +02:00
if (retval == Changed) {
Config::unlock();
auto& out = Global::overlay;
out = bg;
item_height = min((int)categories[selected_cat].size(), (int)floor((double)(height - 4) / 2));
pages = ceil((double)categories[selected_cat].size() / item_height);
if (page > pages - 1) page = pages - 1;
select_max = min(item_height - 1, (int)categories[selected_cat].size() - 1 - item_height * page);
if (selected > select_max) {
selected = select_max;
}
2021-09-17 14:25:54 +02:00
//? Get variable properties for currently selected option
2021-09-12 15:58:23 +02:00
if (selPred.none() or last_sel != (selected_cat << 8) + selected) {
selPred.reset();
last_sel = (selected_cat << 8) + selected;
const auto& selOption = categories[selected_cat][item_height * page + selected][0];
if (Config::ints.contains(selOption))
selPred.set(isInt);
else if (Config::bools.contains(selOption))
selPred.set(isBool);
else
selPred.set(isString);
if (not selPred.test(isString))
selPred.set(is2D);
else if (optionsList.contains(selOption)) {
selPred.set(isBrowseable);
}
if (not selPred.test(isBrowseable) and (selPred.test(isString) or selPred.test(isInt)))
selPred.set(isEditable);
}
2021-09-17 14:25:54 +02:00
//? Category buttons
2021-09-12 15:58:23 +02:00
out += Mv::to(y+7, x+4);
#ifdef GPU_SUPPORT
2023-06-26 13:10:31 +02:00
for (int i = 0; const auto& m : {"general", "cpu", "gpu", "mem", "net", "proc"}) {
#else
for (int i = 0; const auto& m : {"general", "cpu", "mem", "net", "proc"}) {
#endif
2021-09-12 15:58:23 +02:00
out += Fx::b + (i == selected_cat
? Theme::c("hi_fg") + '[' + Theme::c("title") + m + Theme::c("hi_fg") + ']'
: Theme::c("hi_fg") + to_string(i + 1) + Theme::c("title") + m + ' ')
#ifdef GPU_SUPPORT
2023-06-26 13:10:31 +02:00
+ Mv::r(7);
#else
+ Mv::r(10);
#endif
2021-09-12 15:58:23 +02:00
if (string button_name = "select_cat_" + to_string(i + 1); not editing and not mouse_mappings.contains(button_name))
mouse_mappings[button_name] = {y+6, x+2 + 15*i, 3, 15};
i++;
}
if (pages > 1) {
out += Mv::to(y+6 + height - 1, x+2) + Theme::c("hi_fg") + Symbols::title_left_down + Fx::b + Symbols::up + Theme::c("title") + " page "
2021-09-12 15:58:23 +02:00
+ to_string(page+1) + '/' + to_string(pages) + ' ' + Theme::c("hi_fg") + Symbols::down + Fx::ub + Symbols::title_right_down;
}
2021-09-17 14:25:54 +02:00
//? Option name and value
2021-09-12 15:58:23 +02:00
auto cy = y+9;
for (int c = 0, i = max(0, item_height * page); c++ < item_height and i < (int)categories[selected_cat].size(); i++) {
const auto& option = categories[selected_cat][i][0];
const auto& value = (option == "color_theme" ? (string) fs::path(Config::getS("color_theme")).stem() : Config::getAsString(option));
out += Mv::to(cy++, x + 1) + (c-1 == selected ? Theme::c("selected_bg") + Theme::c("selected_fg") : Theme::c("title"))
+ Fx::b + cjust(capitalize(s_replace(option, "_", " "))
+ (c-1 == selected and selPred.test(isBrowseable)
? ' ' + to_string(v_index(optionsList.at(option).get(), (option == "color_theme" ? Config::getS("color_theme") : value)) + 1) + '/' + to_string(optionsList.at(option).get().size())
: ""), 29);
out += Mv::to(cy++, x + 1) + (c-1 == selected ? "" : Theme::c("main_fg")) + Fx::ub + " "
+ (c-1 == selected and editing ? cjust(editor(24), 34, true) : cjust(value, 25, true)) + " ";
if (c-1 == selected) {
if (not editing and (selPred.test(is2D) or selPred.test(isBrowseable))) {
out += Fx::b + Mv::to(cy-1, x+2) + Symbols::left + Mv::to(cy-1, x+28) + Symbols::right;
mouse_mappings["left"] = {cy-2, x, 2, 5};
mouse_mappings["right"] = {cy-2, x+25, 2, 5};
}
if (selPred.test(isEditable)) {
out += Fx::b + Mv::to(cy-1, x+28 - (not editing and selPred.test(isInt) ? 2 : 0)) + (tty_mode ? "E" : Symbols::enter);
}
2021-09-17 14:25:54 +02:00
//? Description of selected option
2021-09-12 15:58:23 +02:00
out += Fx::reset + Theme::c("title") + Fx::b;
for (int cyy = y+7; const auto& desc : categories[selected_cat][i]) {
if (cyy++ == y+7) continue;
else if (cyy == y+10) out += Theme::c("main_fg") + Fx::ub;
else if (cyy > y + height + 4) break;
out += Mv::to(cyy, x+32) + desc;
}
}
}
if (not warnings.empty()) {
messageBox = msgBox{min(78, (int)ulen(warnings) + 10), msgBox::BoxTypes::OK, {uresize(warnings, 74)}, "warning"};
out += messageBox();
}
out += Fx::reset;
}
if (theme_refresh) {
Theme::setTheme();
Draw::banner_gen(0, 0, false, true);
screen_redraw = true;
redraw = true;
optionsMenu("");
}
if (screen_redraw) {
auto overlay_bkp = std::move(Global::overlay);
auto clock_bkp = std::move(Global::clock);
2021-09-12 15:58:23 +02:00
Draw::calcSizes();
Global::overlay = std::move(overlay_bkp);
Global::clock = std::move(clock_bkp);
2021-09-12 15:58:23 +02:00
recollect = true;
}
if (recollect) {
Runner::run("all", false, true);
retval = NoChange;
}
return (redraw ? Changed : retval);
}
2021-09-12 15:58:23 +02:00
int helpMenu(const string& key) {
static int y{};
static int x{};
static int height{};
static int page{};
static int pages{};
2022-10-02 23:29:05 +02:00
2021-09-12 15:58:23 +02:00
if (bg.empty()) page = 0;
int retval = Changed;
if (redraw) {
y = max(1, Term::height/2 - 4 - (int)(help_text.size() / 2));
x = Term::width/2 - 39;
height = min(Term::height - 6, (int)help_text.size() + 3);
pages = ceil((double)help_text.size() / (height - 3));
page = 0;
bg = Draw::banner_gen(y, 0, true);
bg += Draw::createBox(x, y + 6, 78, height, Theme::c("hi_fg"), true, "help");
}
else if (is_in(key, "escape", "q", "h", "backspace", "space", "enter", "mouse_click")) {
return Closed;
}
else if (pages > 1 and is_in(key, "down", "page_down", "tab", "mouse_scroll_down")) {
if (++page >= pages) page = 0;
}
else if (pages > 1 and is_in(key, "up", "page_up", "shift_tab", "mouse_scroll_up")) {
if (--page < 0) page = pages - 1;
}
else {
retval = NoChange;
}
if (retval == Changed) {
auto& out = Global::overlay;
out = bg;
if (pages > 1) {
out += Mv::to(y+height+6, x + 2) + Theme::c("hi_fg") + Symbols::title_left_down + Fx::b + Symbols::up + Theme::c("title") + " page "
+ to_string(page+1) + '/' + to_string(pages) + ' ' + Theme::c("hi_fg") + Symbols::down + Fx::ub + Symbols::title_right_down;
}
auto cy = y+7;
out += Mv::to(cy++, x + 1) + Theme::c("title") + Fx::b + cjust("Key:", 20) + "Description:";
for (int c = 0, i = max(0, (height - 3) * page); c++ < height - 3 and i < (int)help_text.size(); i++) {
out += Mv::to(cy++, x + 1) + Theme::c("hi_fg") + Fx::b + cjust(help_text[i][0], 20)
+ Theme::c("main_fg") + Fx::ub + help_text[i][1];
}
out += Fx::reset;
}
return (redraw ? Changed : retval);
}
//* Add menus here and update enum Menus in header
const auto menuFunc = vector{
ref(sizeError),
ref(signalChoose),
ref(signalSend),
ref(signalReturn),
ref(optionsMenu),
ref(helpMenu),
ref(mainMenu),
};
bitset<8> menuMask;
void process(string key) {
if (menuMask.none()) {
Menu::active = false;
Global::overlay.clear();
Global::overlay.shrink_to_fit();
2021-09-12 15:58:23 +02:00
Runner::pause_output = false;
bg.clear();
bg.shrink_to_fit();
currentMenu = -1;
Runner::run("all", true, true);
2021-09-12 15:58:23 +02:00
mouse_mappings.clear();
return;
}
if (currentMenu < 0 or not menuMask.test(currentMenu)) {
Menu::active = true;
redraw = true;
if (((menuMask.test(Main) or menuMask.test(Options) or menuMask.test(Help) or menuMask.test(SignalChoose))
and (Term::width < 80 or Term::height < 24))
or (Term::width < 50 or Term::height < 20)) {
menuMask.reset();
menuMask.set(SizeError);
}
for (const auto& i : iota(0, (int)menuMask.size())) {
if (menuMask.test(i)) currentMenu = i;
}
}
auto retCode = menuFunc.at(currentMenu)(key);
if (retCode == Closed) {
menuMask.reset(currentMenu);
2021-09-12 15:58:23 +02:00
mouse_mappings.clear();
bg.clear();
Runner::pause_output = false;
process();
}
else if (redraw) {
redraw = false;
Runner::run("all", true, true);
}
else if (retCode == Changed)
Runner::run("overlay");
2021-09-12 15:58:23 +02:00
else if (retCode == Switch) {
Runner::pause_output = false;
bg.clear();
redraw = true;
mouse_mappings.clear();
process();
}
}
2021-09-17 14:25:54 +02:00
void show(int menu, int signal) {
menuMask.set(menu);
signalToSend = signal;
process();
}
2021-09-12 15:58:23 +02:00
}