Commit ac5cecb6 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Option to display hostname in the meters area

parent c3d682b0
...@@ -100,6 +100,7 @@ typedef enum ColorElements_ { ...@@ -100,6 +100,7 @@ typedef enum ColorElements_ {
CPU_IOWAIT, CPU_IOWAIT,
CPU_IRQ, CPU_IRQ,
CPU_SOFTIRQ, CPU_SOFTIRQ,
HOSTNAME,
LAST_COLORELEMENT LAST_COLORELEMENT
} ColorElements; } ColorElements;
...@@ -264,6 +265,7 @@ void CRT_setColors(int colorScheme) { ...@@ -264,6 +265,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CPU_IOWAIT] = A_NORMAL; CRT_colors[CPU_IOWAIT] = A_NORMAL;
CRT_colors[CPU_IRQ] = A_BOLD; CRT_colors[CPU_IRQ] = A_BOLD;
CRT_colors[CPU_SOFTIRQ] = A_BOLD; CRT_colors[CPU_SOFTIRQ] = A_BOLD;
CRT_colors[HOSTNAME] = A_BOLD;
} else if (CRT_colorScheme == COLORSCHEME_BLACKONWHITE) { } else if (CRT_colorScheme == COLORSCHEME_BLACKONWHITE) {
CRT_colors[RESET_COLOR] = ColorPair(Black,White); CRT_colors[RESET_COLOR] = ColorPair(Black,White);
CRT_colors[DEFAULT_COLOR] = ColorPair(Black,White); CRT_colors[DEFAULT_COLOR] = ColorPair(Black,White);
...@@ -322,6 +324,7 @@ void CRT_setColors(int colorScheme) { ...@@ -322,6 +324,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black); CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black);
CRT_colors[CPU_IRQ] = ColorPair(Blue,White); CRT_colors[CPU_IRQ] = ColorPair(Blue,White);
CRT_colors[CPU_SOFTIRQ] = ColorPair(Blue,White); CRT_colors[CPU_SOFTIRQ] = ColorPair(Blue,White);
CRT_colors[HOSTNAME] = ColorPair(Black,White);
} else if (CRT_colorScheme == COLORSCHEME_BLACKONWHITE2) { } else if (CRT_colorScheme == COLORSCHEME_BLACKONWHITE2) {
CRT_colors[RESET_COLOR] = ColorPair(Black,Black); CRT_colors[RESET_COLOR] = ColorPair(Black,Black);
CRT_colors[DEFAULT_COLOR] = ColorPair(Black,Black); CRT_colors[DEFAULT_COLOR] = ColorPair(Black,Black);
...@@ -380,6 +383,7 @@ void CRT_setColors(int colorScheme) { ...@@ -380,6 +383,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black); CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black);
CRT_colors[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black); CRT_colors[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[CPU_SOFTIRQ] = ColorPair(Blue,Black); CRT_colors[CPU_SOFTIRQ] = ColorPair(Blue,Black);
CRT_colors[HOSTNAME] = ColorPair(White,Black);
} else if (CRT_colorScheme == COLORSCHEME_MIDNIGHT) { } else if (CRT_colorScheme == COLORSCHEME_MIDNIGHT) {
CRT_colors[RESET_COLOR] = ColorPair(White,Blue); CRT_colors[RESET_COLOR] = ColorPair(White,Blue);
CRT_colors[DEFAULT_COLOR] = ColorPair(White,Blue); CRT_colors[DEFAULT_COLOR] = ColorPair(White,Blue);
...@@ -438,6 +442,7 @@ void CRT_setColors(int colorScheme) { ...@@ -438,6 +442,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CPU_IOWAIT] = ColorPair(Yellow,Blue); CRT_colors[CPU_IOWAIT] = ColorPair(Yellow,Blue);
CRT_colors[CPU_IRQ] = A_BOLD | ColorPair(Black,Blue); CRT_colors[CPU_IRQ] = A_BOLD | ColorPair(Black,Blue);
CRT_colors[CPU_SOFTIRQ] = ColorPair(Black,Blue); CRT_colors[CPU_SOFTIRQ] = ColorPair(Black,Blue);
CRT_colors[HOSTNAME] = ColorPair(White,Blue);
} else if (CRT_colorScheme == COLORSCHEME_BLACKNIGHT) { } else if (CRT_colorScheme == COLORSCHEME_BLACKNIGHT) {
CRT_colors[RESET_COLOR] = ColorPair(Cyan,Black); CRT_colors[RESET_COLOR] = ColorPair(Cyan,Black);
CRT_colors[DEFAULT_COLOR] = ColorPair(Cyan,Black); CRT_colors[DEFAULT_COLOR] = ColorPair(Cyan,Black);
...@@ -496,6 +501,7 @@ void CRT_setColors(int colorScheme) { ...@@ -496,6 +501,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CPU_IOWAIT] = ColorPair(Yellow,Black); CRT_colors[CPU_IOWAIT] = ColorPair(Yellow,Black);
CRT_colors[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black); CRT_colors[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[CPU_SOFTIRQ] = ColorPair(Blue,Black); CRT_colors[CPU_SOFTIRQ] = ColorPair(Blue,Black);
CRT_colors[HOSTNAME] = ColorPair(Green,Black);
} else { } else {
/* Default */ /* Default */
CRT_colors[RESET_COLOR] = ColorPair(White,Black); CRT_colors[RESET_COLOR] = ColorPair(White,Black);
...@@ -555,5 +561,6 @@ void CRT_setColors(int colorScheme) { ...@@ -555,5 +561,6 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black); CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black);
CRT_colors[CPU_IRQ] = ColorPair(Yellow,Black); CRT_colors[CPU_IRQ] = ColorPair(Yellow,Black);
CRT_colors[CPU_SOFTIRQ] = ColorPair(Magenta,Black); CRT_colors[CPU_SOFTIRQ] = ColorPair(Magenta,Black);
CRT_colors[HOSTNAME] = A_BOLD;
} }
} }
...@@ -102,6 +102,7 @@ typedef enum ColorElements_ { ...@@ -102,6 +102,7 @@ typedef enum ColorElements_ {
CPU_IOWAIT, CPU_IOWAIT,
CPU_IRQ, CPU_IRQ,
CPU_SOFTIRQ, CPU_SOFTIRQ,
HOSTNAME,
LAST_COLORELEMENT LAST_COLORELEMENT
} ColorElements; } ColorElements;
......
What's new in version 0.8.2 What's new in version 0.8.2
* Option to display hostname in the meters area
* BUGFIX: Fix missing tree view when userland threads are hidden * BUGFIX: Fix missing tree view when userland threads are hidden
(thanks to Josh Stone) (thanks to Josh Stone)
* BUGFIX: Fix for VPID on OpenVZ systems * BUGFIX: Fix for VPID on OpenVZ systems
......
/*
htop
(C) 2004-2006 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "HostnameMeter.h"
#include "Meter.h"
#include <unistd.h>
#include "debug.h"
int HostnameMeter_attributes[] = {
HOSTNAME
};
static void HostnameMeter_setValues(Meter* this, char* buffer, int size) {
gethostname(buffer, size-1);
}
MeterType HostnameMeter = {
.setValues = HostnameMeter_setValues,
.display = NULL,
.mode = TEXT_METERMODE,
.total = 100.0,
.items = 1,
.attributes = HostnameMeter_attributes,
.name = "Hostname",
.uiName = "Hostname",
.caption = "Hostname: ",
};
/* Do not edit this file. It was automatically generated. */
#ifndef HEADER_HostnameMeter
#define HEADER_HostnameMeter
/*
htop
(C) 2004-2006 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Meter.h"
#include <unistd.h>
#include "debug.h"
extern int HostnameMeter_attributes[];
extern MeterType HostnameMeter;
#endif
...@@ -19,7 +19,8 @@ DisplayOptionsPanel.c FunctionBar.c Hashtable.c Header.c htop.c ListItem.c \ ...@@ -19,7 +19,8 @@ DisplayOptionsPanel.c FunctionBar.c Hashtable.c Header.c htop.c ListItem.c \
LoadAverageMeter.c MemoryMeter.c Meter.c MetersPanel.c Object.c Panel.c \ LoadAverageMeter.c MemoryMeter.c Meter.c MetersPanel.c Object.c Panel.c \
BatteryMeter.c Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \ BatteryMeter.c Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \
SignalItem.c SignalsPanel.c String.c SwapMeter.c TasksMeter.c TraceScreen.c \ SignalItem.c SignalsPanel.c String.c SwapMeter.c TasksMeter.c TraceScreen.c \
UptimeMeter.c UsersTable.c Vector.c AvailableColumnsPanel.c AffinityPanel.c UptimeMeter.c UsersTable.c Vector.c AvailableColumnsPanel.c AffinityPanel.c \
HostnameMeter.c
myhtopheaders = AvailableColumnsPanel.h AvailableMetersPanel.h \ myhtopheaders = AvailableColumnsPanel.h AvailableMetersPanel.h \
CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h \ CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h \
...@@ -28,7 +29,7 @@ Hashtable.h Header.h htop.h ListItem.h LoadAverageMeter.h MemoryMeter.h \ ...@@ -28,7 +29,7 @@ Hashtable.h Header.h htop.h ListItem.h LoadAverageMeter.h MemoryMeter.h \
BatteryMeter.h Meter.h MetersPanel.h Object.h Panel.h ProcessList.h RichString.h \ BatteryMeter.h Meter.h MetersPanel.h Object.h Panel.h ProcessList.h RichString.h \
ScreenManager.h Settings.h SignalItem.h SignalsPanel.h String.h \ ScreenManager.h Settings.h SignalItem.h SignalsPanel.h String.h \
SwapMeter.h TasksMeter.h TraceScreen.h UptimeMeter.h UsersTable.h Vector.h \ SwapMeter.h TasksMeter.h TraceScreen.h UptimeMeter.h UsersTable.h Vector.h \
Process.h AffinityPanel.h Process.h AffinityPanel.h HostnameMeter.h
SUFFIXES = .h SUFFIXES = .h
......
...@@ -98,6 +98,7 @@ typedef enum { ...@@ -98,6 +98,7 @@ typedef enum {
#include "UptimeMeter.h" #include "UptimeMeter.h"
#include "BatteryMeter.h" #include "BatteryMeter.h"
#include "ClockMeter.h" #include "ClockMeter.h"
#include "HostnameMeter.h"
#ifndef MIN #ifndef MIN
...@@ -124,6 +125,7 @@ MeterType* Meter_types[] = { ...@@ -124,6 +125,7 @@ MeterType* Meter_types[] = {
&UptimeMeter, &UptimeMeter,
&BatteryMeter, &BatteryMeter,
&AllCPUsMeter, &AllCPUsMeter,
&HostnameMeter,
NULL NULL
}; };
......
...@@ -99,6 +99,7 @@ typedef enum { ...@@ -99,6 +99,7 @@ typedef enum {
#include "UptimeMeter.h" #include "UptimeMeter.h"
#include "BatteryMeter.h" #include "BatteryMeter.h"
#include "ClockMeter.h" #include "ClockMeter.h"
#include "HostnameMeter.h"
#ifndef MIN #ifndef MIN
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment