DISTRHO Plugin Framework
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.

41 lines
716B

  1. #!/bin/bash
  2. # Read FIFO argument from CLI
  3. FIFO=${1}
  4. shift
  5. if [ ! -e "${FIFO}" ]; then
  6. echo "Fifo file ${FIFO} does not exist, cannot run"
  7. exit 1
  8. fi
  9. # Start kdialog with all other arguments and get dbus reference
  10. dbusRef=$(kdialog "$@" 100)
  11. if [ $? -ne 0 ] || [ -z "${dbusRef}" ]; then
  12. echo "Failed to start kdialog"
  13. exit 1
  14. fi
  15. # Setup cancellation point for this script
  16. quitfn() {
  17. qdbus ${dbusRef} close 2>/dev/null
  18. }
  19. trap quitfn SIGINT
  20. trap quitfn SIGTERM
  21. # Read Fifo for new values or a quit message
  22. while read line <"${FIFO}"; do
  23. if echo "${line}" | grep -q "quit"; then
  24. break
  25. fi
  26. if ! qdbus ${dbusRef} Set "" value "${line}"; then
  27. break
  28. fi
  29. done
  30. # Cleanup
  31. rm -f "${FIFO}"
  32. quitfn