core-agent-linux/qubes-rpc/qubes.StartApp
Pawel Marczewski 03621e5792
StartApp: remove workaround for .desktop suffix
The workaround is no longer necessary, and it breaks when
the app name itself contains .desktop (such as org.telegram.desktop).

Fixes QubesOS/qubes-issues#5408.
2020-01-07 13:06:57 +01:00

26 lines
731 B
Bash
Executable File

#!/bin/sh
if [ -z "$1" ]; then
echo "This service requires an argument" >&2
exit 1
fi
app_basename="$1.desktop"
# Based on XDG Base Directory Specification, Version 0.7
[ -n "$XDG_DATA_HOME" ] || XDG_DATA_HOME="$HOME/.local/share"
[ -n "$XDG_DATA_DIRS" ] || XDG_DATA_DIRS="/usr/local/share:/usr/share"
for dir in $(echo "$XDG_DATA_HOME:$XDG_DATA_DIRS" | tr : ' '); do
if ! [ -d "$dir/applications" ]; then
continue
fi
for subdir in $(find "$dir/applications" -type d | sort); do
if [ -f "$subdir/$app_basename" ]; then
exec qubes-desktop-run "$subdir/$app_basename"
fi
done
done
echo "applications/$app_basename not found in $XDG_DATA_HOME:$XDG_DATA_DIRS" >&2
exit 1