Skip to content

Commit

Permalink
Merge pull request #11914 from sphh/sound-always-show-input
Browse files Browse the repository at this point in the history
Adds option to always show the input switch in the sound applet. (Closes #11232)
  • Loading branch information
claudiux authored Nov 2, 2023
2 parents 3a376e8 + e5fc002 commit 826b755
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
23 changes: 15 additions & 8 deletions files/usr/share/cinnamon/applets/[email protected]/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ class CinnamonSoundApplet extends Applet.TextIconApplet {
if (this.hideSystray) this.registerSystrayIcons();

this.settings.bind("keyOpen", "keyOpen", this._setKeybinding);
this.settings.bind("alwaysShowMuteInput", "alwaysShowMuteInput", this.on_settings_changed);

this.settings.bind("tooltipShowVolume", "tooltipShowVolume", this.on_settings_changed);
this.settings.bind("tooltipShowPlayer", "tooltipShowPlayer", this.on_settings_changed);
Expand Down Expand Up @@ -1042,7 +1043,10 @@ class CinnamonSoundApplet extends Applet.TextIconApplet {
this.mute_in_switch = new PopupMenu.PopupSwitchIconMenuItem(_("Mute input"), false, "microphone-sensitivity-muted", St.IconType.SYMBOLIC);
this._applet_context_menu.addMenuItem(this.mute_out_switch);
this._applet_context_menu.addMenuItem(this.mute_in_switch);
this.mute_in_switch.actor.hide();
if (this.alwaysShowMuteInput)
this.mute_in_switch.actor.show();
else
this.mute_in_switch.actor.hide();

this._applet_context_menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());

Expand Down Expand Up @@ -1108,6 +1112,11 @@ class CinnamonSoundApplet extends Applet.TextIconApplet {
else
this.setAppletTextIcon();

if (this.alwaysShowMuteInput)
this.mute_in_switch.actor.show();
else if (this._recordingAppsNum === 0)
this.mute_in_switch.actor.hide();

this._changeActivePlayer(this._activePlayer);
}

Expand Down Expand Up @@ -1151,13 +1160,9 @@ class CinnamonSoundApplet extends Applet.TextIconApplet {
if (!this._input)
return;

if (this._input.is_muted) {
this._input.change_is_muted(false);
this.mute_in_switch.setToggleState(false);
} else {
this._input.change_is_muted(true);
this.mute_in_switch.setToggleState(true);
}
let newStatus = !this._input.is_muted;
this._input.change_is_muted(newStatus);
this.mute_in_switch.setToggleState(newStatus);
}

_onScrollEvent(actor, event) {
Expand Down Expand Up @@ -1691,6 +1696,8 @@ class CinnamonSoundApplet extends Applet.TextIconApplet {
this._inputSection.actor.hide();
this.mute_in_switch.actor.hide();
}
if (this.alwaysShowMuteInput)
this.mute_in_switch.actor.show();
}
this._streams.splice(i, 1);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
"default": "<Shift><Super>s",
"tooltip" : "Set keybinding(s) to show the sound applet menu."
},
"alwaysShowMuteInput": {
"type": "switch",
"description": "Always show input switch",
"tooltip": "Always show the 'Mute input' switch in the context menu.",
"default": false
},
"_knownPlayers": {
"type": "generic",
"default": ["banshee", "vlc", "rhythmbox"]
Expand Down

0 comments on commit 826b755

Please sign in to comment.