How to properly override some values in for the volume using gnome extension?

I’m trying to develop my own gnome extesnion to hide the microphone icon using some custom logic, this is the icon that i’m talking about:

image

By taking a quick look at the gnome-shell volume.js file, I’ve noticed that this is where the icon is set.

I wanted to develop an extension that somehow can override that logic.

My problem: since I’ve a virtual mic, the mic indicator is always showing.
My goal: override the maybeshowinput somehow such that it also ignores source-outputs with node.virtual properties.

How can i acheive this? I’m having a hard time trying to grasp all the components, this is my first time trying to develop a gnome extension. Any help would be appreciated.

The indicator is bound with the input visible property just like this (volume.js):

this._input.bind_property('visible',
            this._indicator, 'visible',
            GObject.BindingFlags.SYNC_CREATE);

And the input visible property logic is mostly at the _maybeShowInput function (also volume.js).

    _maybeShowInput() {
        // only show input widgets if any application is recording audio
        let showInput = false;
        if (this._stream) {
            // skip gnome-volume-control and pavucontrol which appear
            // as recording because they show the input level
            let skippedApps = [
                'org.gnome.VolumeControl',
                'org.PulseAudio.pavucontrol',
            ];

            showInput = this._control.get_source_outputs().some(
                output => !skippedApps.includes(output.get_application_id()));
        }

        this._showInput = showInput;
        this._sync();
    }

Refer https://gjs.guide/extensions.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.