Code Monkey home page Code Monkey logo

audio-switcher's Introduction

Gnome-Shell Extension Audio-Output-Switcher

Output switcher menu

The output menu

Input switcher menu

The input menu

Compatibility

  • Gnome Shell 3.26
  • Gnome Shell 3.28
  • Gnome Shell 3.30
  • Gnome Shell 3.32
  • Gnome Shell 3.34
  • Gnome Shell 40

For Gnome Shell < 3.26, use version 1.0.

Installation

Via git

git clone [email protected]:AndresCidoncha/audio-switcher.git ~/.local/share/gnome-shell/extensions/audio-switcher@AndresCidoncha

Then restart the gnome-shell via ALT+F2, typing in the box r and enable the extension using gnome-tweak-tool

To update later:

(cd ~/.local/share/gnome-shell/extensions/audio-switcher@AndresCidoncha && git pull)

Credits

This extension adds two little entries to the status-menu that shows the currently selected pulse-audio-output and pulse-audio-input devices. Clicking on that will open a submenu with all available devices and let's you choose which one to use.

All the credits is for anduchs, this extension is based on his work at Audio Output Switcher and Audio Input Switcher. I only join them and add support for the lastest versions of Gnome-shell.

Thanks to:

audio-switcher's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

audio-switcher's Issues

Gnome 40 support

Gnome 40 is out in in Fedora 34, so users are starting to use it.

Thanks for the nice little extension, I use it daily.

Hot key

Hi there,

First, thank you for putting together this wonderful extension. I use it everyday and have no problems whatsoever. I was wondering if would be possible (and, hopefully, not to much of a hassle) for you to add a configuration option for a hot key. The user will be able to choose the hot key (or combination of keys) to switch between a audio outputs and inputs. Also, the user will be able to choose which of the currently available input/output audio sources he/she would like to cycle through using said hot key.

