AndresCidoncha / audio-switcher

Gnome-Shell Extension: Easily switch between your audio inputs/outputs from the system menu
GNU General Public License v3.0
41 stars 19 forks source link

hide text when only one device is available #2

Open wbolster opened 8 years ago

wbolster commented 8 years ago

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.

AndresCidoncha commented 8 years ago

Hi wbolster, I think that the message "No more devices" it's a great way to know that the extension is working correctly, but You can try this extension.js, if You want that no message appears instead.

If more people want this feature, I will push to the master branch.

wbolster commented 8 years ago

thanks!

the aggregate dropdown menu in the top bar is quite minimalistic (as is gnome-shell in general), and that's a good thing.

this extension breaks that minimalism by showing useless (and oddly aligned) strings like "built-in audio device" which don't help the user. determining whether the extension is working should not be done by inspecting visual clutter ;)

this extension is great, but it only makes sense when there are actually multiple audio devices available (e.g. usb audio in docking station or hdmi). so i fail to see why the list is always shown if i can't do anything with it anyway. if i really want to tweak audio settings, that's what the audio settings preference panel in gnome control center is for.

or am i missing any use cases?

AndresCidoncha commented 8 years ago

Very good point @wbolster , I will change it soon as possible for me.

showing useless (and oddly aligned) strings like "built-in audio device" What do You mean with "oddly aligned"?

Thanks for your contribution!

wbolster commented 8 years ago

awesome. again, thanks for this very useful extension. i use it pretty much every day.

together with my very young work-in-progress "nothing to say" shell extension (https://github.com/wbolster/nothing-to-say) this solves all my everyday audio annoyances on gnome!

wbolster commented 8 years ago

oh, about "oddly aligned": the text is not aligned with other items in the menu, like the wifi network name.

salim-b commented 4 years ago

Any update on this? The drop-down menu ist still shown when only a single input/output device is present (It just says No more devices) with latest version of the extension on Ubuntu 20.04 (GNOME 3.36.1). Auto-hiding in such case would be awesome.

AndresCidoncha commented 4 years ago

I'm still looking for help for these features (as I'm not a extensions developer and this is not really my code) but I'll try to do it in this week, wish me luck :smile:

AndresCidoncha commented 4 years ago

It's done! Can you check if the change has the desired behaviour @wbolster @salim-b?

It's in the branch hide_text_when_only_one_device, I'll really appreciate your feedback in this guys :)

You can check the changes doing a simple git checkoutin ~/.local/share/gnome-shell/extensions/audio-switcher@AndresCidoncha/ and reloading the gnome shell ctrl+f2 and type r.

salim-b commented 4 years ago

It's done! Can you check if the change has the desired behaviour @wbolster @salim-b?

Thanks a lot! Works like a charm for me so far 👍

salim-b commented 4 years ago

Update: Unfortunately, https://github.com/AndresCidoncha/audio-switcher/commit/59a7c78c3ebe62ec841bdd59e684b917db52339e introduces a regression with suspend/resume- My findings so far:

AndresCidoncha commented 4 years ago

If only one input or output device is connected and you put your computer to suspend mode, the input/output device selector will show up in "frozen" state after resume

About that, if you only have 1 input/output device, you shouldn't see the device selector 🤔

I'll try to reproduce and find the problem but I guess that's the reason the original author used the open-state signal to reload the list.

salim-b commented 4 years ago

About that, if you only have 1 input/output device, you shouldn't see the device selector :thinking:

Yeah, exactly. Before suspend, the device selector wasn't there (expected behaviour) but after resume it suddenly is (unexpected behaviour, and it's in "frozen" state).

AndresCidoncha commented 4 years ago

I think that's fixed, can you check it too @salim-b ? I added a new commit in the hide_text_when_only_one_device branch

salim-b commented 4 years ago

I think that's fixed, can you check it too @salim-b ? I added a new commit in the hide_text_when_only_one_device branch

I've checked it out. The device selector doesn't freeze anymore but your changes introduce new regressions: :grimacing:

  1. The input selector doesn't work anymore. Although the dropdown works, the input device isn't actually switched when a different device is selected.

  2. After a reboot, the device selectors are hidden although multiple input/output devices are connected. The selector shows up again when I a) reconnect an audio device, b) restart GNOME Shell or c) change the audio device through GNOME settings.

AndresCidoncha commented 4 years ago

Fix 1, break 2... maybe it's not my day after all 😂 I saw the second bug and I'm trying to fix it, but I didn't notice about the first one, thank you! I hope I'll fix them this week

AndresCidoncha commented 4 years ago

Fixed the first bug, I forgot to change a line :sweat_smile: Working in the other bug

AndresCidoncha commented 4 years ago

About the second bug:

With USB headset connected (+ default laptop speakers), when I turn on the computer, looks like in the moment the extension is loaded, the get_sinks method only returns 1 device (default speakers) but when the USB headset is detected by the system, the output-added signal isn't detected.

Maybe I should keep using the state-open signal to avoid this problem.

salim-b commented 4 years ago

I don't know about the GNOME API / methods. But I just discovered an alternative extension named Sound Input & Output Device Chooser which works fine so far, optionally allows to hide the input selector when only one device is connected and even shows the different profiles per device. Maybe you can have a look at its sources to see how they do it. Or even join development forces! 🙃

AndresCidoncha commented 4 years ago

You're right @salim-b, join forces could be the best to do. Anyway, I'll fix these errors first and release the new version.