diff --git a/Ladybird/AppKit/UI/Tab.mm b/Ladybird/AppKit/UI/Tab.mm index 91a8265a694..33e71d8837c 100644 --- a/Ladybird/AppKit/UI/Tab.mm +++ b/Ladybird/AppKit/UI/Tab.mm @@ -192,6 +192,7 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800; case Web::HTML::AudioPlayState::Playing: [button setImage:[self iconForPageMuteState]]; + [button setToolTip:[self toolTipForPageMuteState]]; break; } } @@ -210,6 +211,20 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800; VERIFY_NOT_REACHED(); } +- (NSString*)toolTipForPageMuteState +{ + auto& view = [[self web_view] view]; + + switch (view.page_mute_state()) { + case Web::HTML::MuteState::Muted: + return @"Unmute tab"; + case Web::HTML::MuteState::Unmuted: + return @"Mute tab"; + } + + VERIFY_NOT_REACHED(); +} + - (void)onContentScroll:(NSNotification*)notification { [[self web_view] handleScroll]; @@ -321,6 +336,8 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800; auto* button = [NSButton buttonWithImage:[self iconForPageMuteState] target:self action:@selector(togglePageMuteState:)]; + [button setToolTip:[self toolTipForPageMuteState]]; + [[self tab] setAccessoryView:button]; break; }