Include .desktop path in app listings.
Slightly faster lookups, but mostly to disambiguate between apps with identical names.
This commit is contained in:
parent
ccf3caee81
commit
5df78e6c8a
|
@ -54,18 +54,22 @@ windows() {
|
|||
fi
|
||||
}
|
||||
|
||||
function read_app {
|
||||
echo "app $(grep '^Name=' "$1" | grep -Eiv "$IGNORED_APPS" | sed 's/Name=//' | head -n 1) <= $1"
|
||||
}
|
||||
|
||||
read_apps() {
|
||||
export -f read_app
|
||||
export APP_LOCATIONS
|
||||
export IGNORED_APPS
|
||||
|
||||
if [[ "$1" == "--now" ]]; then
|
||||
find $APP_LOCATIONS -name '*.desktop' -exec grep '^Name=' {} \; |
|
||||
egrep -iv "$IGNORED_APPS" |
|
||||
sed 's/Name=/app /'
|
||||
# shellcheck disable=SC2086
|
||||
find $APP_LOCATIONS -name '*.desktop' -exec bash -c 'read_app "{}"' \;
|
||||
return $?
|
||||
fi
|
||||
cat "$CACHE_FILE"
|
||||
# shellcheck disable=SC2086
|
||||
nohup find $APP_LOCATIONS -name '*.desktop' -exec grep '^Name=' {} \; |
|
||||
egrep -iv "$IGNORED_APPS" |
|
||||
sed 's/Name=/app /' > "$CACHE_FILE" &
|
||||
nohup find $APP_LOCATIONS -name '*.desktop' -exec bash -c 'read_app "{}"' \;
|
||||
}
|
||||
|
||||
read_snap_apps() {
|
||||
|
@ -95,14 +99,8 @@ add-recent() {
|
|||
}
|
||||
|
||||
open_app() {
|
||||
app="$(echo "$1" | cut -c 5-)"
|
||||
# shellcheck disable=SC2086
|
||||
find $APP_LOCATIONS -name '*.desktop' | while read -r f; do
|
||||
if grep "Name=$app" "$f" &> /dev/null; then
|
||||
setsid exo-open "$f" >/dev/null 2>&1 </dev/null &
|
||||
return
|
||||
fi
|
||||
done
|
||||
desktop_file="$(echo "$1" | sed 's/app .*<= *//')"
|
||||
setsid exo-open "$desktop_file" >/dev/null 2>&1 </dev/null &
|
||||
}
|
||||
|
||||
list_files() {
|
||||
|
|
Loading…
Reference in New Issue