From 444672e999739c55c3d4a0bd55784051a5796e06 Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Fri, 24 May 2024 22:56:32 +0200 Subject: [PATCH] fix: prefer maim for screenshot - Maim causes no errors and has region and window capabilities; - Scrot region capture puts some weird borders when dragging the mouse; - Spectacle allows editing but is too feature rich (complicated); and - Xfce4-screenshooter does not allow selecting both region and window. Fixes: https://github.com/ben-grande/qusal/issues/51 --- salt/dom0/files/bin/qvm-screenshot | 24 +++++++++--------------- salt/dom0/screenshot.sls | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/salt/dom0/files/bin/qvm-screenshot b/salt/dom0/files/bin/qvm-screenshot index d2de191..cae16b4 100755 --- a/salt/dom0/files/bin/qvm-screenshot +++ b/salt/dom0/files/bin/qvm-screenshot @@ -55,8 +55,8 @@ File outcome: --move move file instead of copy Development mode: -D, --dialog-cmd dialog tool: kdialog, zenity - -S, --screenshot-cmd screenshot tool: spectacle, xfce4-screenshooter, - scrot, maim" + -S, --screenshot-cmd screenshot tool: maim, scrot, spectacle, + xfce4-screenshooter" exit 1 } @@ -156,26 +156,20 @@ if test -n "${screenshot_cmd_wanted}"; then zenity) zenity --info --text "${msg}";; kdialog) kdialog --msgbox "${msg}";; esac + msg="wanted screenshot program unsupported: ${screenshot_cmd_wanted}" + echo "[ERROR] ${msg}" exit 1 fi - case "${screenshot_cmd_wanted}" in - kdialog|zenity);; - *) - msg="wanted screenshot program unsupported: ${screenshot_cmd_wanted}" - echo "[ERROR] ${msg}" - exit 1 - ;; - esac screenshot_cmd="${screenshot_cmd_wanted}" else - if command -v spectacle >/dev/null; then + if command -v maim >/dev/null; then + screenshot_cmd="maim" + elif command -v scrot >/dev/null; then + screenshot_cmd="scrot" + elif command -v spectacle >/dev/null; then screenshot_cmd="spectacle" elif command -v xfce4-screenshooter >/dev/null; then screenshot_cmd="xfce4-screenshooter" - elif command -v scrot >/dev/null; then - screenshot_cmd="scrot" - elif command -v maim >/dev/null; then - screenshot_cmd="maim" fi if test -z "${screenshot_cmd}"; then msg="screenshot programs not found: spectacle xfce4-screenshooter scrot maim" diff --git a/salt/dom0/screenshot.sls b/salt/dom0/screenshot.sls index c39b560..82cecf8 100644 --- a/salt/dom0/screenshot.sls +++ b/salt/dom0/screenshot.sls @@ -19,7 +19,7 @@ include: - skip_suggestions: True - pkgs: - zenity - - scrot + - maim "{{ slsdotpath }}-screenshot-script": file.managed: