2006-03-04 18:16:49 +00:00
|
|
|
/*
|
|
|
|
htop - CRT.c
|
2011-05-26 16:35:07 +00:00
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2006-03-04 18:16:49 +00:00
|
|
|
Released under the GNU GPL, see the COPYING file
|
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2017-07-26 18:40:55 +00:00
|
|
|
#include "config.h"
|
2006-03-04 18:16:49 +00:00
|
|
|
#include "CRT.h"
|
|
|
|
|
2015-08-19 16:43:20 +00:00
|
|
|
#include "StringUtils.h"
|
2013-02-26 16:50:21 +00:00
|
|
|
#include "RichString.h"
|
2011-12-26 21:35:57 +00:00
|
|
|
|
2013-02-26 16:50:21 +00:00
|
|
|
#include <stdio.h>
|
2012-10-19 18:59:48 +00:00
|
|
|
#include <errno.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
#include <signal.h>
|
|
|
|
#include <stdlib.h>
|
2012-10-19 18:59:48 +00:00
|
|
|
#include <string.h>
|
2015-01-22 01:27:31 +00:00
|
|
|
#include <locale.h>
|
2015-07-16 06:12:48 +00:00
|
|
|
#include <langinfo.h>
|
2017-07-26 18:40:55 +00:00
|
|
|
#if HAVE_SETUID_ENABLED
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2017-05-23 17:02:34 +00:00
|
|
|
#define ColorIndex(i,j) ((7-i)*8+j)
|
|
|
|
|
|
|
|
#define ColorPair(i,j) COLOR_PAIR(ColorIndex(i,j))
|
2006-03-04 18:16:49 +00:00
|
|
|
|
|
|
|
#define Black COLOR_BLACK
|
|
|
|
#define Red COLOR_RED
|
|
|
|
#define Green COLOR_GREEN
|
|
|
|
#define Yellow COLOR_YELLOW
|
|
|
|
#define Blue COLOR_BLUE
|
|
|
|
#define Magenta COLOR_MAGENTA
|
|
|
|
#define Cyan COLOR_CYAN
|
|
|
|
#define White COLOR_WHITE
|
|
|
|
|
2017-05-23 17:02:34 +00:00
|
|
|
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
|
2018-02-05 06:01:12 +00:00
|
|
|
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)
|
2017-05-23 17:02:34 +00:00
|
|
|
|
2015-08-19 21:55:24 +00:00
|
|
|
#define KEY_WHEELUP KEY_F(20)
|
|
|
|
#define KEY_WHEELDOWN KEY_F(21)
|
2015-08-19 22:09:54 +00:00
|
|
|
#define KEY_RECLICK KEY_F(22)
|
2015-08-19 21:55:24 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
//#link curses
|
|
|
|
|
|
|
|
/*{
|
2011-12-26 21:35:57 +00:00
|
|
|
#include <stdbool.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
typedef enum TreeStr_ {
|
|
|
|
TREE_STR_HORZ,
|
|
|
|
TREE_STR_VERT,
|
|
|
|
TREE_STR_RTEE,
|
|
|
|
TREE_STR_BEND,
|
|
|
|
TREE_STR_TEND,
|
|
|
|
TREE_STR_OPEN,
|
|
|
|
TREE_STR_SHUT,
|
|
|
|
TREE_STR_COUNT
|
|
|
|
} TreeStr;
|
|
|
|
|
2020-08-26 00:15:00 +00:00
|
|
|
typedef enum CheckStr_ {
|
|
|
|
CHECK_STR_NONE,
|
|
|
|
CHECK_STR_PARTIAL,
|
|
|
|
CHECK_STR_FULL,
|
|
|
|
CHECK_STR_COUNT
|
|
|
|
} CheckStr;
|
|
|
|
|
|
|
|
typedef enum CollapStr_ {
|
|
|
|
COLLAP_STR_OPEN,
|
|
|
|
COLLAP_STR_CLOSED,
|
|
|
|
COLLAP_STR_COUNT
|
|
|
|
} CollapStr;
|
|
|
|
|
2015-02-03 21:30:05 +00:00
|
|
|
typedef enum ColorSchemes_ {
|
|
|
|
COLORSCHEME_DEFAULT = 0,
|
|
|
|
COLORSCHEME_MONOCHROME = 1,
|
|
|
|
COLORSCHEME_BLACKONWHITE = 2,
|
|
|
|
COLORSCHEME_LIGHTTERMINAL = 3,
|
|
|
|
COLORSCHEME_MIDNIGHT = 4,
|
2015-02-04 13:41:18 +00:00
|
|
|
COLORSCHEME_BLACKNIGHT = 5,
|
2015-04-09 18:17:20 +00:00
|
|
|
COLORSCHEME_BROKENGRAY = 6,
|
|
|
|
LAST_COLORSCHEME = 7,
|
2015-02-03 21:30:05 +00:00
|
|
|
} ColorSchemes;
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
typedef enum ColorElements_ {
|
|
|
|
RESET_COLOR,
|
|
|
|
DEFAULT_COLOR,
|
|
|
|
FUNCTION_BAR,
|
|
|
|
FUNCTION_KEY,
|
|
|
|
FAILED_SEARCH,
|
|
|
|
PANEL_HEADER_FOCUS,
|
|
|
|
PANEL_HEADER_UNFOCUS,
|
2015-04-09 18:17:20 +00:00
|
|
|
PANEL_SELECTION_FOCUS,
|
|
|
|
PANEL_SELECTION_FOLLOW,
|
|
|
|
PANEL_SELECTION_UNFOCUS,
|
2006-03-04 18:16:49 +00:00
|
|
|
LARGE_NUMBER,
|
|
|
|
METER_TEXT,
|
|
|
|
METER_VALUE,
|
|
|
|
LED_COLOR,
|
|
|
|
UPTIME,
|
2008-09-23 06:21:28 +00:00
|
|
|
BATTERY,
|
2006-03-04 18:16:49 +00:00
|
|
|
TASKS_RUNNING,
|
|
|
|
SWAP,
|
|
|
|
PROCESS,
|
|
|
|
PROCESS_SHADOW,
|
|
|
|
PROCESS_TAG,
|
|
|
|
PROCESS_MEGABYTES,
|
|
|
|
PROCESS_TREE,
|
|
|
|
PROCESS_R_STATE,
|
2014-10-14 01:30:17 +00:00
|
|
|
PROCESS_D_STATE,
|
2006-03-04 18:16:49 +00:00
|
|
|
PROCESS_BASENAME,
|
|
|
|
PROCESS_HIGH_PRIORITY,
|
|
|
|
PROCESS_LOW_PRIORITY,
|
2008-03-08 23:39:48 +00:00
|
|
|
PROCESS_THREAD,
|
|
|
|
PROCESS_THREAD_BASENAME,
|
2006-03-04 18:16:49 +00:00
|
|
|
BAR_BORDER,
|
|
|
|
BAR_SHADOW,
|
|
|
|
GRAPH_1,
|
|
|
|
GRAPH_2,
|
|
|
|
MEMORY_USED,
|
|
|
|
MEMORY_BUFFERS,
|
2014-04-24 16:15:52 +00:00
|
|
|
MEMORY_BUFFERS_TEXT,
|
2006-03-04 18:16:49 +00:00
|
|
|
MEMORY_CACHE,
|
|
|
|
LOAD,
|
|
|
|
LOAD_AVERAGE_FIFTEEN,
|
|
|
|
LOAD_AVERAGE_FIVE,
|
|
|
|
LOAD_AVERAGE_ONE,
|
|
|
|
CHECK_MARK,
|
|
|
|
CHECK_TEXT,
|
|
|
|
CLOCK,
|
2010-08-24 23:20:38 +00:00
|
|
|
HELP_BOLD,
|
|
|
|
HOSTNAME,
|
2006-03-04 18:16:49 +00:00
|
|
|
CPU_NICE,
|
2014-04-24 16:15:52 +00:00
|
|
|
CPU_NICE_TEXT,
|
2006-03-04 18:16:49 +00:00
|
|
|
CPU_NORMAL,
|
2020-08-20 04:09:27 +00:00
|
|
|
CPU_SYSTEM,
|
2006-10-04 14:21:27 +00:00
|
|
|
CPU_IOWAIT,
|
|
|
|
CPU_IRQ,
|
|
|
|
CPU_SOFTIRQ,
|
2010-08-24 23:20:38 +00:00
|
|
|
CPU_STEAL,
|
|
|
|
CPU_GUEST,
|
2020-08-20 03:59:41 +00:00
|
|
|
PRESSURE_STALL_TEN,
|
|
|
|
PRESSURE_STALL_SIXTY,
|
|
|
|
PRESSURE_STALL_THREEHUNDRED,
|
2019-07-06 04:27:49 +00:00
|
|
|
ZFS_MFU,
|
|
|
|
ZFS_MRU,
|
|
|
|
ZFS_ANON,
|
|
|
|
ZFS_HEADER,
|
|
|
|
ZFS_OTHER,
|
2019-09-03 18:26:02 +00:00
|
|
|
ZFS_COMPRESSED,
|
|
|
|
ZFS_RATIO,
|
2006-03-04 18:16:49 +00:00
|
|
|
LAST_COLORELEMENT
|
|
|
|
} ColorElements;
|
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_fatalError(const char* note) __attribute__ ((noreturn));
|
2014-04-24 15:17:11 +00:00
|
|
|
|
2020-07-10 00:35:32 +00:00
|
|
|
extern void CRT_handleSIGSEGV(int sgn);
|
2014-11-24 20:55:03 +00:00
|
|
|
|
2016-03-09 02:16:34 +00:00
|
|
|
#define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A'))
|
2016-02-19 15:38:02 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
}*/
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
const char *CRT_treeStrAscii[TREE_STR_COUNT] = {
|
|
|
|
"-", // TREE_STR_HORZ
|
|
|
|
"|", // TREE_STR_VERT
|
|
|
|
"`", // TREE_STR_RTEE
|
|
|
|
"`", // TREE_STR_BEND
|
|
|
|
",", // TREE_STR_TEND
|
|
|
|
"+", // TREE_STR_OPEN
|
|
|
|
"-", // TREE_STR_SHUT
|
|
|
|
};
|
|
|
|
|
2020-08-26 00:15:00 +00:00
|
|
|
const char *CRT_checkStrAscii[CHECK_STR_COUNT] = {
|
|
|
|
"[ ]", // CHECK_STR_NONE
|
|
|
|
"[o]", // CHECK_STR_PARTIAL
|
|
|
|
"[x]", // CHECK_STR_FULL
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *CRT_collapStrAscii[COLLAP_STR_COUNT] = {
|
|
|
|
"[-]", // COLLAP_STR_OPEN
|
|
|
|
"[+]", // COLLAP_STR_CLOSED
|
|
|
|
};
|
|
|
|
|
2015-07-17 12:33:34 +00:00
|
|
|
#ifdef HAVE_LIBNCURSESW
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
const char *CRT_treeStrUtf8[TREE_STR_COUNT] = {
|
|
|
|
"\xe2\x94\x80", // TREE_STR_HORZ ─
|
|
|
|
"\xe2\x94\x82", // TREE_STR_VERT │
|
|
|
|
"\xe2\x94\x9c", // TREE_STR_RTEE ├
|
|
|
|
"\xe2\x94\x94", // TREE_STR_BEND └
|
|
|
|
"\xe2\x94\x8c", // TREE_STR_TEND ┌
|
|
|
|
"+", // TREE_STR_OPEN +
|
|
|
|
"\xe2\x94\x80", // TREE_STR_SHUT ─
|
|
|
|
};
|
|
|
|
|
2020-08-26 00:15:00 +00:00
|
|
|
const char *CRT_checkStrUtf8[CHECK_STR_COUNT] = {
|
|
|
|
"\xe2\x98\x90", // CHECK_STR_NONE ☐
|
|
|
|
"\xe2\x98\x92", // CHECK_STR_PARTIAL ☒
|
|
|
|
"\xe2\x98\x91", // CHECK_STR_FULL ☑
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *CRT_collapStrUtf8[COLLAP_STR_COUNT] = {
|
|
|
|
"\xe2\x8a\x9f", // COLLAP_STR_OPEN ⊟
|
|
|
|
"\xe2\x8a\x9e", // COLLAP_STR_CLOSED ⊞
|
|
|
|
};
|
2015-07-17 12:33:34 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2020-08-26 00:15:00 +00:00
|
|
|
bool CRT_utf8 = false;
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
const char **CRT_treeStr = CRT_treeStrAscii;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-08-26 00:15:00 +00:00
|
|
|
const char **CRT_checkStr = CRT_checkStrAscii;
|
|
|
|
|
|
|
|
const char **CRT_collapStr = CRT_collapStrAscii;
|
|
|
|
|
2011-12-26 21:35:57 +00:00
|
|
|
static bool CRT_hasColors;
|
|
|
|
|
2015-02-04 13:41:18 +00:00
|
|
|
int CRT_delay = 0;
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2015-02-03 21:30:05 +00:00
|
|
|
int* CRT_colors;
|
|
|
|
|
|
|
|
int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
|
|
|
[COLORSCHEME_DEFAULT] = {
|
|
|
|
[RESET_COLOR] = ColorPair(White,Black),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(White,Black),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
|
|
|
[FUNCTION_KEY] = ColorPair(White,Black),
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
2015-04-09 18:17:20 +00:00
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black,White),
|
2015-02-03 21:30:05 +00:00
|
|
|
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
|
|
|
[UPTIME] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[BATTERY] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
|
|
|
|
[METER_TEXT] = ColorPair(Cyan,Black),
|
|
|
|
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[LED_COLOR] = ColorPair(Green,Black),
|
|
|
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[PROCESS] = A_NORMAL,
|
2017-05-23 17:02:34 +00:00
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black),
|
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Cyan,Black),
|
|
|
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[PROCESS_TREE] = ColorPair(Cyan,Black),
|
|
|
|
[PROCESS_R_STATE] = ColorPair(Green,Black),
|
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black),
|
2015-07-14 10:43:38 +00:00
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Green,Black),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[BAR_BORDER] = A_BOLD,
|
2017-05-23 17:02:34 +00:00
|
|
|
[BAR_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2015-02-03 21:30:05 +00:00
|
|
|
[SWAP] = ColorPair(Red,Black),
|
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[GRAPH_2] = ColorPair(Cyan,Black),
|
|
|
|
[MEMORY_USED] = ColorPair(Green,Black),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Blue,Black),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow,Black),
|
2015-02-04 13:41:18 +00:00
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Cyan,Black),
|
|
|
|
[LOAD_AVERAGE_FIVE] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[LOAD] = A_BOLD,
|
|
|
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[CLOCK] = A_BOLD,
|
2020-08-26 00:15:00 +00:00
|
|
|
[CHECK_MARK] = A_BOLD | ColorPair(Cyan,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[CHECK_TEXT] = A_NORMAL,
|
|
|
|
[HOSTNAME] = A_BOLD,
|
|
|
|
[CPU_NICE] = ColorPair(Blue,Black),
|
|
|
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green,Black),
|
2020-08-20 04:09:27 +00:00
|
|
|
[CPU_SYSTEM] = ColorPair(Red,Black),
|
2020-04-27 04:31:17 +00:00
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPairGrayBlack,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CPU_IRQ] = ColorPair(Yellow,Black),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Magenta,Black),
|
|
|
|
[CPU_STEAL] = ColorPair(Cyan,Black),
|
|
|
|
[CPU_GUEST] = ColorPair(Cyan,Black),
|
2020-08-20 03:59:41 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Cyan,Black),
|
|
|
|
[PRESSURE_STALL_SIXTY] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White,Black),
|
2019-07-06 04:27:49 +00:00
|
|
|
[ZFS_MFU] = ColorPair(Blue,Black),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow,Black),
|
|
|
|
[ZFS_ANON] = ColorPair(Magenta,Black),
|
|
|
|
[ZFS_HEADER] = ColorPair(Cyan,Black),
|
|
|
|
[ZFS_OTHER] = ColorPair(Magenta,Black),
|
2019-09-03 18:26:02 +00:00
|
|
|
[ZFS_COMPRESSED] = ColorPair(Blue,Black),
|
|
|
|
[ZFS_RATIO] = ColorPair(Magenta,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_MONOCHROME] = {
|
|
|
|
[RESET_COLOR] = A_NORMAL,
|
|
|
|
[DEFAULT_COLOR] = A_NORMAL,
|
|
|
|
[FUNCTION_BAR] = A_REVERSE,
|
|
|
|
[FUNCTION_KEY] = A_NORMAL,
|
|
|
|
[PANEL_HEADER_FOCUS] = A_REVERSE,
|
|
|
|
[PANEL_HEADER_UNFOCUS] = A_REVERSE,
|
2015-04-09 18:17:20 +00:00
|
|
|
[PANEL_SELECTION_FOCUS] = A_REVERSE,
|
|
|
|
[PANEL_SELECTION_FOLLOW] = A_REVERSE,
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[FAILED_SEARCH] = A_REVERSE | A_BOLD,
|
|
|
|
[UPTIME] = A_BOLD,
|
|
|
|
[BATTERY] = A_BOLD,
|
|
|
|
[LARGE_NUMBER] = A_BOLD,
|
|
|
|
[METER_TEXT] = A_NORMAL,
|
|
|
|
[METER_VALUE] = A_BOLD,
|
|
|
|
[LED_COLOR] = A_NORMAL,
|
|
|
|
[TASKS_RUNNING] = A_BOLD,
|
|
|
|
[PROCESS] = A_NORMAL,
|
|
|
|
[PROCESS_SHADOW] = A_DIM,
|
|
|
|
[PROCESS_TAG] = A_BOLD,
|
|
|
|
[PROCESS_MEGABYTES] = A_BOLD,
|
|
|
|
[PROCESS_BASENAME] = A_BOLD,
|
|
|
|
[PROCESS_TREE] = A_BOLD,
|
|
|
|
[PROCESS_R_STATE] = A_BOLD,
|
|
|
|
[PROCESS_D_STATE] = A_BOLD,
|
|
|
|
[PROCESS_HIGH_PRIORITY] = A_BOLD,
|
|
|
|
[PROCESS_LOW_PRIORITY] = A_DIM,
|
|
|
|
[PROCESS_THREAD] = A_BOLD,
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_REVERSE,
|
|
|
|
[BAR_BORDER] = A_BOLD,
|
|
|
|
[BAR_SHADOW] = A_DIM,
|
|
|
|
[SWAP] = A_BOLD,
|
|
|
|
[GRAPH_1] = A_BOLD,
|
|
|
|
[GRAPH_2] = A_NORMAL,
|
|
|
|
[MEMORY_USED] = A_BOLD,
|
|
|
|
[MEMORY_BUFFERS] = A_NORMAL,
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_NORMAL,
|
|
|
|
[MEMORY_CACHE] = A_NORMAL,
|
|
|
|
[LOAD_AVERAGE_FIFTEEN] = A_DIM,
|
|
|
|
[LOAD_AVERAGE_FIVE] = A_NORMAL,
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD,
|
|
|
|
[LOAD] = A_BOLD,
|
|
|
|
[HELP_BOLD] = A_BOLD,
|
|
|
|
[CLOCK] = A_BOLD,
|
2020-08-26 00:15:00 +00:00
|
|
|
[CHECK_MARK] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CHECK_TEXT] = A_NORMAL,
|
|
|
|
[HOSTNAME] = A_BOLD,
|
|
|
|
[CPU_NICE] = A_NORMAL,
|
|
|
|
[CPU_NICE_TEXT] = A_NORMAL,
|
|
|
|
[CPU_NORMAL] = A_BOLD,
|
2020-08-20 04:09:27 +00:00
|
|
|
[CPU_SYSTEM] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
[CPU_IOWAIT] = A_NORMAL,
|
|
|
|
[CPU_IRQ] = A_BOLD,
|
|
|
|
[CPU_SOFTIRQ] = A_BOLD,
|
|
|
|
[CPU_STEAL] = A_REVERSE,
|
|
|
|
[CPU_GUEST] = A_REVERSE,
|
2020-08-20 03:59:41 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = A_DIM,
|
|
|
|
[PRESSURE_STALL_SIXTY] = A_NORMAL,
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD,
|
2019-07-06 04:27:49 +00:00
|
|
|
[ZFS_MFU] = A_NORMAL,
|
|
|
|
[ZFS_MRU] = A_NORMAL,
|
|
|
|
[ZFS_ANON] = A_DIM,
|
|
|
|
[ZFS_HEADER] = A_BOLD,
|
|
|
|
[ZFS_OTHER] = A_DIM,
|
2019-09-03 18:26:02 +00:00
|
|
|
[ZFS_COMPRESSED] = A_BOLD,
|
|
|
|
[ZFS_RATIO] = A_BOLD,
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_BLACKONWHITE] = {
|
|
|
|
[RESET_COLOR] = ColorPair(Black,White),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(Black,White),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
|
|
|
[FUNCTION_KEY] = ColorPair(Black,White),
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
2015-04-09 18:17:20 +00:00
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue,White),
|
2015-02-03 21:30:05 +00:00
|
|
|
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
|
|
|
[UPTIME] = ColorPair(Yellow,White),
|
|
|
|
[BATTERY] = ColorPair(Yellow,White),
|
|
|
|
[LARGE_NUMBER] = ColorPair(Red,White),
|
|
|
|
[METER_TEXT] = ColorPair(Blue,White),
|
|
|
|
[METER_VALUE] = ColorPair(Black,White),
|
|
|
|
[LED_COLOR] = ColorPair(Green,White),
|
|
|
|
[TASKS_RUNNING] = ColorPair(Green,White),
|
|
|
|
[PROCESS] = ColorPair(Black,White),
|
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,White),
|
|
|
|
[PROCESS_TAG] = ColorPair(White,Blue),
|
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Blue,White),
|
|
|
|
[PROCESS_BASENAME] = ColorPair(Blue,White),
|
|
|
|
[PROCESS_TREE] = ColorPair(Green,White),
|
|
|
|
[PROCESS_R_STATE] = ColorPair(Green,White),
|
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,White),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,White),
|
2015-07-14 10:43:38 +00:00
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green,White),
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Blue,White),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,White),
|
|
|
|
[BAR_BORDER] = ColorPair(Blue,White),
|
|
|
|
[BAR_SHADOW] = ColorPair(Black,White),
|
|
|
|
[SWAP] = ColorPair(Red,White),
|
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Blue,White),
|
|
|
|
[GRAPH_2] = ColorPair(Blue,White),
|
|
|
|
[MEMORY_USED] = ColorPair(Green,White),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Cyan,White),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,White),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow,White),
|
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,White),
|
|
|
|
[LOAD_AVERAGE_FIVE] = ColorPair(Black,White),
|
|
|
|
[LOAD_AVERAGE_ONE] = ColorPair(Black,White),
|
|
|
|
[LOAD] = ColorPair(Black,White),
|
|
|
|
[HELP_BOLD] = ColorPair(Blue,White),
|
|
|
|
[CLOCK] = ColorPair(Black,White),
|
|
|
|
[CHECK_MARK] = ColorPair(Black,White),
|
|
|
|
[CHECK_TEXT] = ColorPair(Black,White),
|
|
|
|
[HOSTNAME] = ColorPair(Black,White),
|
|
|
|
[CPU_NICE] = ColorPair(Cyan,White),
|
|
|
|
[CPU_NICE_TEXT] = ColorPair(Cyan,White),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green,White),
|
2020-08-20 04:09:27 +00:00
|
|
|
[CPU_SYSTEM] = ColorPair(Red,White),
|
2020-04-27 04:32:58 +00:00
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Black,White),
|
2015-02-03 21:30:05 +00:00
|
|
|
[CPU_IRQ] = ColorPair(Blue,White),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Blue,White),
|
|
|
|
[CPU_STEAL] = ColorPair(Cyan,White),
|
|
|
|
[CPU_GUEST] = ColorPair(Cyan,White),
|
2020-08-20 03:59:41 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Black,White),
|
|
|
|
[PRESSURE_STALL_SIXTY] = ColorPair(Black,White),
|
|
|
|
[PRESSURE_STALL_TEN] = ColorPair(Black,White),
|
2019-07-06 04:27:49 +00:00
|
|
|
[ZFS_MFU] = ColorPair(Cyan,White),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow,White),
|
|
|
|
[ZFS_ANON] = ColorPair(Magenta,White),
|
|
|
|
[ZFS_HEADER] = ColorPair(Yellow,White),
|
|
|
|
[ZFS_OTHER] = ColorPair(Magenta,White),
|
2019-09-03 18:26:02 +00:00
|
|
|
[ZFS_COMPRESSED] = ColorPair(Cyan,White),
|
|
|
|
[ZFS_RATIO] = ColorPair(Magenta,White),
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_LIGHTTERMINAL] = {
|
|
|
|
[RESET_COLOR] = ColorPair(Black,Black),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(Black,Black),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
|
|
|
[FUNCTION_KEY] = ColorPair(Black,Black),
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
2015-04-09 18:17:20 +00:00
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
|
|
|
[UPTIME] = ColorPair(Yellow,Black),
|
|
|
|
[BATTERY] = ColorPair(Yellow,Black),
|
|
|
|
[LARGE_NUMBER] = ColorPair(Red,Black),
|
|
|
|
[METER_TEXT] = ColorPair(Blue,Black),
|
|
|
|
[METER_VALUE] = ColorPair(Black,Black),
|
|
|
|
[LED_COLOR] = ColorPair(Green,Black),
|
|
|
|
[TASKS_RUNNING] = ColorPair(Green,Black),
|
|
|
|
[PROCESS] = ColorPair(Black,Black),
|
2017-05-23 17:02:34 +00:00
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_TAG] = ColorPair(White,Blue),
|
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Blue,Black),
|
|
|
|
[PROCESS_BASENAME] = ColorPair(Green,Black),
|
|
|
|
[PROCESS_TREE] = ColorPair(Blue,Black),
|
|
|
|
[PROCESS_R_STATE] = ColorPair(Green,Black),
|
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black),
|
2015-07-14 10:43:38 +00:00
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Blue,Black),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[BAR_BORDER] = ColorPair(Blue,Black),
|
2017-05-23 17:02:34 +00:00
|
|
|
[BAR_SHADOW] = ColorPairGrayBlack,
|
2015-02-03 21:30:05 +00:00
|
|
|
[SWAP] = ColorPair(Red,Black),
|
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[GRAPH_2] = ColorPair(Cyan,Black),
|
|
|
|
[MEMORY_USED] = ColorPair(Green,Black),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Cyan,Black),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,Black),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow,Black),
|
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,Black),
|
|
|
|
[LOAD_AVERAGE_FIVE] = ColorPair(Black,Black),
|
|
|
|
[LOAD_AVERAGE_ONE] = ColorPair(Black,Black),
|
|
|
|
[LOAD] = ColorPair(White,Black),
|
|
|
|
[HELP_BOLD] = ColorPair(Blue,Black),
|
|
|
|
[CLOCK] = ColorPair(White,Black),
|
|
|
|
[CHECK_MARK] = ColorPair(Black,Black),
|
|
|
|
[CHECK_TEXT] = ColorPair(Black,Black),
|
|
|
|
[HOSTNAME] = ColorPair(White,Black),
|
|
|
|
[CPU_NICE] = ColorPair(Cyan,Black),
|
|
|
|
[CPU_NICE_TEXT] = ColorPair(Cyan,Black),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green,Black),
|
2020-08-20 04:09:27 +00:00
|
|
|
[CPU_SYSTEM] = ColorPair(Red,Black),
|
2020-04-27 04:32:58 +00:00
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Black,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Blue,Black),
|
|
|
|
[CPU_STEAL] = ColorPair(Black,Black),
|
|
|
|
[CPU_GUEST] = ColorPair(Black,Black),
|
2020-08-20 03:59:41 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Black,Black),
|
|
|
|
[PRESSURE_STALL_SIXTY] = ColorPair(Black,Black),
|
|
|
|
[PRESSURE_STALL_TEN] = ColorPair(Black,Black),
|
2019-07-06 04:27:49 +00:00
|
|
|
[ZFS_MFU] = ColorPair(Cyan,Black),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow,Black),
|
|
|
|
[ZFS_ANON] = A_BOLD | ColorPair(Magenta,Black),
|
|
|
|
[ZFS_HEADER] = ColorPair(Black,Black),
|
|
|
|
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta,Black),
|
2019-09-03 18:26:02 +00:00
|
|
|
[ZFS_COMPRESSED] = ColorPair(Cyan,Black),
|
|
|
|
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_MIDNIGHT] = {
|
|
|
|
[RESET_COLOR] = ColorPair(White,Blue),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(White,Blue),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
|
|
|
[FUNCTION_KEY] = A_NORMAL,
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black,Cyan),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Cyan),
|
2015-04-09 18:17:20 +00:00
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black,White),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = A_BOLD | ColorPair(Yellow,Blue),
|
2015-02-03 21:30:05 +00:00
|
|
|
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
|
|
|
[UPTIME] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[BATTERY] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Blue),
|
|
|
|
[METER_TEXT] = ColorPair(Cyan,Blue),
|
|
|
|
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[LED_COLOR] = ColorPair(Green,Blue),
|
|
|
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Blue),
|
|
|
|
[PROCESS] = ColorPair(White,Blue),
|
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Blue),
|
|
|
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[PROCESS_MEGABYTES] = ColorPair(Cyan,Blue),
|
|
|
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[PROCESS_TREE] = ColorPair(Cyan,Blue),
|
|
|
|
[PROCESS_R_STATE] = ColorPair(Green,Blue),
|
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Blue),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Blue),
|
2015-07-14 10:43:38 +00:00
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Blue),
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_THREAD] = ColorPair(Green,Blue),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green,Blue),
|
|
|
|
[BAR_BORDER] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[BAR_SHADOW] = ColorPair(Cyan,Blue),
|
|
|
|
[SWAP] = ColorPair(Red,Blue),
|
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[GRAPH_2] = ColorPair(Cyan,Blue),
|
|
|
|
[MEMORY_USED] = A_BOLD | ColorPair(Green,Blue),
|
|
|
|
[MEMORY_BUFFERS] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[MEMORY_CACHE] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Blue),
|
|
|
|
[LOAD_AVERAGE_FIVE] = A_NORMAL | ColorPair(White,Blue),
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White,Blue),
|
|
|
|
[LOAD] = A_BOLD | ColorPair(White,Blue),
|
|
|
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[CLOCK] = ColorPair(White,Blue),
|
2020-08-26 00:15:00 +00:00
|
|
|
[CHECK_MARK] = A_BOLD | ColorPair(Cyan,Blue),
|
2015-02-03 21:30:05 +00:00
|
|
|
[CHECK_TEXT] = A_NORMAL | ColorPair(White,Blue),
|
|
|
|
[HOSTNAME] = ColorPair(White,Blue),
|
|
|
|
[CPU_NICE] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Cyan,Blue),
|
|
|
|
[CPU_NORMAL] = A_BOLD | ColorPair(Green,Blue),
|
2020-08-20 04:09:27 +00:00
|
|
|
[CPU_SYSTEM] = A_BOLD | ColorPair(Red,Blue),
|
2015-02-03 21:30:05 +00:00
|
|
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Blue,Blue),
|
|
|
|
[CPU_IRQ] = A_BOLD | ColorPair(Black,Blue),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Black,Blue),
|
|
|
|
[CPU_STEAL] = ColorPair(White,Blue),
|
|
|
|
[CPU_GUEST] = ColorPair(White,Blue),
|
2020-08-20 03:59:41 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = A_BOLD | ColorPair(Black,Blue),
|
|
|
|
[PRESSURE_STALL_SIXTY] = A_NORMAL | ColorPair(White,Blue),
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White,Blue),
|
2019-07-06 04:27:49 +00:00
|
|
|
[ZFS_MFU] = A_BOLD | ColorPair(White,Blue),
|
|
|
|
[ZFS_MRU] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[ZFS_ANON] = A_BOLD | ColorPair(Magenta,Blue),
|
|
|
|
[ZFS_HEADER] = A_BOLD | ColorPair(Yellow,Blue),
|
|
|
|
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta,Blue),
|
2019-09-03 18:26:02 +00:00
|
|
|
[ZFS_COMPRESSED] = A_BOLD | ColorPair(White,Blue),
|
|
|
|
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta,Blue),
|
2015-02-03 21:30:05 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_BLACKNIGHT] = {
|
|
|
|
[RESET_COLOR] = ColorPair(Cyan,Black),
|
|
|
|
[DEFAULT_COLOR] = ColorPair(Cyan,Black),
|
|
|
|
[FUNCTION_BAR] = ColorPair(Black,Green),
|
|
|
|
[FUNCTION_KEY] = ColorPair(Cyan,Black),
|
|
|
|
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
|
|
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
2015-04-09 18:17:20 +00:00
|
|
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
|
|
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
|
|
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black,White),
|
2015-02-03 21:30:05 +00:00
|
|
|
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
|
|
|
[UPTIME] = ColorPair(Green,Black),
|
|
|
|
[BATTERY] = ColorPair(Green,Black),
|
|
|
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
|
|
|
|
[METER_TEXT] = ColorPair(Cyan,Black),
|
|
|
|
[METER_VALUE] = ColorPair(Green,Black),
|
|
|
|
[LED_COLOR] = ColorPair(Green,Black),
|
|
|
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[PROCESS] = ColorPair(Cyan,Black),
|
2017-05-23 17:02:34 +00:00
|
|
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
2015-02-03 21:30:05 +00:00
|
|
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black),
|
|
|
|
[PROCESS_MEGABYTES] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[PROCESS_TREE] = ColorPair(Cyan,Black),
|
|
|
|
[PROCESS_THREAD] = ColorPair(Green,Black),
|
|
|
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[PROCESS_R_STATE] = ColorPair(Green,Black),
|
|
|
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black),
|
|
|
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black),
|
2015-07-14 10:43:38 +00:00
|
|
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[BAR_BORDER] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[BAR_SHADOW] = ColorPair(Cyan,Black),
|
|
|
|
[SWAP] = ColorPair(Red,Black),
|
|
|
|
[GRAPH_1] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[GRAPH_2] = ColorPair(Green,Black),
|
|
|
|
[MEMORY_USED] = ColorPair(Green,Black),
|
|
|
|
[MEMORY_BUFFERS] = ColorPair(Blue,Black),
|
|
|
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[MEMORY_CACHE] = ColorPair(Yellow,Black),
|
|
|
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green,Black),
|
|
|
|
[LOAD_AVERAGE_FIVE] = ColorPair(Green,Black),
|
|
|
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[LOAD] = A_BOLD,
|
|
|
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black),
|
|
|
|
[CLOCK] = ColorPair(Green,Black),
|
|
|
|
[CHECK_MARK] = A_BOLD | ColorPair(Green,Black),
|
|
|
|
[CHECK_TEXT] = ColorPair(Cyan,Black),
|
|
|
|
[HOSTNAME] = ColorPair(Green,Black),
|
|
|
|
[CPU_NICE] = ColorPair(Blue,Black),
|
|
|
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[CPU_NORMAL] = ColorPair(Green,Black),
|
2020-08-20 04:09:27 +00:00
|
|
|
[CPU_SYSTEM] = ColorPair(Red,Black),
|
2015-02-03 21:30:05 +00:00
|
|
|
[CPU_IOWAIT] = ColorPair(Yellow,Black),
|
|
|
|
[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black),
|
|
|
|
[CPU_SOFTIRQ] = ColorPair(Blue,Black),
|
|
|
|
[CPU_STEAL] = ColorPair(Cyan,Black),
|
|
|
|
[CPU_GUEST] = ColorPair(Cyan,Black),
|
2020-08-20 03:59:41 +00:00
|
|
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Green,Black),
|
|
|
|
[PRESSURE_STALL_SIXTY] = ColorPair(Green,Black),
|
|
|
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(Green,Black),
|
2019-07-06 04:27:49 +00:00
|
|
|
[ZFS_MFU] = ColorPair(Blue,Black),
|
|
|
|
[ZFS_MRU] = ColorPair(Yellow,Black),
|
|
|
|
[ZFS_ANON] = ColorPair(Magenta,Black),
|
|
|
|
[ZFS_HEADER] = ColorPair(Yellow,Black),
|
|
|
|
[ZFS_OTHER] = ColorPair(Magenta,Black),
|
2019-09-03 18:26:02 +00:00
|
|
|
[ZFS_COMPRESSED] = ColorPair(Blue,Black),
|
|
|
|
[ZFS_RATIO] = ColorPair(Magenta,Black),
|
2015-04-09 18:17:20 +00:00
|
|
|
},
|
|
|
|
[COLORSCHEME_BROKENGRAY] = { 0 } // dynamically generated.
|
2015-02-03 21:30:05 +00:00
|
|
|
};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2011-09-08 01:10:58 +00:00
|
|
|
int CRT_cursorX = 0;
|
|
|
|
|
2014-02-27 19:35:22 +00:00
|
|
|
int CRT_scrollHAmount = 5;
|
|
|
|
|
2015-08-19 21:55:24 +00:00
|
|
|
int CRT_scrollWheelVAmount = 10;
|
|
|
|
|
2006-07-23 22:45:24 +00:00
|
|
|
char* CRT_termType;
|
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
// TODO move color scheme to Settings, perhaps?
|
|
|
|
|
|
|
|
int CRT_colorScheme = 0;
|
|
|
|
|
2010-08-24 23:20:38 +00:00
|
|
|
void *backtraceArray[128];
|
|
|
|
|
2010-02-25 01:35:12 +00:00
|
|
|
static void CRT_handleSIGTERM(int sgn) {
|
|
|
|
(void) sgn;
|
2008-03-09 08:58:38 +00:00
|
|
|
CRT_done();
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2017-07-26 18:40:55 +00:00
|
|
|
#if HAVE_SETUID_ENABLED
|
|
|
|
|
|
|
|
static int CRT_euid = -1;
|
|
|
|
|
|
|
|
static int CRT_egid = -1;
|
|
|
|
|
|
|
|
#define DIE(msg) do { CRT_done(); fprintf(stderr, msg); exit(1); } while(0)
|
|
|
|
|
|
|
|
void CRT_dropPrivileges() {
|
|
|
|
CRT_egid = getegid();
|
|
|
|
CRT_euid = geteuid();
|
|
|
|
if (setegid(getgid()) == -1) {
|
|
|
|
DIE("Fatal error: failed dropping group privileges.\n");
|
|
|
|
}
|
|
|
|
if (seteuid(getuid()) == -1) {
|
|
|
|
DIE("Fatal error: failed dropping user privileges.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_restorePrivileges() {
|
|
|
|
if (CRT_egid == -1 || CRT_euid == -1) {
|
|
|
|
DIE("Fatal error: internal inconsistency.\n");
|
|
|
|
}
|
|
|
|
if (setegid(CRT_egid) == -1) {
|
|
|
|
DIE("Fatal error: failed restoring group privileges.\n");
|
|
|
|
}
|
|
|
|
if (seteuid(CRT_euid) == -1) {
|
|
|
|
DIE("Fatal error: failed restoring user privileges.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* Turn setuid operations into NOPs */
|
|
|
|
|
|
|
|
#ifndef CRT_dropPrivileges
|
|
|
|
#define CRT_dropPrivileges()
|
|
|
|
#define CRT_restorePrivileges()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
// TODO: pass an instance of Settings instead.
|
|
|
|
|
|
|
|
void CRT_init(int delay, int colorScheme) {
|
|
|
|
initscr();
|
|
|
|
noecho();
|
2015-02-04 13:41:18 +00:00
|
|
|
CRT_delay = delay;
|
2014-04-28 20:55:52 +00:00
|
|
|
if (CRT_delay == 0) {
|
|
|
|
CRT_delay = 1;
|
|
|
|
}
|
2015-02-03 21:30:05 +00:00
|
|
|
CRT_colors = CRT_colorSchemes[colorScheme];
|
2006-03-04 18:16:49 +00:00
|
|
|
CRT_colorScheme = colorScheme;
|
2019-10-31 16:39:12 +00:00
|
|
|
|
2015-04-09 18:17:20 +00:00
|
|
|
for (int i = 0; i < LAST_COLORELEMENT; i++) {
|
2015-10-05 14:27:44 +00:00
|
|
|
unsigned int color = CRT_colorSchemes[COLORSCHEME_DEFAULT][i];
|
2017-05-23 17:02:34 +00:00
|
|
|
CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPairGrayBlack) ? ColorPair(White,Black) : color;
|
2015-04-09 18:17:20 +00:00
|
|
|
}
|
2019-10-31 16:39:12 +00:00
|
|
|
|
2014-04-28 20:55:52 +00:00
|
|
|
halfdelay(CRT_delay);
|
2006-03-04 18:16:49 +00:00
|
|
|
nonl();
|
|
|
|
intrflush(stdscr, false);
|
|
|
|
keypad(stdscr, true);
|
2015-08-19 21:55:24 +00:00
|
|
|
mouseinterval(0);
|
2006-03-04 18:16:49 +00:00
|
|
|
curs_set(0);
|
|
|
|
if (has_colors()) {
|
|
|
|
start_color();
|
|
|
|
CRT_hasColors = true;
|
|
|
|
} else {
|
|
|
|
CRT_hasColors = false;
|
|
|
|
}
|
2006-07-23 22:45:24 +00:00
|
|
|
CRT_termType = getenv("TERM");
|
2014-02-27 19:35:22 +00:00
|
|
|
if (String_eq(CRT_termType, "linux"))
|
|
|
|
CRT_scrollHAmount = 20;
|
|
|
|
else
|
|
|
|
CRT_scrollHAmount = 5;
|
2017-05-11 14:55:24 +00:00
|
|
|
if (String_startsWith(CRT_termType, "xterm") || String_eq(CRT_termType, "vt220")) {
|
2006-03-04 18:16:49 +00:00
|
|
|
define_key("\033[H", KEY_HOME);
|
|
|
|
define_key("\033[F", KEY_END);
|
2014-04-09 20:47:22 +00:00
|
|
|
define_key("\033[7~", KEY_HOME);
|
|
|
|
define_key("\033[8~", KEY_END);
|
2006-03-04 18:16:49 +00:00
|
|
|
define_key("\033OP", KEY_F(1));
|
|
|
|
define_key("\033OQ", KEY_F(2));
|
|
|
|
define_key("\033OR", KEY_F(3));
|
|
|
|
define_key("\033OS", KEY_F(4));
|
|
|
|
define_key("\033[11~", KEY_F(1));
|
|
|
|
define_key("\033[12~", KEY_F(2));
|
|
|
|
define_key("\033[13~", KEY_F(3));
|
|
|
|
define_key("\033[14~", KEY_F(4));
|
|
|
|
define_key("\033[17;2~", KEY_F(18));
|
2016-02-19 15:38:02 +00:00
|
|
|
char sequence[3] = "\033a";
|
|
|
|
for (char c = 'a'; c <= 'z'; c++) {
|
|
|
|
sequence[1] = c;
|
|
|
|
define_key(sequence, KEY_ALT('A' + (c - 'a')));
|
|
|
|
}
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
#ifndef DEBUG
|
|
|
|
signal(11, CRT_handleSIGSEGV);
|
|
|
|
#endif
|
|
|
|
signal(SIGTERM, CRT_handleSIGTERM);
|
2016-05-30 18:06:22 +00:00
|
|
|
signal(SIGQUIT, CRT_handleSIGTERM);
|
2006-03-04 18:16:49 +00:00
|
|
|
use_default_colors();
|
|
|
|
if (!has_colors())
|
|
|
|
CRT_colorScheme = 1;
|
|
|
|
CRT_setColors(CRT_colorScheme);
|
|
|
|
|
2015-07-16 06:08:18 +00:00
|
|
|
/* initialize locale */
|
2015-07-29 09:28:15 +00:00
|
|
|
setlocale(LC_CTYPE, "");
|
2015-07-16 06:08:18 +00:00
|
|
|
|
2015-01-22 01:27:31 +00:00
|
|
|
#ifdef HAVE_LIBNCURSESW
|
2020-08-26 00:15:00 +00:00
|
|
|
if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
|
2015-01-22 01:27:31 +00:00
|
|
|
CRT_utf8 = true;
|
2020-08-26 00:15:00 +00:00
|
|
|
CRT_treeStr = CRT_treeStrUtf8;
|
|
|
|
CRT_checkStr = CRT_checkStrUtf8;
|
|
|
|
CRT_collapStr = CRT_collapStrUtf8;
|
|
|
|
}
|
2015-07-17 12:33:34 +00:00
|
|
|
#endif
|
2015-01-22 01:27:31 +00:00
|
|
|
|
2015-08-19 21:55:24 +00:00
|
|
|
#if NCURSES_MOUSE_VERSION > 1
|
|
|
|
mousemask(BUTTON1_RELEASED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
|
|
|
|
#else
|
|
|
|
mousemask(BUTTON1_RELEASED, NULL);
|
|
|
|
#endif
|
2016-02-19 15:38:02 +00:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_done() {
|
|
|
|
curs_set(1);
|
|
|
|
endwin();
|
|
|
|
}
|
|
|
|
|
2012-10-19 18:59:48 +00:00
|
|
|
void CRT_fatalError(const char* note) {
|
|
|
|
char* sysMsg = strerror(errno);
|
|
|
|
CRT_done();
|
|
|
|
fprintf(stderr, "%s: %s\n", note, sysMsg);
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
int CRT_readKey() {
|
|
|
|
nocbreak();
|
|
|
|
cbreak();
|
2006-08-24 21:28:29 +00:00
|
|
|
nodelay(stdscr, FALSE);
|
2006-03-04 18:16:49 +00:00
|
|
|
int ret = getch();
|
2014-04-28 20:55:52 +00:00
|
|
|
halfdelay(CRT_delay);
|
2006-03-04 18:16:49 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_disableDelay() {
|
|
|
|
nocbreak();
|
|
|
|
cbreak();
|
|
|
|
nodelay(stdscr, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_enableDelay() {
|
2014-04-28 20:55:52 +00:00
|
|
|
halfdelay(CRT_delay);
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CRT_setColors(int colorScheme) {
|
|
|
|
CRT_colorScheme = colorScheme;
|
2018-02-05 06:01:12 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
|
|
for (int j = 0; j < 8; j++) {
|
|
|
|
if (ColorIndex(i,j) != ColorPairGrayBlack) {
|
|
|
|
int bg = (colorScheme != COLORSCHEME_BLACKNIGHT)
|
|
|
|
? (j==0 ? -1 : j)
|
|
|
|
: j;
|
|
|
|
init_pair(ColorIndex(i,j), i, bg);
|
2017-05-23 17:02:34 +00:00
|
|
|
}
|
2018-02-05 06:01:12 +00:00
|
|
|
}
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
2018-02-05 06:01:12 +00:00
|
|
|
|
|
|
|
int grayBlackFg = COLORS > 8 ? 8 : 0;
|
|
|
|
int grayBlackBg = (colorScheme != COLORSCHEME_BLACKNIGHT)
|
|
|
|
? -1
|
|
|
|
: 0;
|
|
|
|
init_pair(ColorIndexGrayBlack, grayBlackFg, grayBlackBg);
|
|
|
|
|
2015-02-03 21:30:05 +00:00
|
|
|
CRT_colors = CRT_colorSchemes[colorScheme];
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|