This is one feature I miss from my Windows days (I used this in Windows: https://github.com/xenolightning/AudioSwitcher_v1)

Anyway, I would love to here your thoughts on the matter.
Thanks!

Fedora 27?

Can you publish a new version for Fedora 27?

undeclared variables

I see these in journalctl:
giu 26 13:40:47 archos org.gnome.Shell.desktop[1045]: Gjs-Message: JS WARNING: [/home/luca/.local/share/gnome-shell/extensions/audio-switcher@AndresCidoncha/extension.js 95]: assignment to undeclared variable defsource
giu 26 13:40:47 archos org.gnome.Shell.desktop[1045]: Gjs-Message: JS WARNING: [/home/luca/.local/share/gnome-shell/extensions/audio-switcher@AndresCidoncha/extension.js 90]: assignment to undeclared variable item
giu 26 13:40:47 archos org.gnome.Shell.desktop[1045]: Gjs-Message: JS WARNING: [/home/luca/.local/share/gnome-shell/extensions/audio-switcher@AndresCidoncha/extension.js 31]: assignment to undeclared variable defsink
giu 26 13:40:47 archos org.gnome.Shell.desktop[1045]: Gjs-Message: JS WARNING: [/home/luca/.local/share/gnome-shell/extensions/[email protected]/extension.js 44]: assignment to undeclared variable trayIconImplementations

invalid base class (is PopupSubMenuMenuItem)

Running on RHEL 8.3 with gnome-shell 3.32.2
The error in the logfile is:
Some code accessed the property 'ENABLED_EXTENSIONS_KEY' on the module 'extensionSystem'. That property was defined with 'let' or 'const' inside the module. This was previously supported, but is not correct according to the ES6 standard. Any symbols to be exported from a module must be defined with 'var'. The property access will work as previously for the time being, but please fix your code anyway.
Extension "audio-switcher@AndresCidoncha" had error: TypeError: GObject.registerClass() used with invalid base class (is PopupSubMenuMenuItem)

Auto-hide input devices (microphones etc.)

Without the extension, the default behaviour on Ubuntu 20.04 (GNOME 3.36.1) is to only show the input audio volume slider when an input device is accessed by an application (e.g. recording audio). After installing this extension, the input audio volume slider is always shown (together with input device selection dropdown menu). It would be nice if the extension would also auto-hide the input audio slider/menu by default (and ideally offer a config option to always show if preferred).

Initially the wrong audio device is selected

Hi!
Great extension, I use it on a daily basis and find it a valuable addition to the Gnome desktop. Thank you for your work!

There is one little issue: After logging in, my USB headset is selected by the extension. However, sound is coming from my loudspeakers. Changing volume does not change the loudspeaker volume then.
Only after selecting my loudspeakers in the audio switcher menu, I can control their volume again.

Keep up the great work!

HDMI output missing from dropdown

My HDMI output is missing from the extension's dropdown, but is visible in system settings. Possibly related to #17.

System settings:
Screenshot from 2020-11-29 16-28-51

Extension:
Screenshot from 2020-11-29 16-30-02

Support switching profiles

I'm basically just pulling in anduchs/audio-output-switcher#5 since this seems to be the most active fork. Currently this extension doesn't show any audio devices for me, other than the default. gnome-control-center seems to parse audio devices differently, including what in pavucontrol are listed under Configuration / Profiles.

There was already an attempt to support this in the original ports2 branch that people claimed was working 5 years ago, if anyone feels adventurous!

https://github.com/anduchs/audio-output-switcher/compare/ports2

Gnome 3.34 support needed

Gnome 3.34 is out since september, and we need support for it.
Could you please add gnome 3.34 support ?
I would love to learn what's needed to do so, but it seems that adding the version number to the json file is not enough.

Nvidia dual screen missing device

Hello,

This is a tricky one that has been bothering me for a few months. I finally decided to look into it.

Running Ubuntu 18.04, I have an Nvidia GPU using proprietary driver with 2 identical HDMI monitors including audio output.
From the System Settings, in sound, I see 2 devices. In audio-switcher, the two HDMI audio out are shown as only one device. The only way to properly select which monitor I want the audio to come from is to use System Settings.

I do not know the first thing about Audio and how it's managed, but I saw something called a "sink" mentioned in the code. I looked in PulseAudio, and there's only one sink for HDMI output:

  • index: 0
    name: <alsa_output.pci-0000_01_00.1.hdmi-stereo>
    driver: <module-alsa-card.c>
    flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: SUSPENDED
    suspend cause: IDLE
    priority: 9030
    volume: front-left: 49808 / 76% / -7,15 dB, front-right: 49808 / 76% / -7,15 dB
    balance 0,00
    base volume: 65536 / 100% / 0,00 dB
    volume steps: 65537
    muted: no
    current latency: 0,00 ms
    max request: 0 KiB
    max rewind: 0 KiB
    monitor source: 0
    sample spec: s16le 2ch 48000Hz
    channel map: front-left,front-right
    Stereo
    used by: 0
    linked by: 1
    configured latency: 0,00 ms; range is 0,50 .. 341,33 ms
    card: 0 <alsa_card.pci-0000_01_00.1>
    module: 7
    properties:
    alsa.resolution_bits = "16"
    device.api = "alsa"
    device.class = "sound"
    alsa.class = "generic"
    alsa.subclass = "generic-mix"
    alsa.name = "HDMI 0"
    alsa.id = "HDMI 0"
    alsa.subdevice = "0"
    alsa.subdevice_name = "subdevice #0"
    alsa.device = "3"
    alsa.card = "2"
    alsa.card_name = "HDA NVidia"
    alsa.long_card_name = "HDA NVidia at 0xdf080000 irq 17"
    alsa.driver_name = "snd_hda_intel"
    device.bus_path = "pci-0000:01:00.1"
    sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card2"
    device.bus = "pci"
    device.vendor.id = "10de"
    device.vendor.name = "NVIDIA Corporation"
    device.product.id = "10f0"
    device.product.name = "GP104 High Definition Audio Controller"
    device.string = "hdmi:2"
    device.buffering.buffer_size = "65536"
    device.buffering.fragment_size = "32768"
    device.access_mode = "mmap+timer"
    device.profile.name = "hdmi-stereo"
    device.profile.description = "Digital Stereo (HDMI)"
    device.description = "GP104 High Definition Audio Controller Digital Stereo (HDMI)"
    alsa.mixer_name = "Nvidia GPU 83 HDMI/DP"
    alsa.components = "HDA:10de0083,14623301,00100100"
    module-udev-detect.discovered = "1"
    device.icon_name = "audio-card-pci"
    ports:
    hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: yes)
    properties:
    device.icon_name = "video-display"
    device.product.name = "VG245
    "
    active port:

