Skip to content

Commit 357613a

Browse files
committed
Control all inputs
Adds a setting to control all inputs. This mutes and unmutes all sources, instead of just the default. Fixes wbolster#32
1 parent 1056a1d commit 357613a

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

extension.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,15 @@ class Microphone {
9191
}
9292

9393
set muted(muted) {
94-
if (!this.stream) return;
95-
this.stream.change_is_muted(muted);
94+
const controllAllInputs = settings.get_boolean("control-all-inputs");
95+
if (controllAllInputs) {
96+
const sources = this.mixer_control.get_sources();
97+
for(let source of sources) {
98+
source.change_is_muted(muted);
99+
}
100+
} else if (this.stream) {
101+
this.stream.change_is_muted(muted);
102+
}
96103
}
97104

98105
get level() {

prefs.js

+20
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,26 @@ function buildPrefsWidget() {
127127
prefsWidget.attach(playingSoundNotSupportedLabel, 0, 5, 1, 1);
128128
}
129129

130+
const controlAllInputsLabel = new Gtk.Label({
131+
label: "Mute and unmute all microphones",
132+
halign: Gtk.Align.START,
133+
visible: true,
134+
});
135+
prefsWidget.attach(controlAllInputsLabel, 0, 6, 1, 1);
136+
137+
const controlAllInputsSwitch = new Gtk.Switch({
138+
active: this.settings.get_boolean("control-all-inputs"),
139+
halign: Gtk.Align.END,
140+
visible: true,
141+
});
142+
this.settings.bind(
143+
"control-all-inputs",
144+
controlAllInputsSwitch,
145+
"active",
146+
Gio.SettingsBindFlags.DEFAULT
147+
);
148+
prefsWidget.attach(controlAllInputsSwitch, 1, 6, 1, 1);
149+
130150
if (GTK_VERSION == 3) {
131151
prefsWidget.show_all();
132152
}

schemas/gschemas.compiled

60 Bytes
Binary file not shown.

schemas/org.gnome.shell.extensions.nothing-to-say.gschema.xml

+5
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,10 @@
2626
<summary>Play sound when muting and unmuting</summary>
2727
<description>Play sounds when the microphone is muted and unmuted.</description>
2828
</key>
29+
<key name="control-all-inputs" type="b">
30+
<default>false</default>
31+
<summary>Mute and unmute all microphones</summary>
32+
<description>All inputs are muted and unmuted if true. Otherwise only the default input is</description>
33+
</key>
2934
</schema>
3035
</schemalist>

0 commit comments

Comments
 (0)