Skip to content

Commit 93c5bc4

Browse files
committed
better way to handle #258
1 parent 35a2b5d commit 93c5bc4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

MenuMetersMenuExtraBase.m

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
@implementation MenuMetersMenuExtraBase
2020
-(NSColor*)colorByAdjustingForLightDark:(NSColor*)c
2121
{
22-
if(@available(macOS 10.13,*)){
23-
if(c.type==NSColorTypeCatalog){
24-
return c;
25-
}
26-
}
22+
[self setupAppearance];
2723
return [c blendedColorWithFraction:[[NSUserDefaults standardUserDefaults] floatForKey:@"tintPercentage"]/100 ofColor:self.isDark?[[NSColor whiteColor] colorWithAlphaComponent:[c alphaComponent]]:[[NSColor blackColor] colorWithAlphaComponent:[c alphaComponent]]];
2824
}
2925
-(instancetype)initWithBundleID:(NSString*)bundleID
@@ -125,6 +121,11 @@ - (void)configDisplay:(NSString*)bundleID fromPrefs:(MenuMeterDefaults*)ourPrefs
125121
}
126122
statusItem.menu = self.menu;
127123
statusItem.menu.delegate = self;
124+
/*
125+
Observing effectiveAppearance has a serious drawback when the Mac has two moniters, one with a light menubar and another with a dard menubar, which can happen since Big Sur depending on the chosen desktop pictures.
126+
In such cases statusItem.button.effectiveAppearance changes each time the system redraws the statusItem.button on two menubars, making configFromPrefs: called every time.
127+
Honestly, the way a single NSStatusItem behaves differently on two menubars with different appearances is undocumented, especially with a dynamically-drawn block-based image attached on a button...
128+
*/
128129
[statusItem.button addObserver:self forKeyPath:@"effectiveAppearance" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];
129130
}
130131
[updateTimer invalidate];

0 commit comments

Comments
 (0)