htop/Settings.h

135 lines
3.1 KiB
C
Raw Normal View History

2006-03-04 18:16:49 +00:00
#ifndef HEADER_Settings
#define HEADER_Settings
/*
2006-06-06 20:28:42 +00:00
htop - Settings.h
2011-05-26 16:35:07 +00:00
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
2006-03-04 18:16:49 +00:00
in the source distribution for its full text.
*/
#include "config.h" // IWYU pragma: keep
2011-12-26 21:35:57 +00:00
#include <stdbool.h>
2020-12-06 14:22:41 +00:00
#include <stdint.h>
2006-03-04 18:16:49 +00:00
#include "Hashtable.h"
2020-12-25 15:42:35 +00:00
#include "HeaderLayout.h"
2020-09-18 17:23:04 +00:00
#include "Process.h"
#define DEFAULT_DELAY 15
#define CONFIG_READER_MIN_VERSION 3
typedef struct {
const char* name;
const char* columns;
const char* sortKey;
} ScreenDefaults;
typedef struct {
size_t len;
char** names;
int* modes;
2020-12-25 15:42:35 +00:00
} MeterColumnSetting;
typedef struct {
char* name;
ProcessField* fields;
uint32_t flags;
int direction;
int treeDirection;
ProcessField sortKey;
ProcessField treeSortKey;
bool treeView;
bool treeViewAlwaysByPID;
bool allBranchesCollapsed;
} ScreenSettings;
2006-03-04 18:16:49 +00:00
typedef struct Settings_ {
char* filename;
int config_version;
2020-12-25 15:42:35 +00:00
HeaderLayout hLayout;
MeterColumnSetting* hColumns;
Hashtable* dynamicColumns;
ScreenSettings** screens;
unsigned int nScreens;
unsigned int ssIndex;
ScreenSettings* ss;
2006-03-04 18:16:49 +00:00
int colorScheme;
int delay;
bool countCPUsFromOne;
bool detailedCPUTime;
bool showCPUUsage;
bool showCPUFrequency;
#ifdef BUILD_WITH_CPU_TEMP
bool showCPUTemperature;
bool degreeFahrenheit;
#endif
bool showProgramPath;
bool shadowOtherUsers;
bool showThreadNames;
bool hideKernelThreads;
bool hideUserlandThreads;
bool highlightBaseName;
bool highlightDeletedExe;
bool highlightMegabytes;
bool highlightThreads;
2020-10-31 01:56:16 +00:00
bool highlightChanges;
int highlightDelaySecs;
2020-10-17 10:54:45 +00:00
bool findCommInCmdline;
bool stripExeFromCmdline;
bool showMergedCommand;
bool updateProcessNames;
bool accountGuestInCPUMeter;
bool headerMargin;
bool screenTabs;
#ifdef HAVE_GETMOUSE
2019-07-12 19:41:09 +00:00
bool enableMouse;
#endif
int hideFunctionBar; // 0 - off, 1 - on ESC until next input, 2 - permanently
#ifdef HAVE_LIBHWLOC
bool topologyAffinity;
#endif
2014-02-27 19:35:22 +00:00
bool changed;
uint64_t lastUpdate;
2006-03-04 18:16:49 +00:00
} Settings;
#define Settings_cpuId(settings, cpu) ((settings)->countCPUsFromOne ? (cpu)+1 : (cpu))
2006-03-04 18:16:49 +00:00
static inline ProcessField ScreenSettings_getActiveSortKey(const ScreenSettings* this) {
return (this->treeView)
? (this->treeViewAlwaysByPID ? PID : this->treeSortKey)
: this->sortKey;
}
static inline int ScreenSettings_getActiveDirection(const ScreenSettings* this) {
return this->treeView ? this->treeDirection : this->direction;
}
void Settings_delete(Settings* this);
2006-03-04 18:16:49 +00:00
2021-05-16 17:55:31 +00:00
int Settings_write(const Settings* this, bool onCrash);
2006-03-04 18:16:49 +00:00
Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicColumns);
ScreenSettings* Settings_newScreen(Settings* this, const ScreenDefaults* defaults);
2021-12-08 13:20:54 +00:00
void ScreenSettings_delete(ScreenSettings* this);
void ScreenSettings_invertSortOrder(ScreenSettings* this);
void ScreenSettings_setSortKey(ScreenSettings* this, ProcessField sortKey);
void Settings_enableReadonly(void);
bool Settings_isReadonly(void);
2020-12-25 15:42:35 +00:00
void Settings_setHeaderLayout(Settings* this, HeaderLayout hLayout);
2006-03-04 18:16:49 +00:00
#endif