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

59 lines
1.5 KiB
Bash
Raw Normal View History

2017-11-17 13:37:37 +01:00
#!/bin/bash
# Check if at least two arguments are provided: actions + file(s)
if [ "$#" -le 1 ]; then
echo "Not enough arguments provided. Aborting..."
fi
2017-12-10 11:19:34 +01:00
# Action
action="$1"
shift
2017-11-17 13:37:37 +01:00
# copy and move handle a list of files where other actions don't
2017-12-10 11:19:34 +01:00
case "$action" in
2017-11-17 13:37:37 +01:00
copy)
2017-11-22 13:31:33 +01:00
#shellcheck disable=SC2016
2017-12-10 11:19:34 +01:00
qvm-copy-to-vm '$default' "$@" | 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
2017-12-10 11:19:34 +01:00
qvm-move-to-vm '$default' "$@" | zenity --notification --text="Moving files..." --timeout 3
2017-11-17 13:37:37 +01:00
;;
img)
2017-12-10 11:19:34 +01:00
for file in "$@"
2017-11-17 13:37:37 +01:00
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)
2017-12-10 11:19:34 +01:00
for file in "$@"
2017-11-17 13:37:37 +01:00
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)
2017-12-10 11:19:34 +01:00
for file in "$@"
2017-11-17 13:37:37 +01:00
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)
2017-12-10 11:19:34 +01:00
for file in "$@"
2017-11-17 13:37:37 +01:00
do
2017-12-10 11:19:34 +01:00
qvm-open-in-dvm "$file" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 &
2017-11-17 13:37:37 +01:00
done
;;
viewdvm)
for file in "$@"
do
qvm-open-in-dvm --view-only "$file" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 &
done
;;
2017-11-17 13:37:37 +01:00
*)
echo "Unknown action. Aborting..."
exit 1
;;
esac