-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed icons path for distros #110
Comments
Yes that's not depends on Windows version. It's in the new updated Windows Store apps (i.e. Ubuntu18.04, Ubuntu16.04 etc). The executable And the |
I guess it will be possible to take the icon from the distro-specific wrapper then. |
In my system the executables under |
I found three ways to do this:
Which one do you choose? |
Why not collect the icons like it's done now, just from the wrapper exes instead of the .ico files?
|
I thought of extracting the icon from exe file. Can mintty takes icon from another exe file without extracting? I wonder if this is possible in wslbridge. That's why I asked @rprichard if wslbridge can execute |
For its own icon, for option |
Problem! To get the executable path in Appx installation, I've to use Another way I found is to get that path from registry. But there is also difference. For example Ubuntu 18.04:
|
In my testing pointing to |
Wow! That's a good idea 👍 |
Good idea to check for any executable. I would also look into doing this in https://github.com/mintty/wsltty/blob/master/mkshortcut.vbs#L39. Doing it in VBS can be easier than working in dash. |
The chaos of undocumented, unsystematic and ever-changing Windows interfaces is really bothering me. |
Wow yeah, didn't notice that. Just now I checked a couple other distros and |
I found a registry path that has the registry value: For example, Another way came in my mind. But I've tested it. If you see the |
I just opened the pull request above after testing it on my system, it worked for all distros on the store. It would be good if you could test it too @Biswa96. |
Why not? It's already in use anyway. About declspec, I have no idea. |
@caksoylar Does mintty requires administartor privilege to read AppxManifest.xml file? Beacuse Windows UWP platform may not allow to enter I've asked this question in Stack Overflow and someone said that it requires admin privileges. |
I know I had to get admin access to reach that location through Windows Explorer, but the script doesn't need admin access after that and it used to work before when The reason I was also asking for testing was because I already changed the owner of the folder from TrustedInstaller to my user in order to be able to access it through Explorer. There is a chance it might fail if you never did that step. |
Here I post a function which scans the WindowsApps Folder and find the matching folder name with Distro Name. Then it finds a EXE file in that folder. This doesn't require admin privilege. But one confusion Canonical launched Ubuntu, Ubuntu-1604, Ubuntu-1804 in Windows Store. Here is the function (click to open)void findExe(LPWSTR DistroName, LPWSTR PackageName, LPWSTR PackageExe) {
WCHAR Buffer[MAX_PATH], FirstFile[MAX_PATH];
HANDLE hFile;
WIN32_FIND_DATAW fileInfo;
ExpandEnvironmentStringsW(L"%ProgramFiles%\\WindowsApps", Buffer, MAX_PATH);
swprintf(FirstFile, MAX_PATH, L"%ls\\*", Buffer);
hFile = FindFirstFileW(FirstFile, &fileInfo);
if (hFile != INVALID_HANDLE_VALUE) {
do {
if (wcsstr(fileInfo.cFileName, DistroName) != 0) {
memcpy(PackageName, fileInfo.cFileName, MAX_PATH);
}
} while (FindNextFileW(hFile, &fileInfo) != 0);
}
swprintf(FirstFile, MAX_PATH, L"%ls\\%ls\\*", Buffer, PackageName);
hFile = FindFirstFileW(FirstFile, &fileInfo);
if (hFile != INVALID_HANDLE_VALUE) {
do {
if (wcsstr(fileInfo.cFileName, L"exe") != 0) {
memcpy(PackageExe, fileInfo.cFileName, MAX_PATH);
}
} while (FindNextFileW(hFile, &fileInfo) != 0);
}
} Here is the steps of how I found this idea, see my answer in Stack Overflow. Forgive me if you find any bad code 🙇 |
First loop: you look for the packagename by distroname. This is currently handled already, by looking up the registry. Has anythig changed about this mapping or can/should we stay with the implemented approach? |
There is an exception in my provided code. This is better understand by some examples of Windows Store installation:
Now it is clear that if someone provides only |
To repeat for clarification, all this recent fuss is just to find the proper icon again, right? Where is it in Kali Linux? (I'll install it myself later.) |
I'm inclined to consider it a bug of the distros if they hide their icon so deeply in cryptic configuration. |
The paths are not cryptic. With Windows .NET Framework and C#, it can be easily done. There are some deep connection between C# and raw C code. I'm not expert of C# (and don't like it). If anyone expert with C# and UWP, he/she can do it. |
I think it's cryptic, and kind of malicious,
I plan to release mintty really soon now, without further WSL-specific enhancements in the mintty code. |
Released 1.9.0, not supporting the new icon location. |
If the setup script is a setup, then why couldn't it just plainly extract the icons to a wsltty dir? |
Wsltty does not have icons of any WSL distribution. They come with the respective distribution. |
I think I was misunderstood.
What I am talking about is extracting the icons on-the-spot at shortcut configuration time, and then giving those extracted icons to shortcuts/mintty. |
That's what the config script is actually doing, with the old location of icons within a WSL distribution. Just some recent distributions have changed their deployment scheme so the icon cannot be found as easily anymore. There was a discussion about this and a proposal by Biswa already. But his icon extraction did not work for me, so I gave up at the time. |
OK, after having lost sight of this issue for a while, I've now merged the patch (#111), but changed it to do without powershell; using shell commands and matching instead. |
I notice that the distributions I have installed (Ubuntu, Ubuntu-18.04) don't have their icons in
$ProgramW6432/WindowsApps/$instdir/images/icon.ico
anymore. This seems to be the case both for the 1803 update and the insider preview I am running on build 17686. As a result, config-distros.sh cannot find the icons and falls back to the default WSL icon. However there are various icons present at$ProgramW6432/WindowsApps/$instdir/assets/
instead.The text was updated successfully, but these errors were encountered: