core-agent-linux/qubes-rpc/qvm-actions.sh

55 lines
1.4 KiB
Bash
Raw Normal View History

2017-11-17 13:37:37 +01:00
#!/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}
# copy and move handle a list of files where other actions don't
case $1 in
copy)
2017-11-22 13:31:33 +01:00
#shellcheck disable=SC2016
qvm-copy-to-vm '$default' "$files" | zenity --notification --text="Copying files..." --timeout 3
2017-11-17 13:37:37 +01:00
;;
move)
2017-11-22 13:31:33 +01:00
#shellcheck disable=SC2016
qvm-move-to-vm '$default' "$files" | zenity --notification --text="Moving files..." --timeout 3
2017-11-17 13:37:37 +01:00
;;
img)
for file in $files
do
2017-11-22 13:31:33 +01:00
/usr/lib/qubes/qvm-convert-img.gnome "$file"
2017-11-17 13:37:37 +01:00
done
;;
pdf)
for file in $files
do
2017-11-22 13:31:33 +01:00
/usr/lib/qubes/qvm-convert-pdf.gnome "$file"
2017-11-17 13:37:37 +01:00
done
;;
openvm)
for file in $files
do
2017-11-22 13:31:33 +01:00
#shellcheck disable=SC2016
qvm-open-in-vm '$default' "$file" | zenity --notification --text "Opening $file in VM..." --timeout 3 &
2017-11-17 13:37:37 +01:00
done
;;
opendvm)
for file in $files
do
2017-11-22 13:31:33 +01:00
qvm-open-in-dvm "$files" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 &
2017-11-17 13:37:37 +01:00
done
;;
*)
echo "Unknown action. Aborting..."
exit 1
;;
esac