Skip to content

Commit

Permalink
fix: prefer maim for screenshot
Browse files Browse the repository at this point in the history
- 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: #51
  • Loading branch information
ben-grande committed May 24, 2024
1 parent b09ecdc commit 444672e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
24 changes: 9 additions & 15 deletions salt/dom0/files/bin/qvm-screenshot
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion salt/dom0/screenshot.sls
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include:
- skip_suggestions: True
- pkgs:
- zenity
- scrot
- maim
"{{ slsdotpath }}-screenshot-script":
file.managed:
Expand Down

0 comments on commit 444672e

Please sign in to comment.