2017-05-20 03:48:02 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2017-12-12 15:56:33 +01:00
|
|
|
echo "This service requires an argument" >&2
|
2017-05-20 03:48:02 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-12-12 15:56:33 +01:00
|
|
|
# make sure it has .desktop suffix, and only one of it
|
2017-05-20 03:48:02 +02:00
|
|
|
app_basename="${1%.desktop}.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
|
2017-09-30 04:45:31 +02:00
|
|
|
for subdir in $(find "$dir/applications" -type d | sort); do
|
2017-09-14 01:50:41 +02:00
|
|
|
if [ -f "$subdir/$app_basename" ]; then
|
|
|
|
exec qubes-desktop-run "$subdir/$app_basename"
|
|
|
|
fi
|
|
|
|
done
|
2017-05-20 03:48:02 +02:00
|
|
|
done
|
|
|
|
echo "applications/$app_basename not found in $XDG_DATA_HOME:$XDG_DATA_DIRS" >&2
|
|
|
|
exit 1
|