1
0
mirror of https://github.com/mintty/wsltty.git synced 2024-10-05 18:31:04 +01:00

do without powershell to determine the exe with the icon

This commit is contained in:
mintty 2019-05-28 22:31:08 +02:00
parent bac370cfce
commit 7776748081

View File

@ -104,6 +104,24 @@ fi
lxss="/HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Lxss" lxss="/HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Lxss"
schema="/HKEY_CURRENT_USER/Software/Classes/Local Settings/Software/Microsoft/Windows/CurrentVersion/AppModel/SystemAppData" schema="/HKEY_CURRENT_USER/Software/Classes/Local Settings/Software/Microsoft/Windows/CurrentVersion/AppModel/SystemAppData"
appex () {
while read line
do
case "$line" in
*Application*Executable*)
for item in $line
do case "$item" in
Executable=*)
eval $item
echo "$Executable"
break;;
esac
done
break;;
esac
done < $*
}
config () { config () {
guid="$1" guid="$1"
ok=false ok=false
@ -125,14 +143,10 @@ config () {
if package=`regtool -q get "$lxss/$guid/PackageFamilyName"` if package=`regtool -q get "$lxss/$guid/PackageFamilyName"`
then then
instdir=`regtool get "$schema/$package/Schemas/PackageFullName"` instdir=`regtool get "$schema/$package/Schemas/PackageFullName"`
# get actual executable path (may not match $distro) from app manifest
# get actual executable path (may not match $distro) from the app manifest
manifest="$ProgramW6432/WindowsApps/$instdir/AppxManifest.xml" manifest="$ProgramW6432/WindowsApps/$instdir/AppxManifest.xml"
psh_cmd='([xml]$(Get-Content '"\"$manifest\""')).Package.Applications.Application.Executable' psh_cmd='([xml]$(Get-Content '"\"$manifest\""')).Package.Applications.Application.Executable'
executable=`powershell "$psh_cmd"` executable=`appex "$manifest"`
# remove trailing newline that above command introduces
executable="${executable%"${executable##*[![:space:]]}"}"
if [ -r "$ProgramW6432/WindowsApps/$instdir/$executable" ] if [ -r "$ProgramW6432/WindowsApps/$instdir/$executable" ]
then icon="%PROGRAMFILES%/WindowsApps/$instdir/$executable" then icon="%PROGRAMFILES%/WindowsApps/$instdir/$executable"
elif [ -r "$ProgramW6432/WindowsApps/$instdir/images/icon.ico" ] elif [ -r "$ProgramW6432/WindowsApps/$instdir/images/icon.ico" ]