Skip to content

Commit 791d573

Browse files
committed
Introduce audio-volume feature
Allowing user to set the default audio volume per qube via `audio-volume` feature. By default it is 100% (except some select qubes which will be always muted). resolves: QubesOS/qubes-issues#2724
1 parent a5ea121 commit 791d573

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

doc/manpages/qvm-features.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@ device instead of audio agent installed in the qube itself. The value is audio
404404
model to be emulated, supported values are `ich6`, `sb16`, `ac97`, `es1370`.
405405
Recommended is `ich6`. This is useful to get audio in a Windows qube.
406406

407+
408+
audio-initial-volume
409+
^^^^^^^^^^^^^^^^^^^^
410+
411+
Optionally sets the audio volume of the qube at every launch. Valid values are
412+
from 0 to 150; or `mute`. Default for `untrusted` and Whonix workstation based
413+
qubes is mute.
414+
407415
uefi
408416
^^^^
409417

qubesadmin/tools/qvm_start_daemon.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,26 @@ async def start_audio_for_vm(self, vm):
793793
str(self.pacat_domid(vm)),
794794
vm.name,
795795
]
796+
797+
try:
798+
volume = vm.features.check_with_template(
799+
"audio-initial-volume",
800+
self.app.domains[
801+
self.app.local_name
802+
].features.check_with_template(
803+
"audio-initial-volume",
804+
None,
805+
),
806+
)
807+
if volume:
808+
if volume.endswith("%"):
809+
volume = volume[:-1]
810+
pacat_cmd.insert(1, "-V")
811+
pacat_cmd.insert(2, volume)
812+
except qubesadmin.exc.QubesDaemonAccessError:
813+
# Most probably within a sys-audio with older policy files
814+
pass
815+
796816
vm.log.info("Starting AUDIO")
797817

798818
await asyncio.create_subprocess_exec(*pacat_cmd)

0 commit comments

Comments
 (0)