blob: 0e9b17824e7fca012ff46211e2b46a581360506e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
APPS=/usr/share/applications
ICONS=/usr/share/icons/hicolor
SIZE=48
echo "/$1" | grep ".desktop" | while read DESKTOPFILE; do
FDATA="$(cat $DESKTOPFILE)"
NAME="$(echo "$FDATA" | grep -i "^Name=" | head -n 1 | cut -d "=" -f 2-)"
EXEC="$(echo "$FDATA" | grep -i "^Exec=" | head -n 1 | cut -d "=" -f 2-)"
ICON="$(echo "$FDATA" | grep -i "^Icon=" | head -n 1 | cut -d "=" -f 2-)"
USETERM="$(echo "$FDATA" | grep -i "^Terminal=" | head -n 1 | cut -d "=" -f 2-)"
if [ "$USETERM" = "true" ]; then
EXEC="$TERM -e ""$EXEC"
fi
if [ "$ICON" != "" ]; then
ICON="$(find "$ICONS" | grep $SIZE"x"$SIZE | grep $ICON"[.]png" | head -n 1)"
if [ "$ICON" != "" -a "$EXEC" != "" -a "$NAME" != "" ]; then
echo "$NAME;$ICON;$EXEC"
else
ICON="$(find "$ICONS" | grep "scalable" | grep -E $ICON"[.](png|svg)" | head -n 1)"
if [ "$ICON" != "" -a "$EXEC" != "" -a "$NAME" != "" ]; then
echo "$NAME;$ICON;$EXEC"
fi
fi
fi
done | sort | uniq
|