@@ -69,13 +69,8 @@ - (void)open:(id)sender {
69
69
}
70
70
}
71
71
72
- - (NSAttributedString *)wrappedText : (NSString *)text width : (float )max_width {
73
- NSMutableParagraphStyle * pathStyle = [[NSMutableParagraphStyle alloc ] init ];
74
- pathStyle.minimumLineHeight = 13.0 ;
75
-
76
- NSDictionary *pathAttribs= @{ NSFontAttributeName :[NSFont menuFontOfSize: 11.0 ], NSParagraphStyleAttributeName :pathStyle };
77
-
78
- NSAttributedString *pathText = [[NSAttributedString alloc ] initWithString: text attributes: pathAttribs];
72
+ - (NSAttributedString *)wrappedText : (NSString *)text width : (float )max_width attributes :attribs {
73
+ NSAttributedString *pathText = [[NSAttributedString alloc ] initWithString: text attributes: attribs];
79
74
80
75
CTFramesetterRef fs = CTFramesetterCreateWithAttributedString ((__bridge CFAttributedStringRef)pathText);
81
76
CGMutablePathRef path2 = CGPathCreateMutable ();
@@ -96,7 +91,7 @@ - (NSAttributedString *)wrappedText:(NSString *)text width:(float)max_width {
96
91
97
92
NSString *joiner = @" \n " ;
98
93
if ([[AppDelegate sharedDelegate ] isRightToLeft ]) joiner = @" \n\u200F " ;
99
- return [[NSAttributedString alloc ] initWithString: [final componentsJoinedByString: joiner] attributes: pathAttribs ];
94
+ return [[NSAttributedString alloc ] initWithString: [final componentsJoinedByString: joiner] attributes: attribs ];
100
95
}
101
96
102
97
- (void )toggleAnimate : (id )obj {
@@ -374,6 +369,11 @@ - (void)updateMenu:(NSMenu *)menu {
374
369
float max_width = [menu size ].width ;
375
370
if (max_width < 210 ) max_width = 210 ;
376
371
372
+ NSMutableParagraphStyle * pathStyle = [[NSMutableParagraphStyle alloc ] init ];
373
+ pathStyle.minimumLineHeight = 13.0 ;
374
+ NSDictionary *attribs= @{ NSFontAttributeName :[NSFont menuFontOfSize: 11.0 ], NSParagraphStyleAttributeName :pathStyle };
375
+ NSDictionary *disabledAttribs= @{ NSFontAttributeName :[NSFont menuFontOfSize: 11.0 ], NSParagraphStyleAttributeName :pathStyle, NSForegroundColorAttributeName :[NSColor tertiaryLabelColor ] };
376
+
377
377
for (long index = 0 ; index < [advancedProcesses count ]; index++) {
378
378
ProcessRecord *process = [advancedProcesses objectAtIndex: index];
379
379
NSMenuItem *item = [advancedItems objectAtIndex: index];
@@ -404,7 +404,10 @@ - (void)updateMenu:(NSMenu *)menu {
404
404
joiner = @" \u00A0 ◁\u202B " ;
405
405
format = @" \u202B %d \u00A0 %@ " ;
406
406
}
407
- [item setAttributedTitle: [self wrappedText: [NSString stringWithFormat: format, process.pid, [folders componentsJoinedByString: joiner]] width: max_width]];
407
+ NSDictionary *useAttribs = attribs;
408
+ if (!process.running ) useAttribs = disabledAttribs;
409
+
410
+ [item setAttributedTitle: [self wrappedText: [NSString stringWithFormat: format, process.pid, [folders componentsJoinedByString: joiner]] width: max_width attributes: useAttribs]];
408
411
[item setIndentationLevel: 1 ];
409
412
[item setRepresentedObject: process];
410
413
[item setTarget: self ];
0 commit comments