Skip to content
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

Port All Apps plugin again #409

Merged
merged 13 commits into from
Feb 13, 2025
Merged

Port All Apps plugin again #409

merged 13 commits into from
Feb 13, 2025

Conversation

stefansjfw
Copy link
Collaborator

@stefansjfw stefansjfw commented Feb 6, 2025

MISSING:

  • Support arguments passing
    Live app detection (newly installed apps, updates, etc..)
    Localization
    Cleanup

Argument passing requires conversion to DynamicListPage and is low priority. Let's merge this first and I'll work on this as a follow up

Closes #76

@stefansjfw stefansjfw marked this pull request as draft February 6, 2025 10:16
@stefansjfw stefansjfw marked this pull request as ready for review February 12, 2025 10:52
@stefansjfw
Copy link
Collaborator Author

@zadjii-msft FYI Ready for review

@stefansjfw stefansjfw changed the title [WIP] Port All Apps plugin again Port All Apps plugin again Feb 12, 2025
Copy link
Owner

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to just sign off on this since it's 99% just porting remaining code that I had commented out or ignored back in June, but I want to give it a test run before we merge it in

that being said - this looks awesome and I'm excited to see everything hopefully finally have the right subtitles again


// ExePath = app.FullPath,
IsPackaged = true,
Commands = app.Commands,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝: UWPs just use app.Commands, Win32's need app.GetCommands()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear this was aligned! At some point at least! :) GetCommands() introduced in UWP apps as well.

};

if (string.IsNullOrEmpty(app.UserModelId))
if (!_app.IsPackaged)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can collapse these two branches down since they're the same now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah. of course :)

public OpenInConsoleCommand(string target)
{
Name = Resources.open_path_in_console;
Icon = new IconInfo("\ue838");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can probably save some memory by having a single static instance of this IconInfo for all OpenInConsoleCommand's, but who knows if that's significant

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


public RunAsUserCommand(string target, string parentDir)
{
Name = "Run as different user";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this one need to get localized too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh, nice catch. there are few more. fixed


namespace Microsoft.CmdPal.Ext.Apps.Commands;

// NOTE this is pretty close to what we'd put in the SDK
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this comment can probably go away now - I think it's been copy/pasted a bunch of times since the original hackathon for this project 10 months ago

OtherUser,
}

public static ProcessStartInfo GetProcessStartInfo(string target, string parentDir, string programArguments, RunAsType runAs = RunAsType.None)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha you know, I think I already pilfered a bunch of this into ShellHelpers in the toolkit. I should file a future todo to just de-dupe all the calls that do this everywhere

@stefansjfw
Copy link
Collaborator Author

fixed all. But do not merge yet! I see some issues with icons for Packaged apps.. working on it

@stefansjfw
Copy link
Collaborator Author

All good. Fixed packaged apps icon load. Give it a test end let me know how it goes :)

@lauren-ciha
Copy link

I forget if it was mentioned already, but there's a misalignment on the app subtitles. For example,
image
opens Google Chrome (as expected), but has a Visual Studio subtitle.

@zadjii-msft
Copy link
Owner

I forget if it was mentioned already, but there's a misalignment on the app subtitles.

uhg then that's definitely the same list virtualization bug we were seeing with the icons. At least that wasn't unique to the hack job for apps I had before, but yikes we need to fix this.

oh my god wait I think I have an idea. I have a theory - it might be that we're never PropertyChanged'ing the items when we fetch their properties - it was something I noticed in #388. I've got a branch, gimme a bit to go build this with that branch merged

@zadjii-msft
Copy link
Owner

Okay no, it wasn't that.

I think there might be two problems, and I'm not sure they're separate yet.

  1. Problem the first: The icon loading is definitely fucky. I think this probably comes down to the async loading for random access stream icons. I'm betting that the async-ness of loading them, mixed with the list virtualization, causes the icons to get loaded weird. Just now, I had the event viewer icon show up on the "web search" command on the main page, when I started typing "chro".
  2. Problem the second: the subtitles still not lining up with the app. This I don't know what's up yet.

@zadjii-msft
Copy link
Owner

  1. Commenting out the stream icons from the apps at least doesn't leave everything exploded. It leaves almost everything without an icon, but I'm guessing that this is the cause of the wrong icons.
  2. That being said, commenting out the icons doesn't fix the broken subtitles. That's still messed up. It also seems... stable. Like, if I go to tall apps, filter for like, "firefox", see that it's got the wrong subtitle, then go try to search for firefox on the root view, it'll have the same wrong subtitle. Problem is that it's not stable across reboots, so you can't just always set a breakpoint on like, "Title==Firefox" and see what's up -sometimes firefox will still be right. This is tricky

@zadjii-msft
Copy link
Owner

oh it's so obvious (in retrospect)

ShellLinkHelper is stored as a static singleton. It's used to retrieve the target path for a Lnk, then get the description out of it. Problem is, we enumerate the apps in parallel. So one app might RetreieveTargetPath, then before we get the description out of it - the next app comes along and stomps it

@zadjii-msft
Copy link
Owner

zadjii-msft commented Feb 12, 2025

okay affb26f fixes the subtitles I think

@zadjii-msft
Copy link
Owner

zadjii-msft commented Feb 12, 2025

and 51b162a fixes the icon loading.

Thanks for your patience ☺️

Feel free to just merge those two in here.

The only other thing that I'd want to double check is that it feels like the main page no longer reports the initial app load as part of its IsLoading. In the past it would have the loading bar spin while it was doing both the extension and the app load in the background, but now I think doesnt. Need to double check that (probably tomorrow morning)

@lauren-ciha
Copy link

lauren-ciha commented Feb 12, 2025

When I tried dev/migrie/f/apps-and-propchanged, the icons and subtitles worked as expected.

I think I figured out why Access was opening when I clicked on the All Apps command in the main list page. I had turned double clicking off and accidentally clicked "All apps" twice. The first click opened All Apps and the second click opened Access before the All Apps page loaded. This bug only happens occasionally. Most times, a double click just opened the All Apps page.

It took a few tries (the app opens at the 35 second mark). The top left icon also had some interesting glitching as I was clicking back and forth:
double_click_app_opening

@stefansjfw
Copy link
Collaborator Author

Feel free to just merge those two in here.

Just did

@zadjii-msft
Copy link
Owner

Mmk so I pushed a commit just now that should have the main page also show the loading state of the apps again. Definitely takes a bit longer to settle now, but that's mostly because there are so many apps we're enumerating now.

We can work on porting that settings file to a JsonSettingsManager like we have for the other extensions later. This is close enough 👍

@zadjii-msft zadjii-msft merged commit 38a7f18 into main Feb 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PowerToys app search parity (rewrite existing implementation)
4 participants