qvm-actions.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. /usr/lib/qubes/qvm-copy-to-vm.gnome "$@"
  13. ;;
  14. move)
  15. /usr/lib/qubes/qvm-move-to-vm.gnome "$@"
  16. ;;
  17. img)
  18. for file in "$@"
  19. do
  20. /usr/lib/qubes/qvm-convert-img.gnome "$file"
  21. done
  22. ;;
  23. pdf)
  24. for file in "$@"
  25. do
  26. /usr/lib/qubes/qvm-convert-pdf.gnome "$file"
  27. done
  28. ;;
  29. openvm)
  30. for file in "$@"
  31. do
  32. #shellcheck disable=SC2016
  33. qvm-open-in-vm '$default' "$file" | zenity --notification --text "Opening $file in VM..." --timeout 3 &
  34. done
  35. ;;
  36. opendvm)
  37. for file in "$@"
  38. do
  39. qvm-open-in-dvm "$file" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 &
  40. done
  41. ;;
  42. viewdvm)
  43. for file in "$@"
  44. do
  45. qvm-open-in-dvm --view-only "$file" | zenity --notification --text "Opening $file in DisposableVM..." --timeout 3 &
  46. done
  47. ;;
  48. *)
  49. echo "Unknown action. Aborting..."
  50. exit 1
  51. ;;
  52. esac