qvm-actions.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # Check if at least two arguments are provided: actions + file(s)
  3. if [ "$#" -le 1 ]; then
  4. echo "Not enough arguments provided. Aborting..."
  5. fi
  6. # Action
  7. action="$1"
  8. shift
  9. # copy and move handle a list of files where other actions don't
  10. case "$action" in
  11. copy)
  12. #shellcheck disable=SC2016
  13. qvm-copy-to-vm '$default' "$@" | zenity --notification --text="Copying files..." --timeout 3
  14. ;;
  15. move)
  16. #shellcheck disable=SC2016
  17. qvm-move-to-vm '$default' "$@" | zenity --notification --text="Moving files..." --timeout 3
  18. ;;
  19. img)
  20. for file in "$@"
  21. do
  22. /usr/lib/qubes/qvm-convert-img.gnome "$file"
  23. done
  24. ;;
  25. pdf)
  26. for file in "$@"
  27. do
  28. /usr/lib/qubes/qvm-convert-pdf.gnome "$file"
  29. done
  30. ;;
  31. openvm)
  32. for file in "$@"
  33. do
  34. #shellcheck disable=SC2016
  35. qvm-open-in-vm '$default' "$file" | zenity --notification --text "Opening $file in VM..." --timeout 3 &
  36. done
  37. ;;
  38. opendvm)
  39. for file in "$@"
  40. do
  41. qvm-open-in-dvm "$file" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 &
  42. done
  43. ;;
  44. *)
  45. echo "Unknown action. Aborting..."
  46. exit 1
  47. ;;
  48. esac