Last active 1 week ago

Korbs's Avatar Korbs revised this gist 1 week ago. Go to revision

1 file changed, 43 insertions

README.md(file created)

@@ -0,0 +1,43 @@
1 + During the day, I happen to switch between my speakers and headphones quite a bit. I've recently decided to setup custom shortcuts to switch quickly between them without needing to open the volume menu in GNOME or KDE.
2 +
3 + ## Install
4 +
5 + Firstly, the `pactl` tool is used for this, please install it:
6 +
7 + ```
8 + sudo dnf install pactl
9 + ```
10 +
11 + ## List
12 +
13 + Then, list your outputs:
14 + ```bash
15 + pactl list short sinks
16 + ```
17 +
18 + Here's what mine looks like:
19 + ```bash
20 + 51 alsa_output.usb-KTMicro_KT_USB_AUDIO_214b206000000178-00.analog-stereo PipeWire s24le 2ch 48000Hz SUSPENDED
21 + 52 alsa_output.pci-0000_00_1f.3.analog-stereo PipeWire s32le 2ch 48000Hz RUNNING
22 + ```
23 +
24 + KTMico is an Anker USB hub with an 3.5mm jack, the PCI is the one that is builtin to my laptop.
25 +
26 + ## Switching
27 +
28 + To switch between outputs, use the `set-default-sink`.
29 +
30 + As an example, this is what I use to switch to my laptop's builtin AUX port/speakers:
31 + ```bash
32 + pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
33 + ```
34 +
35 + ## Setup Keyboard Shortcut
36 +
37 + Using the keyboards settings in your Linux's DE, you can apply these commands to a custom shortcut.
38 +
39 + For my case, I did the following:
40 + - `Shift` `Alt` `Numpad1` - Switch to PCI (Laptop's AUX/Speakers)
41 + - `Shift` `Alt` `Numpad2` - Switch to External Speakers (USB C Hub's AUX)
42 +
43 + You can adapt to the way you want it, does not need to be like the way I have it.
Newer Older