I offer another method to add odrive sync engine comands to to the linux file manager (Dolphin / Nautilus).
The way I did this was to:
1 - create shell scripts that will do a odrive sync task. I created one (sync_odrive_file.sh) that does a sync command on a .cloudf or .cloud file
#!/bin/bash
eval odrive sync '${1}'
exit $?
save sync_odrive_file.sh somewhere and make it executable
I also created one (sync_odrive_folder.sh) that syncs all the files in the folder 1 level below it
#!/bin/bash
6>&1;output=“go”; while [ “$output” ]; do output=$(find “${1}” -maxdepth 1 -name “*.cloud” -exec python “$HOME/.odrive-agent/bin/odrive.py” sync “{}” ;|tee /dev/fd/6); done
exit $?
Save sync_odrive_folder.sh somewhere and make it executable
2 - create .desktop short cut that calls those shell script. Create them here: ~/.local/share/applications/
sync_odrive_file.sh-2.desktop
[Desktop Entry]
Exec=/usr/local/bin/sync_odrive_file.sh
Name=sync odrive place holder file
NoDisplay=true
Type=Application
sync_odrive_folder.sh.desktop
[Desktop Entry]
Exec=/usr/local/bin/sync_odrive_folder.sh
Name=sync odrive folder
NoDisplay=true
Type=Application
3 - associate the desktop short cut with the mime type of the odrive files in question. To do this Edit
~/.local/share/applications/mimeapps.list
and in the [Added Associations]
section add these lines to associate our new .desktop launcher short cuts with specific file types.
application/x-zerosize=sync_odrive_file.sh-2.desktop
inode/directory=sync_odrive_folder.sh.desktop
The mime type of the .cloudf or .cloud files are application/x-zerosize
The mime type of folders is inode/directory.
Now the file explorer app should have Open With > sync odrive folder when you right a click a folder
And it will have Open With > sync odrive place holder file when you right click on a .cloudf or .cloud file
Postscript: I found that on my kubuntu install that having the mimeapps.list run sync_odrive_folder.sh for inode/directory made it so that my system would not open folders when selected in Computer > Places. It would run the sync_odrive_folder.sh script instead.
A modified version of sync_odrive_folder.sh is needed to prevent that.:
#!/bin/bash
# test if the folder in in your odrive mount point path
if [[ "${1}" =~ "<your odrive mount point path>" ]]; then
# if it is run the sync job
6>&1;output="go"; while [ "$output" ]; do output=$(find "${1}" -maxdepth 1 -name "*.cloud" -exec python "$HOME/.odrive-agent/bin/odrive.py" sync "{}" \;|tee /dev/fd/6); done
else
# if it is not open the folder in dolphin
/usr/bin/dolphin ${1}
fi
exit $?