After I manually select the other HDMI audio out from system menu, the Sink is replaced by this new one (I have 2 other irrelevant audio outputs, the new sink is added at the end of the index, so it's getting index 3):

  • index: 3
    name: <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1>
    driver: <module-alsa-card.c>
    flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: IDLE
    suspend cause:
    priority: 9030
    volume: front-left: 49808 / 76% / -7,15 dB, front-right: 49808 / 76% / -7,15 dB
    balance 0,00
    base volume: 65536 / 100% / 0,00 dB
    volume steps: 65537
    muted: no
    current latency: 64,86 ms
    max request: 14 KiB
    max rewind: 64 KiB
    monitor source: 4
    sample spec: s16le 2ch 48000Hz
    channel map: front-left,front-right
    Stereo
    used by: 0
    linked by: 1
    configured latency: 75,00 ms; range is 0,50 .. 341,33 ms
    card: 0 <alsa_card.pci-0000_01_00.1>
    module: 7
    properties:
    alsa.resolution_bits = "16"
    device.api = "alsa"
    device.class = "sound"
    alsa.class = "generic"
    alsa.subclass = "generic-mix"
    alsa.name = "HDMI 1"
    alsa.id = "HDMI 1"
    alsa.subdevice = "0"
    alsa.subdevice_name = "subdevice #0"
    alsa.device = "7"
    alsa.card = "2"
    alsa.card_name = "HDA NVidia"
    alsa.long_card_name = "HDA NVidia at 0xdf080000 irq 17"
    alsa.driver_name = "snd_hda_intel"
    device.bus_path = "pci-0000:01:00.1"
    sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card2"
    device.bus = "pci"
    device.vendor.id = "10de"
    device.vendor.name = "NVIDIA Corporation"
    device.product.id = "10f0"
    device.product.name = "GP104 High Definition Audio Controller"
    device.string = "hdmi:2,1"
    device.buffering.buffer_size = "65536"
    device.buffering.fragment_size = "32768"
    device.access_mode = "mmap+timer"
    device.profile.name = "hdmi-stereo-extra1"
    device.profile.description = "Digital Stereo (HDMI 2)"
    device.description = "GP104 High Definition Audio Controller Digital Stereo (HDMI 2)"
    alsa.mixer_name = "Nvidia GPU 83 HDMI/DP"
    alsa.components = "HDA:10de0083,14623301,00100100"
    module-udev-detect.discovered = "1"
    device.icon_name = "audio-card-pci"
    ports:
    hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: yes)
    properties:
    device.icon_name = "video-display"
    device.product.name = "VG245
    "
    active port:

At this point I've decided to come here and ask for you help/advices. Anybody here knows how I can modify the extensions in order to have both HDMI output displayed?

hide text when only one device is available

it would be great if this extension only showed the dropdown menu with the name of the current input and output devices if there was actually more than one to choose from. that way, the visual clutter is minimal when using my laptop as-is, while making it easy to switch to another input/output device when i plug into a dock or external microphone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.