Fix UCA mistake and qvm-actions script

This commit is contained in:
Frédéric Pierret 2017-12-10 11:19:34 +01:00
parent 6226531bd5
commit c34a0a9e07
No known key found for this signature in database
GPG Key ID: 1DABC232BE02201E
2 changed files with 13 additions and 15 deletions

View File

@ -43,7 +43,7 @@
<icon>gtk-convert</icon> <icon>gtk-convert</icon>
<name>Convert in DisposableVM</name> <name>Convert in DisposableVM</name>
<unique-id>1507455488971315-6</unique-id> <unique-id>1507455488971315-6</unique-id>
<command>/usr/lib/qubes/qvm-actions.sh p %F</command> <command>/usr/lib/qubes/qvm-actions.sh pdf %F</command>
<description></description> <description></description>
<patterns>*.pdf</patterns> <patterns>*.pdf</patterns>
<other-files/> <other-files/>

View File

@ -1,50 +1,48 @@
#!/bin/bash #!/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) # Check if at least two arguments are provided: actions + file(s)
if [ "$#" -le 1 ]; then if [ "$#" -le 1 ]; then
echo "Not enough arguments provided. Aborting..." echo "Not enough arguments provided. Aborting..."
fi fi
# File(s) # Action
files=${*:2} action="$1"
shift
# copy and move handle a list of files where other actions don't # copy and move handle a list of files where other actions don't
case $1 in case "$action" in
copy) copy)
#shellcheck disable=SC2016 #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) move)
#shellcheck disable=SC2016 #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) img)
for file in $files for file in "$@"
do do
/usr/lib/qubes/qvm-convert-img.gnome "$file" /usr/lib/qubes/qvm-convert-img.gnome "$file"
done done
;; ;;
pdf) pdf)
for file in $files for file in "$@"
do do
/usr/lib/qubes/qvm-convert-pdf.gnome "$file" /usr/lib/qubes/qvm-convert-pdf.gnome "$file"
done done
;; ;;
openvm) openvm)
for file in $files for file in "$@"
do do
#shellcheck disable=SC2016 #shellcheck disable=SC2016
qvm-open-in-vm '$default' "$file" | zenity --notification --text "Opening $file in VM..." --timeout 3 & qvm-open-in-vm '$default' "$file" | zenity --notification --text "Opening $file in VM..." --timeout 3 &
done done
;; ;;
opendvm) opendvm)
for file in $files for file in "$@"
do 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 done
;; ;;
*) *)