diff --git a/salt/dom0/README.md b/salt/dom0/README.md index ce3e63f..b20872f 100644 --- a/salt/dom0/README.md +++ b/salt/dom0/README.md @@ -34,6 +34,11 @@ If you need to develop in Dom0, install some goodies (bare bones): sudo qubesctl state.apply dom0.install-dev ``` +To forward ports from qubes to the external world: +```sh +sudo qubesctl state.apply dom0.port-forward +``` + ## Usage You may have noticed the desktop experience in Dom0 has enhanced. You are diff --git a/salt/dom0/helpers.sls b/salt/dom0/helpers.sls index bc3f304..098c739 100644 --- a/salt/dom0/helpers.sls +++ b/salt/dom0/helpers.sls @@ -35,27 +35,4 @@ SPDX-License-Identifier: AGPL-3.0-or-later - group: root - makedirs: True -"{{ slsdotpath }}-screenshot-helper": - file.managed: - - name: /usr/local/bin/qvm-screenshot - - source: salt://{{ slsdotpath }}/files/bin/qvm-screenshot - - mode: "0755" - - user: root - - group: root - - makedirs: True - -## TODO: KDE shortcuts -{% set gui_user = salt['cmd.shell']('groupmems -l -g qubes') -%} -{% set gui_user_id = salt['cmd.shell']('id -u ' ~ gui_user) -%} -"{{ slsdotpath }}-screenshot-keyboard-shortcuts-xfce": - cmd.run: - - name: | - DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/{{ gui_user_id }}/bus" - export DBUS_SESSION_BUS_ADDRESS - xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/Print" -n -s "qvm-screenshot --fullscreen" - xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/Print" -n -s "qvm-screenshot --region" - - runas: {{ gui_user }} - - require: - - file: "{{ slsdotpath }}-screenshot-helper" - {% endif -%} diff --git a/salt/dom0/init.sls b/salt/dom0/init.sls index 20df0c6..032632b 100644 --- a/salt/dom0/init.sls +++ b/salt/dom0/init.sls @@ -14,5 +14,6 @@ include: - .kde - .update-settings - .xorg + - .screenshot {% endif -%} diff --git a/salt/dom0/screenshot.sls b/salt/dom0/screenshot.sls new file mode 100644 index 0000000..76d0089 --- /dev/null +++ b/salt/dom0/screenshot.sls @@ -0,0 +1,49 @@ +{# +SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +{% if grains['nodename'] == 'dom0' -%} + +"{{ slsdotpath }}-screenshot-updated": + pkg.uptodate: + - refresh: True + +"{{ slsdotpath }}-screenshot-installed": + pkg.installed: + - require: + - pkg: "{{ slsdotpath }}-screenshot-updated" + - refresh: True + - install_recommends: False + - skip_suggestions: True + - pkgs: + - zenity + - scrot + +"{{ slsdotpath }}-screenshot-script": + file.managed: + - name: /usr/local/bin/qvm-screenshot + - source: salt://{{ slsdotpath }}/files/bin/qvm-screenshot + - mode: "0755" + - user: root + - group: root + - makedirs: True + - require: + - pkg: "{{ slsdotpath }}-screenshot-installed" + +## TODO: KDE shortcuts +{% set gui_user = salt['cmd.shell']('groupmems -l -g qubes') -%} +{% set gui_user_id = salt['cmd.shell']('id -u ' ~ gui_user) -%} +"{{ slsdotpath }}-screenshot-keyboard-shortcuts-xfce": + cmd.run: + - name: | + DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/{{ gui_user_id }}/bus" + export DBUS_SESSION_BUS_ADDRESS + xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/Print" -n -s "qvm-screenshot --fullscreen" + xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/Print" -n -s "qvm-screenshot --region" + - runas: {{ gui_user }} + - require: + - file: "{{ slsdotpath }}-screenshot-script" + +{% endif -%} diff --git a/salt/dom0/screenshot.top b/salt/dom0/screenshot.top new file mode 100644 index 0000000..d636f82 --- /dev/null +++ b/salt/dom0/screenshot.top @@ -0,0 +1,10 @@ +{# +SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. + +SPDX-License-Identifier: AGPL-3.0-or-later +#} + +base: + 'dom0': + - match: nodegroup + - dom0.screenshot