Last active
October 10, 2023 06:36
-
-
Save Roy-Orbison/ada4455eea3aef9b276f0b1ef448d212 to your computer and use it in GitHub Desktop.
Simple link from Dolphin file manager to file/folder on Dropbox.com using Maestral GUI under KDE. The .desktop file goes under `~/.local/share/kio/servicemenus/` and the script should be anywhere in your PATH, I used `~/.local/bin/`. Script depends on realpath, xdg-open, notify-send, and of course maestral.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if maestral status | grep -qFi 'not running'; then | |
err='Maestral not running' | |
elif ! droot="`maestral config get path`"; then | |
err='Maestral not found' | |
elif ! real="`realpath -eLPq "$1"`"; then | |
err='Path does not exist' | |
elif [[ ${#real} -le ${#droot} || "${real:0:${#droot}}" != "$droot" ]]; then | |
err="The path $real is not below the Dropbox root directory $droot" | |
else | |
if [[ -d "$real" ]]; then | |
pfx=home | |
else | |
pfx=preview | |
fi | |
xdg-open "https://www.dropbox.com/$pfx${real:${#droot}}" | |
exit | |
fi | |
notify-send Error "$err" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Type=Service | |
X-KDE-ServiceTypes=KonqPopupMenu/Plugin | |
MimeType=inode/directory;application/octet-stream; | |
Actions=maestralOpenOnDropboxSite | |
[Desktop Action maestralOpenOnDropboxSite] | |
Name=Open on Dropbox website (via Maestral) | |
Icon=link | |
Exec=maestral-open-dropbox.sh %f; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment