From 31031009994ab34bb450213a595657e084795b92 Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Wed, 3 Jan 2024 11:47:13 +0100 Subject: [PATCH] fix: sys-audio policy and autostart pacat daemon --- salt/sys-audio/configure-dvm.sls | 22 ++++++++++- salt/sys-audio/create.sls | 2 +- .../files/admin/policy/default.policy | 37 ++++++++++++------- .../files/dvm/qvm-start-daemon.desktop | 13 +++++++ salt/sys-audio/install-bluetooth.sls | 1 + 5 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 salt/sys-audio/files/dvm/qvm-start-daemon.desktop diff --git a/salt/sys-audio/configure-dvm.sls b/salt/sys-audio/configure-dvm.sls index 7900c109..64e61336 100644 --- a/salt/sys-audio/configure-dvm.sls +++ b/salt/sys-audio/configure-dvm.sls @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later {% if grains['nodename'] != 'dom0' -%} -"{{ slsdotpath }}-autostart-volumeicon-systray": +"{{ slsdotpath }}-desktop-volumeicon": file.managed: - name: /home/user/.local/share/applications/volumeicon.desktop - source: salt://{{ slsdotpath }}/files/dvm/volumeicon.desktop @@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later - group: user - makedirs: True -"{{ slsdotpath }}-desktop-autostart": +"{{ slsdotpath }}-autostart-volumeicon": file.symlink: - name: /home/user/.config/autostart/volumeicon.desktop - target: /home/user/.local/share/applications/volumeicon.desktop @@ -24,4 +24,22 @@ SPDX-License-Identifier: AGPL-3.0-or-later - force: True - makedirs: True +"{{ slsdotpath }}-desktop-qvm-start-daemon": + file.managed: + - name: /home/user/.local/share/applications/qvm-start-daemon.desktop + - source: salt://{{ slsdotpath }}/files/dvm/qvm-start-daemon.desktop + - mode: '0644' + - user: user + - group: user + - makedirs: True + +"{{ slsdotpath }}-autostart-qvm-start-daemon": + file.symlink: + - name: /home/user/.config/autostart/qvm-start-daemon.desktop + - target: /home/user/.local/share/applications/qvm-start-daemon.desktop + - user: user + - group: user + - force: True + - makedirs: True + {% endif -%} diff --git a/salt/sys-audio/create.sls b/salt/sys-audio/create.sls index 102e88e2..b8eb7718 100644 --- a/salt/sys-audio/create.sls +++ b/salt/sys-audio/create.sls @@ -26,7 +26,7 @@ prefs: - virt_mode: hvm - template_for_dispvms: True - include_in_backups: False -featuresq: +features: - enable: - servicevm - appmenus-dispvm diff --git a/salt/sys-audio/files/admin/policy/default.policy b/salt/sys-audio/files/admin/policy/default.policy index 344abb59..fd027ffc 100644 --- a/salt/sys-audio/files/admin/policy/default.policy +++ b/salt/sys-audio/files/admin/policy/default.policy @@ -1,24 +1,33 @@ # SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# SPDX-FileCopyrightText: 2023 Yukikoo neowutran # # SPDX-License-Identifier: AGPL-3.0-or-later +# +# Credits: https://forum.qubes-os.org/t/audio-qube/20685 ## Do not modify this file, create a new policy with with a lower number in the ## file name instead. For example `30-user.policy`. -admin.Events * {{ sls_path }} @adminvm allow target=dom0 -admin.Events +domain-stopped {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 -admin.Events +domain-shutdown {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 -admin.Events +domain-start {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 -admin.Events +connection-established {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.Events * sys-audio sys-audio allow target=dom0 +admin.Events * sys-audio @adminvm allow target=dom0 +admin.Events * sys-audio @tag:audiovm-sys-audio allow target=dom0 + +admin.vm.CurrentState * sys-audio sys-audio allow target=dom0 +admin.vm.CurrentState * sys-audio @adminvm allow target=dom0 +admin.vm.CurrentState * sys-audio @tag:audiovm-sys-audio allow target=dom0 + +admin.vm.List * sys-audio sys-audio allow target=dom0 +admin.vm.List * sys-audio @adminvm allow target=dom0 +admin.vm.List * sys-audio @tag:audiovm-sys-audio allow target=dom0 -admin.vm.CurrentState * {{ sls_path }} @adminvm allow target=dom0 -admin.vm.CurrentState * {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 -admin.vm.List * {{ sls_path }} @adminvm allow target=dom0 -admin.vm.List * {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.vm.property.Get +audiovm sys-audio @tag:audiovm-sys-audio allow target=dom0 +admin.vm.property.Get +xid sys-audio @tag:audiovm-sys-audio allow target=dom0 +admin.vm.property.Get +stubdom_xid sys-audio @tag:audiovm-sys-audio allow target=dom0 -admin.vm.property.Get +audiovm {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 -admin.vm.property.Get +xid {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 -admin.vm.property.Get +stubdom_xid {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.vm.feature.CheckWithTemplate +audio sys-audio @tag:audiovm-sys-audio allow target=dom0 +admin.vm.feature.CheckWithTemplate +audio-model sys-audio @tag:audiovm-sys-audio allow target=dom0 +admin.vm.feature.CheckWithTemplate +supported-service.pipewire sys-audio @tag:audiovm-sys-audio allow target=dom0 +admin.vm.feature.CheckWithTemplate +audio-low-latency sys-audio @tag:audiovm-sys-audio allow target=dom0 -admin.vm.feature.CheckWithTemplate +audio {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 -admin.vm.feature.CheckWithTemplate +audio-model {{ sls_path }} @tag:audiovm-{{ sls_path }} allow target=dom0 +admin.vm.property.GetAll * sys-audio sys-audio allow target=dom0 +admin.vm.property.GetAll * sys-audio @tag:audiovm-sys-audio allow target=dom0 ## vim:ft=qrexecpolicy diff --git a/salt/sys-audio/files/dvm/qvm-start-daemon.desktop b/salt/sys-audio/files/dvm/qvm-start-daemon.desktop new file mode 100644 index 00000000..025aa361 --- /dev/null +++ b/salt/sys-audio/files/dvm/qvm-start-daemon.desktop @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[Desktop Entry] +Name=Qubes Guid/Pacat +Exec=qvm-start-daemon --all --watch +Icon=qubes +Terminal=false +X-MultipleArgs=False +Type=Application +Keywords=audio; +Categories=Audio; diff --git a/salt/sys-audio/install-bluetooth.sls b/salt/sys-audio/install-bluetooth.sls index 2ad63a80..2d280a77 100644 --- a/salt/sys-audio/install-bluetooth.sls +++ b/salt/sys-audio/install-bluetooth.sls @@ -8,6 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later include: - .install + - sys-usb.install-client-proxy "{{ slsdotpath }}-bluetooth-updated": pkg.uptodate: