From ac64b001fbc7036a5cb76eb6de7aecce279a4bcb Mon Sep 17 00:00:00 2001 From: Ryan Greenup Date: Thu, 16 Jul 2020 00:04:50 +1000 Subject: [PATCH] BROKEN Dex Requires realpath --- bin/cadmus | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/cadmus b/bin/cadmus index 2304492..8aef215 100755 --- a/bin/cadmus +++ b/bin/cadmus @@ -106,12 +106,23 @@ arguments () { function NoteFind() { echo "Running NoteFind.sh" - FILE="$(NoteFind.sh "${@:-}")" + FILES="$(NoteFind.sh "${@:-}")" - - - if [ "$FILE" != "" ]; then - xdg-open $FILE + ## Only try and open something that is non-empty + if [ "$FILES" != "" ]; then + ## xdg-open doesn't accept multiple arguments, so create commands and + ## pipe them back into bash This opens all files in the same tab with + ## VSCode and Atom The individual selections can also be passed off with + ## the keybindings to emacsclient. + # Using XDG-OPEN +# echo "${FILES}" | sed s/^/xdg-open\ \"/ | sed s/$/\"/ | bash +# echo "${FILES}" | sed -e s+^+\"+ -e s+$+\"+ | xargs -n 1 xdg-open +# # Getting the .desktop file and cutting off the Extension + dex "$(xdg-mime query default text/markdown)" $FILES + ## This might break if the .desktop file doesn't have the same + ## name as the binary. + ## This appears to be a standard though + ## https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#file-naming fi }