X Tutup
Skip to content

Commit 283fa2b

Browse files
authored
fix: macOS tray icon alternate images (electron#33026)
1 parent 1e50f7d commit 283fa2b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

shell/browser/ui/tray_icon_cocoa.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ - (void)setImage:(NSImage*)image {
9393

9494
- (void)setAlternateImage:(NSImage*)image {
9595
[[statusItem_ button] setAlternateImage:image];
96+
97+
// We need to change the button type here because the default button type for
98+
// NSStatusItem, NSStatusBarButton, does not display alternate content when
99+
// clicked. NSButtonTypeMomentaryChange displays its alternate content when
100+
// clicked and returns to its normal content when the user releases it, which
101+
// is the behavior users would expect when clicking a button with an alternate
102+
// image set.
103+
[[statusItem_ button] setButtonType:NSButtonTypeMomentaryChange];
104+
[self updateDimensions];
96105
}
97106

98107
- (void)setIgnoreDoubleClickEvents:(BOOL)ignore {

0 commit comments

Comments
 (0)
X Tutup