fix: install screenshot dependencies

Provided in the default Dom0 installation as it brings a much better
usability and small packages.

KDE ships with kdialog but without a screenshot utility.
Xfce ships with xfce4-screenshooter but without a dialog utility.
Scrot and Zenity are minimal tools that works on both DEs and are very
small packages.

Fixes: https://github.com/ben-grande/qusal/issues/22
This commit is contained in:
Ben Grande 2024-03-15 11:03:00 +01:00
parent 7c3d6ac7c0
commit 425748ab9e
5 changed files with 65 additions and 23 deletions

View File

@ -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

View File

@ -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/<Alt>Print" -n -s "qvm-screenshot --region"
- runas: {{ gui_user }}
- require:
- file: "{{ slsdotpath }}-screenshot-helper"
{% endif -%}

View File

@ -14,5 +14,6 @@ include:
- .kde
- .update-settings
- .xorg
- .screenshot
{% endif -%}

49
salt/dom0/screenshot.sls Normal file
View File

@ -0,0 +1,49 @@
{#
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
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/<Alt>Print" -n -s "qvm-screenshot --region"
- runas: {{ gui_user }}
- require:
- file: "{{ slsdotpath }}-screenshot-script"
{% endif -%}

10
salt/dom0/screenshot.top Normal file
View File

@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
base:
'dom0':
- match: nodegroup
- dom0.screenshot