audioswitch 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- audioswitch-0.2.2/.github/workflows/check.yml +22 -0
- audioswitch-0.2.2/.github/workflows/workflow.yaml +83 -0
- audioswitch-0.2.2/.gitignore +4 -0
- audioswitch-0.2.2/LICENSE +21 -0
- audioswitch-0.2.2/PKG-INFO +145 -0
- audioswitch-0.2.2/README.md +127 -0
- audioswitch-0.2.2/packaging/audioswitch.desktop +7 -0
- audioswitch-0.2.2/packaging/aur/PKGBUILD +26 -0
- audioswitch-0.2.2/packaging/win_entry.py +6 -0
- audioswitch-0.2.2/pyproject.toml +29 -0
- audioswitch-0.2.2/src/audioswitch/__init__.py +1 -0
- audioswitch-0.2.2/src/audioswitch/__main__.py +5 -0
- audioswitch-0.2.2/src/audioswitch/app.py +285 -0
- audioswitch-0.2.2/src/audioswitch/icon.svg +6 -0
- audioswitch-0.2.2/src/audioswitch/linux.py +231 -0
- audioswitch-0.2.2/src/audioswitch/windows.py +204 -0
- audioswitch-0.2.2/tests/smoke_windows.py +57 -0
- audioswitch-0.2.2/tools/win_sidetone_probe.py +166 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: check
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
windows:
|
|
5
|
+
runs-on: windows-latest
|
|
6
|
+
steps:
|
|
7
|
+
- uses: actions/checkout@v7
|
|
8
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
9
|
+
- run: uv tool install .
|
|
10
|
+
- name: Exercise the Windows backend
|
|
11
|
+
env:
|
|
12
|
+
QT_QPA_PLATFORM: offscreen
|
|
13
|
+
run: uv run --with . python tests/smoke_windows.py
|
|
14
|
+
- name: Sidetone probe loads
|
|
15
|
+
run: uv run --with pycaw python tools/win_sidetone_probe.py
|
|
16
|
+
linux:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
21
|
+
- run: uv tool install .
|
|
22
|
+
- run: uv run --with . python -c "import audioswitch.linux"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags: ["v*"]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
check-version:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v7
|
|
11
|
+
- name: Tag must match the version in pyproject.toml
|
|
12
|
+
run: grep -qx "version = \"${GITHUB_REF_NAME#v}\"" pyproject.toml
|
|
13
|
+
|
|
14
|
+
windows-exe:
|
|
15
|
+
needs: check-version
|
|
16
|
+
runs-on: windows-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
20
|
+
- name: Build audioswitch.exe
|
|
21
|
+
run: >
|
|
22
|
+
uv run --with pyinstaller --with . pyinstaller --noconfirm --onefile --noconsole
|
|
23
|
+
--name audioswitch --add-data "src/audioswitch/icon.svg;audioswitch"
|
|
24
|
+
packaging/win_entry.py
|
|
25
|
+
- name: Check the exe starts and stays up
|
|
26
|
+
shell: pwsh
|
|
27
|
+
run: |
|
|
28
|
+
$p = Start-Process dist/audioswitch.exe -ArgumentList "--hidden" -PassThru
|
|
29
|
+
Start-Sleep 10
|
|
30
|
+
if ($p.HasExited) { throw "audioswitch.exe exited with code $($p.ExitCode)" }
|
|
31
|
+
Stop-Process -Id $p.Id -Force
|
|
32
|
+
- uses: actions/upload-artifact@v7
|
|
33
|
+
with:
|
|
34
|
+
name: audioswitch-windows
|
|
35
|
+
path: dist/audioswitch.exe
|
|
36
|
+
|
|
37
|
+
github-release:
|
|
38
|
+
needs: windows-exe
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
permissions:
|
|
41
|
+
contents: write
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v7
|
|
44
|
+
- uses: actions/download-artifact@v8
|
|
45
|
+
with:
|
|
46
|
+
name: audioswitch-windows
|
|
47
|
+
- run: gh release create "$GITHUB_REF_NAME" audioswitch.exe --title "$GITHUB_REF_NAME" --generate-notes
|
|
48
|
+
env:
|
|
49
|
+
GH_TOKEN: ${{ github.token }}
|
|
50
|
+
|
|
51
|
+
# Enable with: gh variable set PUBLISH_PYPI --body true (after adding this repo and the
|
|
52
|
+
# workflow "workflow.yaml" as a trusted publisher for the project on pypi.org)
|
|
53
|
+
pypi:
|
|
54
|
+
needs: check-version
|
|
55
|
+
if: vars.PUBLISH_PYPI == 'true'
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
environment: pypi
|
|
58
|
+
permissions:
|
|
59
|
+
id-token: write
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v7
|
|
62
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
63
|
+
- run: uv build
|
|
64
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
65
|
+
|
|
66
|
+
# Enable with: gh variable set PUBLISH_AUR --body true (after storing the AUR SSH key as
|
|
67
|
+
# the secret AUR_SSH_PRIVATE_KEY)
|
|
68
|
+
aur:
|
|
69
|
+
needs: check-version
|
|
70
|
+
if: vars.PUBLISH_AUR == 'true'
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v7
|
|
74
|
+
- run: sed -i "s/^pkgver=.*/pkgver=${GITHUB_REF_NAME#v}/; s/^pkgrel=.*/pkgrel=1/" packaging/aur/PKGBUILD
|
|
75
|
+
- uses: KSXGitHub/github-actions-deploy-aur@v4.2.0
|
|
76
|
+
with:
|
|
77
|
+
pkgname: audioswitch
|
|
78
|
+
pkgbuild: packaging/aur/PKGBUILD
|
|
79
|
+
updpkgsums: true
|
|
80
|
+
commit_username: DeastinY
|
|
81
|
+
commit_email: DeastinY@users.noreply.github.com
|
|
82
|
+
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
83
|
+
commit_message: "Update to ${{ github.ref_name }}"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Richard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: audioswitch
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Hold a key to switch audio output between two devices, with a sidetone slider
|
|
5
|
+
Project-URL: Repository, https://github.com/DeastinY/audioswitch
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: audio,headphones,headset,hotkey,output-switcher,pipewire,sidetone,tray
|
|
9
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: evdev>=1.6; sys_platform == 'linux'
|
|
15
|
+
Requires-Dist: pycaw>=20251023; sys_platform == 'win32'
|
|
16
|
+
Requires-Dist: pyqt6>=6.5
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# audioswitch
|
|
20
|
+
|
|
21
|
+
[](https://github.com/DeastinY/audioswitch/actions/workflows/check.yml)
|
|
22
|
+
[](https://github.com/DeastinY/audioswitch/tags)
|
|
23
|
+

|
|
24
|
+

|
|
25
|
+

|
|
26
|
+

|
|
27
|
+
[](LICENSE)
|
|
28
|
+
|
|
29
|
+
> **Disclaimer:** this project was written with AI assistance (Claude). It is a small personal tool; review it before relying on it.
|
|
30
|
+
|
|
31
|
+
Hold a key to flip your audio output between two devices — for example, hold the
|
|
32
|
+
mute button for a second to jump between speakers and a headset. A short tap of
|
|
33
|
+
the same key still mutes.
|
|
34
|
+
|
|
35
|
+
A small tray app with a settings window:
|
|
36
|
+
|
|
37
|
+
- **Hotkey** — click and press any key; the hold time is adjustable.
|
|
38
|
+
- **Output A / B** — the two devices to switch between. Playing streams move along.
|
|
39
|
+
- **Sidetone** (Linux) — on/off and level for headsets that expose a `Sidetone` mixer control.
|
|
40
|
+
- **Start at login**.
|
|
41
|
+
|
|
42
|
+
| | Linux | Windows |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| Hold-to-switch hotkey, tap to mute | yes | yes |
|
|
45
|
+
| Moves streams an app pinned to a device (e.g. a browser call) | yes | no |
|
|
46
|
+
| Sidetone slider | yes | not yet |
|
|
47
|
+
| Status | used daily | checked in CI only, not yet on real hardware |
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
**Linux or Windows, with [uv](https://docs.astral.sh/uv/):**
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
uv tool install git+https://github.com/DeastinY/audioswitch
|
|
55
|
+
audioswitch --install-launcher # optional: add it to the application / Start menu
|
|
56
|
+
audioswitch
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Update with `uv tool upgrade audioswitch`, remove with `uv tool uninstall audioswitch`.
|
|
60
|
+
|
|
61
|
+
**Windows, without installing anything:** download `audioswitch.exe` from the
|
|
62
|
+
[latest release](https://github.com/DeastinY/audioswitch/releases/latest) and run it.
|
|
63
|
+
|
|
64
|
+
**Arch Linux:** a `PKGBUILD` is in [`packaging/aur`](packaging/aur).
|
|
65
|
+
|
|
66
|
+
The app starts itself at login from the first run on; untick "Start at login" in
|
|
67
|
+
its window if you do not want that.
|
|
68
|
+
|
|
69
|
+
### Linux requirements
|
|
70
|
+
|
|
71
|
+
- PipeWire with `pipewire-pulse` and WirePlumber, and the tools `pactl`,
|
|
72
|
+
`pw-metadata`, `pw-link`, `pw-dump` (packages `pipewire`, `libpulse` on Arch).
|
|
73
|
+
- `amixer` (`alsa-utils`) for the sidetone slider.
|
|
74
|
+
- Read access to `/dev/input/event*` for the hotkey. Usually that means being in
|
|
75
|
+
the `input` group: `sudo usermod -aG input $USER`, then log out and back in.
|
|
76
|
+
Note that this lets your user's programs read all keyboard input.
|
|
77
|
+
|
|
78
|
+
### Windows requirements
|
|
79
|
+
|
|
80
|
+
Windows 10 or 11. Nothing else; uv fetches Python and the dependencies.
|
|
81
|
+
|
|
82
|
+
## Which headsets and speakers work?
|
|
83
|
+
|
|
84
|
+
**Switching** works with any two outputs your system lists: USB headsets, USB
|
|
85
|
+
DACs and speakers, onboard audio, HDMI, Bluetooth.
|
|
86
|
+
|
|
87
|
+
**The sidetone slider** works with headsets that implement mic monitoring as a
|
|
88
|
+
standard USB audio control, which Linux shows as a mixer control named
|
|
89
|
+
`Sidetone`. To check yours:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
amixer -c <card number> scontrols | grep -i sidetone # card numbers: cat /proc/asound/cards
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
| Headset | Sidetone slider | Source |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| Sony INZONE H6 Air (USB audio box) | works | tested |
|
|
98
|
+
| Sony INZONE H3, INZONE E9 | expected | same plain-USB-audio design as the H6 Air; untested |
|
|
99
|
+
| Corsair HS80, HS70 (wired), Virtuoso | reported to expose sidetone in alsamixer | [HeadsetControl README](https://github.com/Sapd/HeadsetControl) |
|
|
100
|
+
|
|
101
|
+
Headsets that set sidetone over a proprietary USB channel instead (many
|
|
102
|
+
SteelSeries Arctis, Logitech G and wireless Corsair models) do not show the
|
|
103
|
+
control; use [HeadsetControl](https://github.com/Sapd/HeadsetControl) for those.
|
|
104
|
+
Switching still works with them.
|
|
105
|
+
|
|
106
|
+
If your headset works, an issue or pull request adding it to the table is welcome.
|
|
107
|
+
|
|
108
|
+
## Usage
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
audioswitch # open the settings window (starts the tray app if needed)
|
|
112
|
+
audioswitch --hidden # start in the tray only
|
|
113
|
+
audioswitch --toggle # switch output now
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Closing the window keeps the app in the tray; quit from the tray menu.
|
|
117
|
+
|
|
118
|
+
## How it works
|
|
119
|
+
|
|
120
|
+
- **Linux:** keys are read from evdev, so the hotkey works on Wayland and X11
|
|
121
|
+
alike. Switching sets the default sink, retargets every playing stream, and
|
|
122
|
+
rewires by hand any stream the session manager refuses to move.
|
|
123
|
+
- **Linux, KDE Plasma:** if the hotkey is the Volume Mute key, the app unassigns
|
|
124
|
+
Plasma's own Mute shortcut while it runs and mutes on a short tap itself.
|
|
125
|
+
Otherwise Plasma would mute the moment the key goes down and flicker during a
|
|
126
|
+
long hold. The shortcut is handed back when the app quits. On other desktops a
|
|
127
|
+
long hold of the mute key also toggles mute; pick a different key there.
|
|
128
|
+
- **Windows:** a low-level keyboard hook watches the key and swallows the mute
|
|
129
|
+
key so a long hold does not mute; a short tap is replayed so Windows mutes as
|
|
130
|
+
usual. The default device is changed through the same unofficial interface
|
|
131
|
+
other device switchers use (via [pycaw](https://github.com/AndreMiras/pycaw)).
|
|
132
|
+
|
|
133
|
+
Settings live in `~/.config/audioswitch/config.json` (Linux) or
|
|
134
|
+
`%APPDATA%\audioswitch\config.json` (Windows).
|
|
135
|
+
|
|
136
|
+
## Releasing
|
|
137
|
+
|
|
138
|
+
Bump `version` in `pyproject.toml`, commit, then `git tag vX.Y.Z && git push --tags`.
|
|
139
|
+
The release workflow builds `audioswitch.exe` and creates the GitHub release; it
|
|
140
|
+
also publishes to PyPI and the AUR once those are enabled (see the comments in
|
|
141
|
+
[`workflow.yaml`](.github/workflows/workflow.yaml)).
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# audioswitch
|
|
2
|
+
|
|
3
|
+
[](https://github.com/DeastinY/audioswitch/actions/workflows/check.yml)
|
|
4
|
+
[](https://github.com/DeastinY/audioswitch/tags)
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
> **Disclaimer:** this project was written with AI assistance (Claude). It is a small personal tool; review it before relying on it.
|
|
12
|
+
|
|
13
|
+
Hold a key to flip your audio output between two devices — for example, hold the
|
|
14
|
+
mute button for a second to jump between speakers and a headset. A short tap of
|
|
15
|
+
the same key still mutes.
|
|
16
|
+
|
|
17
|
+
A small tray app with a settings window:
|
|
18
|
+
|
|
19
|
+
- **Hotkey** — click and press any key; the hold time is adjustable.
|
|
20
|
+
- **Output A / B** — the two devices to switch between. Playing streams move along.
|
|
21
|
+
- **Sidetone** (Linux) — on/off and level for headsets that expose a `Sidetone` mixer control.
|
|
22
|
+
- **Start at login**.
|
|
23
|
+
|
|
24
|
+
| | Linux | Windows |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| Hold-to-switch hotkey, tap to mute | yes | yes |
|
|
27
|
+
| Moves streams an app pinned to a device (e.g. a browser call) | yes | no |
|
|
28
|
+
| Sidetone slider | yes | not yet |
|
|
29
|
+
| Status | used daily | checked in CI only, not yet on real hardware |
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
**Linux or Windows, with [uv](https://docs.astral.sh/uv/):**
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
uv tool install git+https://github.com/DeastinY/audioswitch
|
|
37
|
+
audioswitch --install-launcher # optional: add it to the application / Start menu
|
|
38
|
+
audioswitch
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Update with `uv tool upgrade audioswitch`, remove with `uv tool uninstall audioswitch`.
|
|
42
|
+
|
|
43
|
+
**Windows, without installing anything:** download `audioswitch.exe` from the
|
|
44
|
+
[latest release](https://github.com/DeastinY/audioswitch/releases/latest) and run it.
|
|
45
|
+
|
|
46
|
+
**Arch Linux:** a `PKGBUILD` is in [`packaging/aur`](packaging/aur).
|
|
47
|
+
|
|
48
|
+
The app starts itself at login from the first run on; untick "Start at login" in
|
|
49
|
+
its window if you do not want that.
|
|
50
|
+
|
|
51
|
+
### Linux requirements
|
|
52
|
+
|
|
53
|
+
- PipeWire with `pipewire-pulse` and WirePlumber, and the tools `pactl`,
|
|
54
|
+
`pw-metadata`, `pw-link`, `pw-dump` (packages `pipewire`, `libpulse` on Arch).
|
|
55
|
+
- `amixer` (`alsa-utils`) for the sidetone slider.
|
|
56
|
+
- Read access to `/dev/input/event*` for the hotkey. Usually that means being in
|
|
57
|
+
the `input` group: `sudo usermod -aG input $USER`, then log out and back in.
|
|
58
|
+
Note that this lets your user's programs read all keyboard input.
|
|
59
|
+
|
|
60
|
+
### Windows requirements
|
|
61
|
+
|
|
62
|
+
Windows 10 or 11. Nothing else; uv fetches Python and the dependencies.
|
|
63
|
+
|
|
64
|
+
## Which headsets and speakers work?
|
|
65
|
+
|
|
66
|
+
**Switching** works with any two outputs your system lists: USB headsets, USB
|
|
67
|
+
DACs and speakers, onboard audio, HDMI, Bluetooth.
|
|
68
|
+
|
|
69
|
+
**The sidetone slider** works with headsets that implement mic monitoring as a
|
|
70
|
+
standard USB audio control, which Linux shows as a mixer control named
|
|
71
|
+
`Sidetone`. To check yours:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
amixer -c <card number> scontrols | grep -i sidetone # card numbers: cat /proc/asound/cards
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| Headset | Sidetone slider | Source |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| Sony INZONE H6 Air (USB audio box) | works | tested |
|
|
80
|
+
| Sony INZONE H3, INZONE E9 | expected | same plain-USB-audio design as the H6 Air; untested |
|
|
81
|
+
| Corsair HS80, HS70 (wired), Virtuoso | reported to expose sidetone in alsamixer | [HeadsetControl README](https://github.com/Sapd/HeadsetControl) |
|
|
82
|
+
|
|
83
|
+
Headsets that set sidetone over a proprietary USB channel instead (many
|
|
84
|
+
SteelSeries Arctis, Logitech G and wireless Corsair models) do not show the
|
|
85
|
+
control; use [HeadsetControl](https://github.com/Sapd/HeadsetControl) for those.
|
|
86
|
+
Switching still works with them.
|
|
87
|
+
|
|
88
|
+
If your headset works, an issue or pull request adding it to the table is welcome.
|
|
89
|
+
|
|
90
|
+
## Usage
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
audioswitch # open the settings window (starts the tray app if needed)
|
|
94
|
+
audioswitch --hidden # start in the tray only
|
|
95
|
+
audioswitch --toggle # switch output now
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Closing the window keeps the app in the tray; quit from the tray menu.
|
|
99
|
+
|
|
100
|
+
## How it works
|
|
101
|
+
|
|
102
|
+
- **Linux:** keys are read from evdev, so the hotkey works on Wayland and X11
|
|
103
|
+
alike. Switching sets the default sink, retargets every playing stream, and
|
|
104
|
+
rewires by hand any stream the session manager refuses to move.
|
|
105
|
+
- **Linux, KDE Plasma:** if the hotkey is the Volume Mute key, the app unassigns
|
|
106
|
+
Plasma's own Mute shortcut while it runs and mutes on a short tap itself.
|
|
107
|
+
Otherwise Plasma would mute the moment the key goes down and flicker during a
|
|
108
|
+
long hold. The shortcut is handed back when the app quits. On other desktops a
|
|
109
|
+
long hold of the mute key also toggles mute; pick a different key there.
|
|
110
|
+
- **Windows:** a low-level keyboard hook watches the key and swallows the mute
|
|
111
|
+
key so a long hold does not mute; a short tap is replayed so Windows mutes as
|
|
112
|
+
usual. The default device is changed through the same unofficial interface
|
|
113
|
+
other device switchers use (via [pycaw](https://github.com/AndreMiras/pycaw)).
|
|
114
|
+
|
|
115
|
+
Settings live in `~/.config/audioswitch/config.json` (Linux) or
|
|
116
|
+
`%APPDATA%\audioswitch\config.json` (Windows).
|
|
117
|
+
|
|
118
|
+
## Releasing
|
|
119
|
+
|
|
120
|
+
Bump `version` in `pyproject.toml`, commit, then `git tag vX.Y.Z && git push --tags`.
|
|
121
|
+
The release workflow builds `audioswitch.exe` and creates the GitHub release; it
|
|
122
|
+
also publishes to PyPI and the AUR once those are enabled (see the comments in
|
|
123
|
+
[`workflow.yaml`](.github/workflows/workflow.yaml)).
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Maintainer: DeastinY <DeastinY@users.noreply.github.com>
|
|
2
|
+
pkgname=audioswitch
|
|
3
|
+
pkgver=0.2.2
|
|
4
|
+
pkgrel=1
|
|
5
|
+
pkgdesc="Hold a key to switch audio output between two devices; tray app with sidetone slider"
|
|
6
|
+
arch=('any')
|
|
7
|
+
url="https://github.com/DeastinY/audioswitch"
|
|
8
|
+
license=('MIT')
|
|
9
|
+
depends=('python' 'python-pyqt6' 'qt6-svg' 'python-evdev' 'pipewire' 'pipewire-pulse'
|
|
10
|
+
'wireplumber' 'libpulse' 'alsa-utils' 'libnotify')
|
|
11
|
+
makedepends=('python-build' 'python-installer' 'python-hatchling')
|
|
12
|
+
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
|
|
13
|
+
sha256sums=('SKIP')
|
|
14
|
+
|
|
15
|
+
build() {
|
|
16
|
+
cd "$pkgname-$pkgver"
|
|
17
|
+
python -m build --wheel --no-isolation
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
package() {
|
|
21
|
+
cd "$pkgname-$pkgver"
|
|
22
|
+
python -m installer --destdir="$pkgdir" dist/*.whl
|
|
23
|
+
install -Dm644 packaging/audioswitch.desktop "$pkgdir/usr/share/applications/audioswitch.desktop"
|
|
24
|
+
install -Dm644 src/audioswitch/icon.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/audioswitch.svg"
|
|
25
|
+
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "audioswitch"
|
|
3
|
+
version = "0.2.2"
|
|
4
|
+
description = "Hold a key to switch audio output between two devices, with a sidetone slider"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
keywords = ["audio", "headset", "headphones", "sidetone", "hotkey", "pipewire", "output-switcher", "tray"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Operating System :: POSIX :: Linux",
|
|
11
|
+
"Operating System :: Microsoft :: Windows",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"PyQt6>=6.5",
|
|
17
|
+
"evdev>=1.6; sys_platform == 'linux'",
|
|
18
|
+
"pycaw>=20251023; sys_platform == 'win32'",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Repository = "https://github.com/DeastinY/audioswitch"
|
|
23
|
+
|
|
24
|
+
[project.gui-scripts]
|
|
25
|
+
audioswitch = "audioswitch.app:main"
|
|
26
|
+
|
|
27
|
+
[build-system]
|
|
28
|
+
requires = ["hatchling"]
|
|
29
|
+
build-backend = "hatchling.build"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Hold a key to switch audio output."""
|