Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Fixes #8540 - Added "Mute All", Fixed "Mute Other Tabs", made "(Un)Mu… #8623

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 7 additions & 7 deletions app/renderer/components/tabs/content/audioTabIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const globalStyles = require('../../styles/global')
const tabStyles = require('../../styles/tab')

class AudioTabIcon extends ImmutableComponent {
get pageCanPlayAudio () {
get pageAudioActive () {
return !!this.props.tab.get('audioPlaybackActive')
}

Expand All @@ -24,7 +24,7 @@ class AudioTabIcon extends ImmutableComponent {
}

get mutedState () {
return this.pageCanPlayAudio && !!this.props.tab.get('audioMuted')
return !!this.props.tab.get('audioMuted')
}

get audioIcon () {
Expand All @@ -34,11 +34,11 @@ class AudioTabIcon extends ImmutableComponent {
}

render () {
return this.pageCanPlayAudio && this.shouldShowAudioIcon
? <TabIcon
className={css(tabStyles.icon, styles.audioIcon)}
symbol={this.audioIcon} onClick={this.props.onClick} />
: null
return this.mutedState || (!this.mutedState && this.pageAudioActive)
? <TabIcon
className={css(tabStyles.icon, styles.audioIcon)}
symbol={this.audioIcon} onClick={this.props.onClick} />
: null
}
}

Expand Down
29 changes: 17 additions & 12 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ function tabPageTemplateInit (framePropsList) {
}

function generateMuteFrameList (framePropsList, muted) {
return framePropsList.map((frameProp) => {
return {
frameKey: frameProp.get('key'),
tabId: frameProp.get('tabId'),
muted: muted && frameProp.get('audioPlaybackActive') && !frameProp.get('audioMuted')
}
})
}
return framePropsList.map((frameProp) => {
return {
frameKey: frameProp.get('key'),
tabId: frameProp.get('tabId'),
muted: muted
}
})
}

function urlBarTemplateInit (searchDetail, activeFrame, e) {
const items = getEditableItems(window.getSelection().toString())
Expand Down Expand Up @@ -598,16 +598,15 @@ function tabTemplateInit (frameProps) {
}
})

if (frameProps.get('audioPlaybackActive')) {
const isMuted = frameProps.get('audioMuted')
const isMuted = frameProps.get('audioMuted')

template.push({
template.push({
label: locale.translation(isMuted ? 'unmuteTab' : 'muteTab'),
click: (item) => {
windowActions.setAudioMuted(frameKey, tabId, !isMuted)
}
})
}


template.push(CommonMenu.separatorMenuItem)

Expand Down Expand Up @@ -665,6 +664,12 @@ function tabsBarTemplateInit (framePropsList) {
CommonMenu.newWindowMenuItem(),
CommonMenu.separatorMenuItem,
CommonMenu.showTabPreviewsMenuItem(),
{
label: locale.translation('muteTabs'),
click: () => {
windowActions.muteAllAudio(generateMuteFrameList(framePropsList, true))
}
},
CommonMenu.separatorMenuItem,
CommonMenu.bookmarksManagerMenuItem(),
CommonMenu.bookmarksToolbarMenuItem(),
Expand Down