Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI #262

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

UI #262

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
BasedOnStyle: LLVM
UseTab: Always
TabWidth: 4
IndentWidth: 4
AlignEscapedNewlinesLeft: true
AllowShortIfStatementsOnASingleLine: false
ColumnLimit: 0
IndentCaseLabels: true
ObjCBlockIndentWidth: 4

# Like Stroustrup but do not wrap braces after function definitions.
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false

DerivePointerAlignment: false
PointerAlignment: Right

AllowShortFunctionsOnASingleLine: Empty
AllowShortBlocksOnASingleLine: true
ObjCSpaceAfterProperty: true
SpacesInContainerLiterals: false
165 changes: 80 additions & 85 deletions Common/MenuMeterCPU.h
Original file line number Diff line number Diff line change
@@ -1,154 +1,149 @@
//
// MenuMeterCPU.h
//
// Constants and other definitions for the CPU Meter
// Constants and other definitions for the CPU Meter
//
// Copyright (c) 2002-2014 Alex Harper
// Copyright (c) 2002-2014 Alex Harper
//
// This file is part of MenuMeters.
// This file is part of MenuMeters.
//
// MenuMeters is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// MenuMeters is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// MenuMeters is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// MenuMeters is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MenuMeters; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// You should have received a copy of the GNU General Public License
// along with MenuMeters; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//

///////////////////////////////////////////////////////////////
//
// Constants
// Constants
//
///////////////////////////////////////////////////////////////

// Widths of the various displays
#define kCPUPercentDisplayBorderWidth 2
#define kCPUThermometerDisplayWidth 11.0f
#define kCPUDisplayMultiProcGapWidth 5
#define kCPULabelOnlyWidth 25
#define kCPUPercentDisplayBorderWidth 2
#define kCPUThermometerDisplayWidth 9
#define kCPUDisplayMultiProcGapWidth 1
#define kCPULabelOnlyWidth 25

// Menu item indexes
#define kCPUUptimeInfoMenuIndex 4
#define kCPUTaskInfoMenuIndex 6
#define kCPULoadInfoMenuIndex 8
#define kCPUPowerLimitInfoMenuIndex 10
#define kCPUProcessLabelMenuIndex 11
#define kCPUProcessMenuIndex (kCPUProcessLabelMenuIndex + 1)
#define kCPUUptimeInfoMenuIndex 4
#define kCPUTaskInfoMenuIndex 6
#define kCPULoadInfoMenuIndex 8
#define kCPUPowerLimitInfoMenuIndex 10
#define kCPUProcessLabelMenuIndex 11
#define kCPUProcessMenuIndex (kCPUProcessLabelMenuIndex + 1)

///////////////////////////////////////////////////////////////
//
// Preference information
// Preference information
//
///////////////////////////////////////////////////////////////

// Pref dictionary keys
#define kCPUIntervalPref @"CPUInterval"
#define kCPUDisplayModePref @"CPUDisplayMode"
#define kCPUPercentDisplayPref @"CPUPercentDisplayMode"
#define kCPUMaxProcessCountPref @"CPUMaxProcessCount"
#define kCPUGraphLengthPref @"CPUGraphLength"
#define kCPUHorizontalRowsPref @"CPUHorizontalRows"
#define kCPUMenuWidthPref @"CPUMenuWidth"
#define kCPUAvgAllProcsPref @"CPUAverageMultiProcs"
#define kCPUSumAllProcsPercentPref @"CPUSumAllProcsPercent"
extern NSString *kCPUIntervalPref;
extern NSString *kCPUDisplayModePref;
extern NSString *kCPUPercentDisplayPref;
extern NSString *kCPUMaxProcessCountPref;
extern NSString *kCPUGraphLengthPref;
extern NSString *kCPUHorizontalRowsPref;
extern NSString *kCPUMenuWidthPref;
extern NSString *kCPUAvgAllProcsPref;
extern NSString *kCPUSumAllProcsPercentPref;
// Note that "Lower Half" is now reused to show only physical cores
#define kCPUAvgLowerHalfProcsPref @"CPUAverageLowerHalfProcs"
#define kCPUSortByUsagePref @"CPUSortByUsage"
#define kCPUSystemColorPref @"CPUSystemColor"
#define kCPUUserColorPref @"CPUUserColor"
#define kCPUPowerMatePref @"CPUPowerMate"
#define kCPUPowerMateMode @"CPUPowerMateMode"
#define kCPUShowTemperature @"CPUTemperature"
#define kCPUTemperatureColor @"CPUTemperatureColor"
#define kCPUTemperatureSensor @"CPUTemperatureSensor"
#define kCPUTemperatureSensorDefault @"CPUTemperatureSensorDefault"
#define kCPUTemperatureUnit @"CPUTemperatureUnit"
extern NSString *kCPUAvgLowerHalfProcsPref;
extern NSString *kCPUSortByUsagePref;
extern NSString *kCPUSystemColorPref;
extern NSString *kCPUUserColorPref;
extern NSString *kCPUPowerMatePref;
extern NSString *kCPUPowerMateMode;
extern NSString *kCPUShowTemperature;
extern NSString *kCPUTemperatureColor;
extern NSString *kCPUTemperatureSensor;
extern NSString *kCPUTemperatureSensorDefault;
extern NSString *kCPUTemperatureUnit;
#define kCPUTemperatureUnitCelsius 0
#define kCPUTemperatureUnitFahrenheit 1
// Display modes
enum {
kCPUDisplayPercent = 1,
kCPUDisplayGraph = 2,
kCPUDisplayThermometer = 4,
kCPUDisplayHorizontalThermometer = 8
kCPUDisplayPercent = 1,
kCPUDisplayGraph = 2,
kCPUDisplayThermometer = 4,
kCPUDisplayHorizontalThermometer = 8
};
#define kCPUDisplayDefault kCPUDisplayPercent
#define kCPUDisplayDefault kCPUDisplayPercent

