You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

4 years ago
  1. #!/usr/bin/bash
  2. export PATH="$PATH:./"
  3. # This is pretty fucking stupid.
  4. # https://stackoverflow.com/questions/2060284/how-to-use-the-xdg-mime-command
  5. echo "Before adding type:"
  6. xdg-mime query filetype test.zpl
  7. echo
  8. echo "Adding type:"
  9. sudo xdg-mime install --mode system ./zebra-zpl.xml
  10. echo
  11. echo "After adding type:"
  12. xdg-mime query filetype test.zpl
  13. echo
  14. echo "Adding desktop application:"
  15. cat << DESKTOP | sudo tee /usr/share/applications/zpl-printer-script.desktop
  16. [Desktop Entry]
  17. Name=gVim
  18. GenericName=ZPL Whatever
  19. Comment=Do something to ZPL files
  20. TryExec=zpl-printer-script
  21. Exec=zpl-printer-script
  22. Terminal=true
  23. Type=Application
  24. Keywords=Printer;ZPL;
  25. Icon=gvim
  26. Categories=Utility;
  27. StartupNotify=true
  28. MimeType=text/zpl
  29. DESKTOP
  30. echo
  31. echo "Setting default application:"
  32. sudo xdg-mime default zpl-printer-script.desktop text/zpl
  33. echo
  34. echo "Testing default application - should just cat the file:"
  35. xdg-open ./test.zpl
  36. echo
  37. echo "If that worked, put zpl-printer-script in your path, add a line to"
  38. echo "/etc/mime.types mapping text/zpl to the zpl extension, and try"
  39. echo "with your browser."