sane-open: launch some .desktop files even when they point outside ~/.local/share/applications

an unfortunate reality is that symlinks tend to get dereferenced too
early by other programs.
This commit is contained in:
Colin 2024-05-12 22:03:38 +00:00
parent d827235d31
commit 016df3ff74

View File

@ -101,8 +101,11 @@ open_desktopFile() {
# derefs to an application
local target="$(readlink "$path")"
if [ -z "$target" ]; then
log "open_desktopFile: '$path' does not deref to anything in ~/.local/share/applications: don't know how to launch"
exit 1
log "open_desktopFile: '$path' does not deref to anything in ~/.local/share/applications: falling back to heuristics"
# assume that the deref'd name matches the application name.
# there's nothing *guaranteeing* this, but i have yet to see it fail.
open_application "$(basename "$path")"
return
fi
if [[ "${target:0:1}" != "/" ]]; then
target="$(dirname "$path")/$target"