Zren / plasma-applet-volumewin7mixer

https://store.kde.org/p/1100894/
37 stars 8 forks source link

Request: One click to switch speaker. #19

Open linchangyi opened 4 years ago

linchangyi commented 4 years ago

Now, in order to switch to another speaker, we have to click the speaker icon then set it to default, which need two clicks. I think it is too complicated for such a high frequency demand. It will be much more convinient to switch to a speaker by just clicking the speaker icon.

linchangyi commented 4 years ago

Left click to switch speaker, right click to show detailed options.

luema commented 4 years ago

I would like this too. Having to switch audio devices (external DAC -> internal soundcard for full duplex) every time I have a conference call, it would be nice for this to be more streamlined.

Zren commented 4 years ago

Plasma correctly detects I'm not using my HDMI output now so it's not trivial to test switching devices anymore. I've added RadioButton's to switch on click. Here's a mockup of what a speaker/mic will look like. Apps won't show the radio button (it's a mockup).

2020-07-26___13-17-29

If someone could test this, It'd be helpful.

luema commented 4 years ago

Sure thing. I'll be able to do it tomorrow when I get back to my PC.

luema commented 4 years ago

It works my dude.

Some things to note though:

Are there any log files I should share with you?

Zren commented 4 years ago

it only switches to the new device if I click on the little indicator bubble.

This is deliberate. I don't want to hide the contextmenu as most people will not know to right click the menu.

I will be adding a tooltip to the radiobutton mentioning "make default device" or "is default device".

the tray automatically closes after selecting the new audio device

Yeah I noticed that too. Weird. I will try to prevent that.

luema commented 4 years ago

This is deliberate. I don't want to hide the contextmenu as most people will not know to right click the menu.

If it's not too much effort, what would I have to change on my end to allow for left-clicking -> change device and right-clicking -> context menu?

I will be adding a tooltip to the radiobutton mentioning "make default device" or "is default device".

Is there any way to disable tooltips?

Zren commented 4 years ago

Oh, I just realized makeDefaultDevice() calls the following code. It means I added a config option ages ago to toggle closing the popup when setting a default device. It's useful when using keyboard shortcuts. Eg: Meta+V, LeftArrow, Enter. Anyways, just toggle the option in the config.

            if (plasmoid.configuration.closeOnSetDefault) {
                main.closeDialog(false)
            }

As for modifying the code, change onClicked: contextMenu.showBelow(iconLabelButton) to onClicked: mixerItem.makeDeviceDefault()

                    IconLabelButton {
                        id: iconLabelButton
                        ...
                        onClicked: mixerItem.makeDeviceDefault()

                        PlasmaComponents.RadioButton {
                            ...
luema commented 4 years ago

Awesome! I made both changes and everything's working great.

linchangyi commented 4 years ago

It works great. But in my opinion, clicking on the speaker icon would be much more intuitive than clicking the radio button, so I made some changes, would be my pleasure to have your pull request. image