1 #ifndef HEADER_Settings 2 #define HEADER_Settings 3 /* 4 htop - Settings.h 5 (C) 2004-2011 Hisham H. Muhammad 6 Released under the GNU GPLv2+, see the COPYING file 7 in the source distribution for its full text. 8 */ 9 10 #include "config.h" // IWYU pragma: keep 11 12 #include <stdbool.h> 13 #include <stdint.h> 14 15 #include "Hashtable.h" 16 #include "HeaderLayout.h" 17 #include "Process.h" 18 19 20 #define DEFAULT_DELAY 15 21 22 #define CONFIG_READER_MIN_VERSION 2 23 24 typedef struct { 25 size_t len; 26 char** names; 27 int* modes; 28 } MeterColumnSetting; 29 30 typedef struct Settings_ { 31 char* filename; 32 int config_version; 33 HeaderLayout hLayout; 34 MeterColumnSetting* hColumns; 35 Hashtable* dynamicColumns; 36 37 ProcessField* fields; 38 uint32_t flags; 39 int colorScheme; 40 int delay; 41 42 int direction; 43 int treeDirection; 44 ProcessField sortKey; 45 ProcessField treeSortKey; 46 47 bool countCPUsFromOne; 48 bool detailedCPUTime; 49 bool showCPUUsage; 50 bool showCPUFrequency; 51 #ifdef BUILD_WITH_CPU_TEMP 52 bool showCPUTemperature; 53 bool degreeFahrenheit; 54 #endif 55 bool treeView; 56 bool treeViewAlwaysByPID; 57 bool allBranchesCollapsed; 58 bool showProgramPath; 59 bool shadowOtherUsers; 60 bool showThreadNames; 61 bool hideKernelThreads; 62 bool hideUserlandThreads; 63 bool highlightBaseName; 64 bool highlightDeletedExe; 65 bool highlightMegabytes; 66 bool highlightThreads; 67 bool highlightChanges; 68 int highlightDelaySecs; 69 bool findCommInCmdline; 70 bool stripExeFromCmdline; 71 bool showMergedCommand; 72 bool updateProcessNames; 73 bool accountGuestInCPUMeter; 74 bool headerMargin; 75 #ifdef HAVE_GETMOUSE 76 bool enableMouse; 77 #endif 78 int hideFunctionBar; // 0 - off, 1 - on ESC until next input, 2 - permanently 79 #ifdef HAVE_LIBHWLOC 80 bool topologyAffinity; 81 #endif 82 83 bool changed; 84 } Settings; 85 86 #define Settings_cpuId(settings, cpu) ((settings)->countCPUsFromOne ? (cpu)+1 : (cpu)) 87 Settings_getActiveSortKey(const Settings * this)88static inline ProcessField Settings_getActiveSortKey(const Settings* this) { 89 return (this->treeView) 90 ? (this->treeViewAlwaysByPID ? PID : this->treeSortKey) 91 : this->sortKey; 92 } 93 Settings_getActiveDirection(const Settings * this)94static inline int Settings_getActiveDirection(const Settings* this) { 95 return this->treeView ? this->treeDirection : this->direction; 96 } 97 98 void Settings_delete(Settings* this); 99 100 int Settings_write(const Settings* this, bool onCrash); 101 102 Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicColumns); 103 104 void Settings_invertSortOrder(Settings* this); 105 106 void Settings_setSortKey(Settings* this, ProcessField sortKey); 107 108 void Settings_enableReadonly(void); 109 110 bool Settings_isReadonly(void); 111 112 void Settings_setHeaderLayout(Settings* this, HeaderLayout hLayout); 113 114 #endif 115