View previous topic :: View next topic |
Author |
Message |
alienjon Veteran
Joined: 09 Feb 2005 Posts: 1709
|
Posted: Wed Nov 19, 2014 12:08 am Post subject: Switch audio devices in KDE [solved] |
|
|
I alternate between using my speakers and a wireless headset (USB device). Normally I would right click on my KMix icon in the taskbar, select 'Audio Setup', and select the preferring device in the 'Audio Playback' section. I wondered if there is an easier 'one click' way of switching between the two devices. Ideally I could have a widget that clicking on it would alternate between the two (or other specified devices) but short of that I wondered if anyone knew how this could be done easily (depending on the process I could even look into doing a widget myself that accomplishes this).
Last edited by alienjon on Sun Aug 21, 2016 1:53 am; edited 1 time in total |
|
Back to top |
|
|
AndrewAmmerlaan Developer
Joined: 25 Jun 2014 Posts: 266 Location: Nijmegen
|
Posted: Wed Nov 26, 2014 5:10 pm Post subject: |
|
|
You could write a script and put it on your desktop, some script that does: "command-that-displays-audio-device-in-use = device1 than change to device 2, if command-that-displays-audio-device-in-use =device2 than change to device1". I don't know the exact commands to change the in use audio device, but I'm sure it's possible. I think this would be the easiest one-click solution. _________________ OS: Gentoo 6.7.3-gentoo-dist, ~amd64, 17.1/desktop/plasma/systemd/merged-usr
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400 |
|
Back to top |
|
|
alienjon Veteran
Joined: 09 Feb 2005 Posts: 1709
|
Posted: Wed Nov 26, 2014 9:11 pm Post subject: |
|
|
I had that thought too, but I don't know what the command would look like (ie: bash command to switch the audio device being used) |
|
Back to top |
|
|
AndrewAmmerlaan Developer
Joined: 25 Jun 2014 Posts: 266 Location: Nijmegen
|
|
Back to top |
|
|
alienjon Veteran
Joined: 09 Feb 2005 Posts: 1709
|
Posted: Sat Aug 20, 2016 10:53 pm Post subject: |
|
|
Thanks for sharing the thoughts (and sorry for my SIGNIFICANTLY late reply!). Using the initial command in the first link doesn't seem to change the audio device (though I'm going to test some more) and I don't think the script in the second link will work because I'm in KDE and that script calls Gnome-related commands.
While I do use Pulseaudio (so I suspect the pacmd command may eventually do the trick) my original thought was whether I could change the device through KDE. In System Settings -> Multimedia -> Audio and Video (on the left hand side) I can change the audio device preference for audio output/input. Right now, to switch between my headset and the desktop speakers I have to manually move the specific device to the top (and I usually hit 'apply to all' instead of changing the device for each entry, though this step may or may not be necessary). I was wondering if there was a KDE-way of doing this more simply. |
|
Back to top |
|
|
alienjon Veteran
Joined: 09 Feb 2005 Posts: 1709
|
Posted: Sun Aug 21, 2016 1:53 am Post subject: |
|
|
I sit corrected. The gnome references are regarding icons for the notify-send command (this can be changed to either an icon via filename or an icon handle of some sort - I don't have gnome installed so no icon comes up, but I was able to get the script to work anyway).
AndrewAmmerlaan, you were correct in my looking in this direction. Apparently the pulse audio commands via pacmd or pactl will change the audio without messing up KDE. My problem in testing is that changing the default sink DOESN'T change active streams. You need to modify those with the move-sink-input command. Having realized this I found that the script would work for my purposes. I made some additional alterations, as the script has the devices hard coded in (0 is the headset and 1 is the speaker output) so that you can set the two devices (by number/name) to toggle between. It's here for anyone interested. |
|
Back to top |
|
|
|