Hello there,
I have successfully managed to edit a file in a disposable with gedit
as shown in:
Now, instead of gedit
, I tried to use a custom script in the disposable, which updates a given text file in the original qube. Unfortunately, this did not work. Minimal example:
.desktop
file and custom script (disposable A):
mkdir -p .local/share/applications
cat <<'EOF' > .local/share/applications/open.desktop
[Desktop Entry]
Name=Update text file
Exec=/home/user/open.sh %f
Type=Application
MimeType=text/plain
EOF
cat <<'EOF' > $HOME/open.sh
#!/bin/sh
echo ARGUMENTS: "$@" >> /tmp/test.log
echo "updated!" > "$1" # guess, file updating with $1 is wrong
EOF
chmod u+x $HOME/open.sh
# Add default handler for `text/plain`
mkdir -p .config
xdg-mime default open.desktop text/plain
xdg-mime query default text/plain
In qube B:
echo foo > test.txt
qvm-open-in-vm @default test.txt # choose disposable A in ask dialog
I hoped to have test.txt
updated with content "updated!"
in qube B, which is not the case - content is still "foo"
. But the script is invoked, as /tmp/test.log
gets updated.
How might I change the code? Appreciate any help, thanks!