From 7d36f209916b9a3169bd349bac979ce33f8f9728 Mon Sep 17 00:00:00 2001 From: Alfredo Pinto Date: Thu, 26 Nov 2026 22:30:16 -0800 Subject: [PATCH 1/2] Apps de la Store sin AUMID: nombre e icono de su paquete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WhatsApp no dice su AUMID en la ventana y su ejecutable se describe como WhatsApp.Root, con un icono genérico. El AUMID sale del AppxManifest.xml del paquete y con él Windows da el nombre y el icono de Inicio. --- src/FocusWShell.App/AppIcons.cs | 4 ++ src/FocusWShell.Win32/AppLauncher.cs | 2 + src/FocusWShell.Win32/PackagedApps.cs | 84 +++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 src/FocusWShell.Win32/PackagedApps.cs diff --git a/src/FocusWShell.App/AppIcons.cs b/src/FocusWShell.App/AppIcons.cs index bb7ee13..8dd948b 100644 --- a/src/FocusWShell.App/AppIcons.cs +++ b/src/FocusWShell.App/AppIcons.cs @@ -35,7 +35,11 @@ public static class AppIcons // Si la ruta quedó vieja (la app se actualizó estando cerrada), la de la versión nueva. var path = app.ExecutablePath is { } stored ? ExecutableLocator.Resolve(stored) ?? stored : null; + // Una app de la Store sin AUMID en su ventana (WhatsApp): el icono de su paquete, el de Inicio. El de su + // ejecutable puede ser uno genérico. + var packaged = app.Aumid is null ? PackagedApps.AumidFor(path) : null; var icon = (app.Aumid is { } aumid ? FromShell(ShellIcon.ForAumid(aumid, Size)) : null) + ?? (packaged is not null ? FromShell(ShellIcon.ForAumid(packaged, Size)) : null) ?? (path is not null ? FromExecutable(path) ?? FromShell(ShellIcon.For(path, Size)) : null) ?? (ExecutablePaths.GuessPackagedAumid(path) is { } guessed ? FromShell(ShellIcon.ForAumid(guessed, Size)) : null); Cache[key] = icon; diff --git a/src/FocusWShell.Win32/AppLauncher.cs b/src/FocusWShell.Win32/AppLauncher.cs index 1c248c4..a9096fa 100644 --- a/src/FocusWShell.Win32/AppLauncher.cs +++ b/src/FocusWShell.Win32/AppLauncher.cs @@ -48,6 +48,8 @@ public static class AppLauncher /// public static string? FriendlyName(string? executablePath, string? aumid) => (aumid is not null && (aumid.Contains('!', StringComparison.Ordinal) || IsWebApp(aumid)) ? PackagedName(aumid) : null) + // Una app de la Store cuya ventana no dice su AUMID (WhatsApp): el de su paquete. + ?? (aumid is null && PackagedApps.AumidFor(executablePath) is { } packaged ? PackagedName(packaged) : null) ?? FriendlyName(executablePath); /// Si el AUMID es de una app web instalada desde Chrome o Edge (Chrome._crx_…). diff --git a/src/FocusWShell.Win32/PackagedApps.cs b/src/FocusWShell.Win32/PackagedApps.cs new file mode 100644 index 0000000..d99ca7d --- /dev/null +++ b/src/FocusWShell.Win32/PackagedApps.cs @@ -0,0 +1,84 @@ +using System.Collections.Concurrent; +using System.Xml; + +namespace FocusWShell.Win32; + +/// +/// Las apps de la Store (empaquetadas en WindowsApps) cuya ventana no dice su AUMID, como WhatsApp: su +/// ejecutable se describe con un nombre interno («WhatsApp.Root») y trae un icono genérico. Su AUMID sale del +/// paquete: la familia (nombre e id del editor, de la carpeta) y el id de la aplicación cuyo ejecutable es ese, +/// leído de su AppxManifest.xml. Con él, Windows da el nombre y el icono que muestra en Inicio. +/// +public static class PackagedApps +{ + private static readonly ConcurrentDictionary Cache = new(StringComparer.OrdinalIgnoreCase); + + /// El AUMID de un ejecutable empaquetado, o null si no lo es o no se encuentra. + public static string? AumidFor(string? executablePath) + { + if (string.IsNullOrWhiteSpace(executablePath)) + { + return null; + } + + return Cache.GetOrAdd(executablePath, Find); + } + + private static string? Find(string path) + { + var parts = path.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); + int index = Array.FindIndex(parts, p => string.Equals(p, "WindowsApps", StringComparison.OrdinalIgnoreCase)); + if (index < 0 || index + 2 >= parts.Length) + { + return null; + } + + // Nombre_Versión_Arquitectura_Recurso_Editor → familia Nombre_Editor. + var fields = parts[index + 1].Split('_'); + if (fields.Length < 5 || fields[0].Length == 0 || fields[^1].Length == 0) + { + return null; + } + + var packageFolder = string.Join(Path.DirectorySeparatorChar, parts.Take(index + 2)); + var relative = string.Join('\\', parts.Skip(index + 2)); + var appId = AppIdFor(Path.Combine(packageFolder, "AppxManifest.xml"), relative); + return appId is null ? null : $"{fields[0]}_{fields[^1]}!{appId}"; + } + + /// El id de la aplicación del manifiesto cuyo Executable es ese archivo. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031", Justification = "Un manifiesto ilegible: la app sigue con el nombre y el icono de su ejecutable.")] + private static string? AppIdFor(string manifest, string relativeExe) + { + try + { + if (!File.Exists(manifest)) + { + return null; + } + + var doc = new XmlDocument { XmlResolver = null }; + using (var reader = XmlReader.Create(manifest, new XmlReaderSettings { DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null })) + { + doc.Load(reader); + } + + string Normal(string p) => p.Replace('/', '\\').TrimStart('\\'); + foreach (XmlElement app in doc.GetElementsByTagName("Application", "*")) + { + var exe = app.GetAttribute("Executable"); + if (exe.Length > 0 && string.Equals(Normal(exe), Normal(relativeExe), StringComparison.OrdinalIgnoreCase)) + { + var id = app.GetAttribute("Id"); + return id.Length > 0 ? id : null; + } + } + + return null; + } + catch (Exception) + { + return null; + } + } +} From 56f99ffa72bc704a9062e9f6315c58c5595e0435 Mon Sep 17 00:00:00 2001 From: Alfredo Pinto Date: Thu, 26 Nov 2026 22:31:46 -0800 Subject: [PATCH 2/2] CHANGELOG: nombre e icono de las apps de la Store --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb3aacd..0c035ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to FocusWShell. Each release has its notes in [`.github/rele Todos los cambios importantes de FocusWShell. Cada versión tiene sus notas en [`.github/release-notes/`](.github/release-notes/). +## Unreleased / Sin publicar + +- Fixed: Store apps whose window does not give its app ID (WhatsApp) showed an internal name ("WhatsApp.Root") and a generic icon. They now take the name and icon of the Start menu. / Corregido: las apps de la Store cuya ventana no da su id de app (WhatsApp) salían con un nombre interno («WhatsApp.Root») y un icono genérico. Ahora toman el nombre y el icono del menú Inicio. + ## 0.5.0-alpha Sites in Activity, private windows kept private, and apps that go back to their panel however you open them. / Sitios en Actividad, ventanas privadas que se quedan privadas, y apps que vuelven a su panel las abras como las abras.