// Percent display modes
enum {
kCPUPercentDisplayLarge = 0,
kCPUPercentDisplayLarge = 0,
kCPUPercentDisplaySmall,
kCPUPercentDisplaySplit
};
#define kCPUPercentDisplayDefault kCPUPercentDisplaySmall
#define kCPUPercentDisplayDefault kCPUPercentDisplaySmall

// Process info
#define kCPUProcessCountMin 0
#define kCPUrocessCountMax 25
#define kCPUProcessCountDefault 5
#define kCPUProcessCountMin 0
#define kCPUrocessCountMax 25
#define kCPUProcessCountDefault 5

// PowerMate modes
enum {
kCPUPowerMateGlow = 0,
kCPUPowerMateGlow = 0,
kCPUPowerMatePulse,
kCPUPowerMateInverseGlow,
kCPUPowerMateInversePulse
};
#define kCPUPowerMateModeDefault kCPUPowerMateGlow
#define kCPUPowerMateModeDefault kCPUPowerMateGlow

// Timer
#define kCPUUpdateIntervalMin 0.5f
#define kCPUUpdateIntervalMax 10.0f
#define kCPUUpdateIntervalDefault 1.0f
#define kCPUUpdateIntervalMin 0.5
#define kCPUUpdateIntervalMax 10.0
#define kCPUUpdateIntervalDefault 1.0

// Graph display
#define kCPUGraphWidthMin 11
#define kCPUGraphWidthMax 88
#define kCPUGraphWidthDefault 33
#define kCPUGraphWidthMin 11
#define kCPUGraphWidthMax 88
#define kCPUGraphWidthDefault 33

// Thermometer display
#define kCPUHorizontalRowsMin 1
#define kCPUHorizontalRowsMax 8
#define kCPUHorizontalRowsDefault 2
#define kCPUHorizontalRowsMin 1
#define kCPUHorizontalRowsMax 8
#define kCPUHorizontalRowsDefault 2

// Menu width
#define kCPUMenuWidthMin 60
#define kCPUMenuWidthMax 400
#define kCPUMenuWidthDefault 120
#define kCPUMenuWidthMin 60
#define kCPUMenuWidthMax 400
#define kCPUMenuWidthDefault 120

// Multiproc averaging
#define kCPUAvgAllProcsDefault NO
#define kCPUAvgAllProcsDefault NO

// Multiproc sum percentage
#define kCPUSumAllProcsPercentDefault NO
#define kCPUSumAllProcsPercentDefault NO

// Least-utilized half of procs averaging
#define kCPUAvgLowerHalfProcsDefault NO
#define kCPUAvgLowerHalfProcsDefault NO

// Sorting by usage
#define kCPUSortByUsageDefault NO
#define kCPUSortByUsageDefault NO

// PowerMate
#define kCPUPowerMateDefault NO
#define kCPUPowerMateDefault NO

// Show CPU temperature
#define kCPUShowTemperatureDefault YES
#define kCPUShowTemperatureDefault YES

// Colors
// Maraschino
#define kCPUSystemColorDefault [NSColor colorWithDeviceRed:1.0f green:0.0f blue:0.0f alpha:1.0f]
// Midnight blue
#define kCPUUserColorDefault [NSColor colorWithDeviceRed:0.0f green:0.0f blue:0.5f alpha:1.0f]
// Orange
#define kCPUTemperatureColorDefault [NSColor colorWithDeviceRed:1.0f green:0.647f blue:0.0f alpha:1.0f]





// Maraschino
#define kCPUSystemColorDefault [NSColor systemRedColor]
// Midnight blue
#define kCPUUserColorDefault [NSColor systemBlueColor]
// Orange
#define kCPUTemperatureColorDefault [NSColor systemOrangeColor]
29 changes: 29 additions & 0 deletions Common/MenuMeterCPU.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// MenuMeterCPU.m
// MenuMeters
//
// Created by Georg Seifert on 31.10.21.
//

// Pref dictionary keys
NSString *kCPUIntervalPref = @"CPUInterval";
NSString *kCPUDisplayModePref = @"CPUDisplayMode";
NSString *kCPUPercentDisplayPref = @"CPUPercentDisplayMode";
NSString *kCPUMaxProcessCountPref = @"CPUMaxProcessCount";
NSString *kCPUGraphLengthPref = @"CPUGraphLength";
NSString *kCPUHorizontalRowsPref = @"CPUHorizontalRows";
NSString *kCPUMenuWidthPref = @"CPUMenuWidth";
NSString *kCPUAvgAllProcsPref = @"CPUAverageMultiProcs";
NSString *kCPUSumAllProcsPercentPref = @"CPUSumAllProcsPercent";
// Note that "Lower Half" is now reused to show only physical cores
NSString *kCPUAvgLowerHalfProcsPref = @"CPUAverageLowerHalfProcs";
NSString *kCPUSortByUsagePref = @"CPUSortByUsage";
NSString *kCPUSystemColorPref = @"CPUSystemColor";
NSString *kCPUUserColorPref = @"CPUUserColor";
NSString *kCPUPowerMatePref = @"CPUPowerMate";
NSString *kCPUPowerMateMode = @"CPUPowerMateMode";
NSString *kCPUShowTemperature = @"CPUTemperature";
NSString *kCPUTemperatureColor = @"CPUTemperatureColor";
NSString *kCPUTemperatureSensor = @"CPUTemperatureSensor";
NSString *kCPUTemperatureSensorDefault = @"CPUTemperatureSensorDefault";
NSString *kCPUTemperatureUnit = @"CPUTemperatureUnit";
Loading