From 409ac73e73d565a9518168132f5b5c76ddfe055f Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Mon, 15 Jul 2024 18:03:08 +0200 Subject: [PATCH] feat: add appmenus to audio applications --- rpm_spec/qusal-sys-audio.spec | 1 + rpm_spec/qusal-sys-usb.spec | 1 + salt/sys-audio/README.md | 33 ++++++++++++++----- salt/sys-audio/appmenus.sls | 8 +++++ salt/sys-audio/appmenus.top | 10 ++++++ salt/sys-audio/create.sls | 16 ++++++++- .../files/admin/policy/default.policy | 2 +- salt/sys-audio/install-easyeffects.sls | 21 ++++++++++++ salt/sys-audio/install-easyeffects.top | 10 ++++++ salt/sys-usb/README.md | 2 ++ salt/sys-usb/appmenus.sls | 8 +++++ salt/sys-usb/appmenus.top | 10 ++++++ salt/sys-usb/create.sls | 14 ++++++++ .../sys-usb/files/admin/policy/default.policy | 1 + 14 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 salt/sys-audio/appmenus.sls create mode 100644 salt/sys-audio/appmenus.top create mode 100644 salt/sys-audio/install-easyeffects.sls create mode 100644 salt/sys-audio/install-easyeffects.top create mode 100644 salt/sys-usb/appmenus.sls create mode 100644 salt/sys-usb/appmenus.top diff --git a/rpm_spec/qusal-sys-audio.spec b/rpm_spec/qusal-sys-audio.spec index d736c63..68ed5e1 100644 --- a/rpm_spec/qusal-sys-audio.spec +++ b/rpm_spec/qusal-sys-audio.spec @@ -78,6 +78,7 @@ if test "$1" = "1"; then qubesctl state.apply sys-audio.create qubesctl --skip-dom0 --targets=tpl-sys-audio state.apply sys-audio.install qubesctl --skip-dom0 --targets=dvm-sys-audio state.apply sys-audio.configure-dvm + qubesctl state.apply sys-audio.appmenus elif test "$1" = "2"; then ## Upgrade true diff --git a/rpm_spec/qusal-sys-usb.spec b/rpm_spec/qusal-sys-usb.spec index 1bbedb5..0059937 100644 --- a/rpm_spec/qusal-sys-usb.spec +++ b/rpm_spec/qusal-sys-usb.spec @@ -73,6 +73,7 @@ if test "$1" = "1"; then ## Install qubesctl state.apply sys-usb.create qubesctl --skip-dom0 --targets=tpl-sys-usb state.apply sys-usb.install + qubesctl state.apply sys-usb.appmenus elif test "$1" = "2"; then ## Upgrade true diff --git a/salt/sys-audio/README.md b/salt/sys-audio/README.md index c415eee..28e6cfe 100644 --- a/salt/sys-audio/README.md +++ b/salt/sys-audio/README.md @@ -9,7 +9,8 @@ Audio operations in Qubes OS. * [Usage](#usage) * [Audio control](#audio-control) * [Client turned off with a device attached](#client-turned-off-with-a-device-attached) - * [How to use USB devices](#how-to-use-usb-devices) + * [How to managed audio input/output devices](#how-to-managed-audio-inputoutput-devices) + * [How to use advanced audio processing capabilities](#how-to-use-advanced-audio-processing-capabilities) * [How to use Bluetooth](#how-to-use-bluetooth) * [How to make the Bluetooth icon appear in the system tray](#how-to-make-the-bluetooth-icon-appear-in-the-system-tray) * [How to attach the Bluetooth controller to the AudioVM persistently](#how-to-attach-the-bluetooth-controller-to-the-audiovm-persistently) @@ -29,6 +30,7 @@ the necessary packages for bluetooth with the provided state. sudo qubesctl top.enable sys-audio sudo qubesctl --targets=tpl-sys-audio,dvm-sys-audio state.apply sudo qubesctl top.disable sys-audio +sudo qubesctl state.apply sys-audio.appmenus ``` * State: @@ -39,6 +41,7 @@ sudo qubesctl top.disable sys-audio sudo qubesctl state.apply sys-audio.create sudo qubesctl --skip-dom0 --targets=tpl-sys-audio state.apply sys-audio.install sudo qubesctl --skip-dom0 --targets=dvm-sys-audio state.apply sys-audio.configure-dvm +sudo qubesctl state.apply sys-audio.appmenus ``` @@ -49,6 +52,13 @@ If you want to autostart the AudioVM on boot, you may run: sudo qubesctl state.apply sys-audio.autostart ``` +To use advanced sound features such as mixing, echo canceller, noise +reduction: + +```sh +sudo qubesctl --skip-dom0 --targets=tpl-sys-audio state.apply sys-audio.install-easyeffects +``` + If you need Bluetooth support, install the dependencies: ```sh @@ -82,18 +92,25 @@ will fail. To be able to use the device again: * Restart the audio client; and * Attach the device to the audio client. -### How to use USB devices +### How to managed audio input/output devices -It is possible to connect USB devices to `disp-sys-audio`, just attach the -devices to the AudioVM. Note that attached devices don't take precedence over -built-in audio. To choose which playback and recording device a qube should -use, on `disp-sys-audio`, from the application menu, click on `Volume Control` -or from the terminal, run `pavucontrol`. Select the `Playback` and `Recording` -tab, find your client qube and select the wanted device. +It is possible to connect many types of audio devices to `disp-sys-audio`, +just attach the devices to the AudioVM. Note that attached devices don't take +precedence over built-in audio, happens with USB devices. To choose which +playback and recording device a qube should use, on `disp-sys-audio`, from the +application menu, click on `Volume Control` or from the terminal, run +`pavucontrol`. Select the `Playback` and `Recording` tab, find your client +qube and select the wanted device. For more information, please refer to the [usage of sys-usb](../sys-usb/README.md#usage). +### How to use advanced audio processing capabilities + +You must run the `install-easyeffects` state as described in the installation +section. Instead of using `Pavucontrol`, use `Easy Effects` for advanced audio +processing capabilities. + ### How to use Bluetooth #### How to make the Bluetooth icon appear in the system tray diff --git a/salt/sys-audio/appmenus.sls b/salt/sys-audio/appmenus.sls new file mode 100644 index 0000000..a84a247 --- /dev/null +++ b/salt/sys-audio/appmenus.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus('tpl-' ~ sls_path) }} diff --git a/salt/sys-audio/appmenus.top b/salt/sys-audio/appmenus.top new file mode 100644 index 0000000..f39b9fe --- /dev/null +++ b/salt/sys-audio/appmenus.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-audio.appmenus diff --git a/salt/sys-audio/create.sls b/salt/sys-audio/create.sls index e43b4b0..cbcdd71 100644 --- a/salt/sys-audio/create.sls +++ b/salt/sys-audio/create.sls @@ -15,6 +15,12 @@ require: - sls: {{ slsdotpath }}.clone prefs: - audiovm: "" +features: +- set: + # editorconfig-checker-disable + - default-menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + - menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + # editorconfig-checker-enable {%- endload %} {{ load(defaults) }} @@ -46,10 +52,14 @@ features: - service.cups-browsed - service.meminfo-writer - service.qubes-updates-proxy +- set: + # editorconfig-checker-disable + - menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + # editorconfig-checker-enable {%- endload %} {{ load(defaults) }} -{% set audio_pcidevs = salt['grains.get']('pci_audio_devs', []) -%} +{% set audio_pcidevs = salt['grains.get']('pci_audio_devs', []) %} {% load_yaml as defaults -%} name: disp-{{ slsdotpath }} force: True @@ -78,6 +88,10 @@ features: - service.cups-browsed - service.meminfo-writer - service.qubes-updates-proxy +- set: + # editorconfig-checker-disable + - menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + # editorconfig-checker-enable tags: - add: - audiovm diff --git a/salt/sys-audio/files/admin/policy/default.policy b/salt/sys-audio/files/admin/policy/default.policy index f1b1258..292c55e 100644 --- a/salt/sys-audio/files/admin/policy/default.policy +++ b/salt/sys-audio/files/admin/policy/default.policy @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2023 - 2024 Yukikoo neowutran +# SPDX-FileCopyrightText: 2023 - 2024 Neowutran # SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. # # SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/salt/sys-audio/install-easyeffects.sls b/salt/sys-audio/install-easyeffects.sls new file mode 100644 index 0000000..227b2ac --- /dev/null +++ b/salt/sys-audio/install-easyeffects.sls @@ -0,0 +1,21 @@ +{# +SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] != 'dom0' -%} + +include: + - utils.tools.common.update + +"{{ slsdotpath }}-easyeffects-installed": + pkg.installed: + - require: + - sls: utils.tools.common.update + - install_recommends: False + - skip_suggestions: True + - pkgs: + - easyeffects + +{% endif -%} diff --git a/salt/sys-audio/install-easyeffects.top b/salt/sys-audio/install-easyeffects.top new file mode 100644 index 0000000..b5cfd37 --- /dev/null +++ b/salt/sys-audio/install-easyeffects.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'tpl-sys-audio': + - match: list + - sys-audio.install-easyeffects diff --git a/salt/sys-usb/README.md b/salt/sys-usb/README.md index 57ff02c..2810301 100644 --- a/salt/sys-usb/README.md +++ b/salt/sys-usb/README.md @@ -30,6 +30,7 @@ the USB controllers to different qubes is possible. sudo qubesctl top.enable sys-usb sudo qubesctl --targets=tpl-sys-usb state.apply sudo qubesctl top.disable sys-usb +sudo qubesctl state.apply sys-usb.appmenus ``` * State: @@ -39,6 +40,7 @@ sudo qubesctl top.disable sys-usb ```sh sudo qubesctl state.apply sys-usb.create sudo qubesctl --skip-dom0 --targets=tpl-sys-usb state.apply sys-usb.install +sudo qubesctl state.apply sys-usb.appmenus ``` diff --git a/salt/sys-usb/appmenus.sls b/salt/sys-usb/appmenus.sls new file mode 100644 index 0000000..a84a247 --- /dev/null +++ b/salt/sys-usb/appmenus.sls @@ -0,0 +1,8 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% from 'utils/macros/sync-appmenus.sls' import sync_appmenus -%} +{{ sync_appmenus('tpl-' ~ sls_path) }} diff --git a/salt/sys-usb/appmenus.top b/salt/sys-usb/appmenus.top new file mode 100644 index 0000000..de335fc --- /dev/null +++ b/salt/sys-usb/appmenus.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - sys-usb.appmenus diff --git a/salt/sys-usb/create.sls b/salt/sys-usb/create.sls index ae03ce2..ade9232 100644 --- a/salt/sys-usb/create.sls +++ b/salt/sys-usb/create.sls @@ -28,6 +28,12 @@ require: - sls: {{ slsdotpath }}.clone prefs: - audiovm: "" +features: +- set: + # editorconfig-checker-disable + - default-menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + - menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + # editorconfig-checker-enable {%- endload %} {{ load(defaults) }} @@ -60,6 +66,10 @@ features: - service.cups-browsed - service.meminfo-writer - service.qubes-updates-proxy +- set: + # editorconfig-checker-disable + - menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + # editorconfig-checker-enable {%- endload %} {{ load(defaults) }} @@ -144,6 +154,10 @@ features: - service.cups-browsed - service.meminfo-writer - service.qubes-updates-proxy +- set: + # editorconfig-checker-disable + - menu-items: "easyeffects.desktop pavucontrol.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes-start.desktop" # noqa: 204 + # editorconfig-checker-enable tags: - add: - usbvm diff --git a/salt/sys-usb/files/admin/policy/default.policy b/salt/sys-usb/files/admin/policy/default.policy index 146c520..d1b299b 100644 --- a/salt/sys-usb/files/admin/policy/default.policy +++ b/salt/sys-usb/files/admin/policy/default.policy @@ -1,3 +1,4 @@ +# SPDX-FileCopyrightText: 2023 - 2024 Neowutran # SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. # # SPDX-License-Identifier: AGPL-3.0-or-later