From c34a0a9e074da62c47490892b0784b554f7333fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret?= Date: Sun, 10 Dec 2017 11:19:34 +0100 Subject: [PATCH] Fix UCA mistake and qvm-actions script --- misc/uca_qubes.xml | 2 +- qubes-rpc/qvm-actions.sh | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/misc/uca_qubes.xml b/misc/uca_qubes.xml index f158e3cdb..2e4ad8d28 100644 --- a/misc/uca_qubes.xml +++ b/misc/uca_qubes.xml @@ -43,7 +43,7 @@ gtk-convert Convert in DisposableVM 1507455488971315-6 - /usr/lib/qubes/qvm-actions.sh p %F + /usr/lib/qubes/qvm-actions.sh pdf %F *.pdf diff --git a/qubes-rpc/qvm-actions.sh b/qubes-rpc/qvm-actions.sh index 7d762317f..691b3f26d 100755 --- a/qubes-rpc/qvm-actions.sh +++ b/qubes-rpc/qvm-actions.sh @@ -1,50 +1,48 @@ #!/bin/bash -# Allow us to handle filenames with spaces using newline separator from Thunar -IFS=' -' - # Check if at least two arguments are provided: actions + file(s) if [ "$#" -le 1 ]; then echo "Not enough arguments provided. Aborting..." fi -# File(s) -files=${*:2} +# Action +action="$1" + +shift # copy and move handle a list of files where other actions don't -case $1 in +case "$action" in copy) #shellcheck disable=SC2016 - qvm-copy-to-vm '$default' "$files" | zenity --notification --text="Copying files..." --timeout 3 + qvm-copy-to-vm '$default' "$@" | zenity --notification --text="Copying files..." --timeout 3 ;; move) #shellcheck disable=SC2016 - qvm-move-to-vm '$default' "$files" | zenity --notification --text="Moving files..." --timeout 3 + qvm-move-to-vm '$default' "$@" | zenity --notification --text="Moving files..." --timeout 3 ;; img) - for file in $files + for file in "$@" do /usr/lib/qubes/qvm-convert-img.gnome "$file" done ;; pdf) - for file in $files + for file in "$@" do /usr/lib/qubes/qvm-convert-pdf.gnome "$file" done ;; openvm) - for file in $files + for file in "$@" do #shellcheck disable=SC2016 qvm-open-in-vm '$default' "$file" | zenity --notification --text "Opening $file in VM..." --timeout 3 & done ;; opendvm) - for file in $files + for file in "$@" do - qvm-open-in-dvm "$files" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 & + qvm-open-in-dvm "$file" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 & done ;; *)