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

Default app aliases in windows #69

Open
archit9169 opened this issue Jul 21, 2020 · 4 comments
Open

Default app aliases in windows #69

archit9169 opened this issue Jul 21, 2020 · 4 comments

Comments

@archit9169
Copy link

Since last windows update or so, windows gave users a new feature named "App Execution Alias", which as the name implies gives users some control of default command line aliases integrated in the windows itself. Now users can turn on or off a certain alias if more than one version of an app is available, or more than one app uses the same alias.

And then they decided to include python in it, and that's where stuff gets weird. I installed python using Zero Install, created an alias name python, and then tried running it on command prompt. I expected it to launch python terminal, instead it redirects me to windows store to install python from there. Now as i said before it can be turned on or off. So i turned it off and everything works normally.

So this issue is created with that in mind, since this is very messy if users don't know that windows alias might screw them over.

Solutions:

  1. Go to Settings > Apps > App Execution Alias under Apps & Features > Turn Off the alias that you want to use via Zero Install.
  2. Give a feature in Zero Install that disables certain windows aliases when apps are integrated using Zero Install like python.
  3. Integrate Zero Install aliases with Windows Aliases and then user can either manually manage those aliases via windows settings or Zero Install settings, or Zero Install aliases will have priority over windows aliases.

Any other suggestions?

@archit9169 archit9169 changed the title Default app aliases Default app aliases in windows Jul 21, 2020
@bastianeicher
Copy link
Member

I've also run into this issue. Quite annoying.

Windows places these "app execution aliases" in %localappdata%\Microsoft\WindowsApps and puts that directory as the first entry in the PATH environment variable.

Zero Install places its aliases in %appdata%\0install.net\desktop-integration\aliases and adds that directory as the last entry in the PATH environment variable.

I could modify Zero Install to put its alias directory as the first entry in PATH instead, so that it "wins" against the Windows aliases. This does feel a little dirty though.

@archit9169
Copy link
Author

Can't we disable default aliases in windows settings from zero install.

Take python for example.
Zero Install adds python alias, then disables the windows default alias that are available in windows settings.
Zero Install remove python alias, then enable the windows default alias that are available in windows settings.

For now can you add this instruction to disable python alias in windows settings in python docs. Also is there any way to install full python package in ZeroInstall with pip and all??

@bastianeicher
Copy link
Member

The only way to disable those default aliases I know of is to delete the generated executables. That seems pretty harsh and may not even work permanently, because Windows might decide to restore the aliases executables on the next update. Changing the order of entries in the PATH achieves the same effect (0install aliases get used instead of the Windows ones).

Using pip with Python on Windows is a little bit tricky, because you cannot run any commands that write to the Python installation directly (which is in the 0install implementation cache and therefore immutable).

You can install the latest version of pip in your user profile like this:

curl.exe https://bootstrap.pypa.io/get-pip.py -O
0install run https://apps.0install.net/python/python.xml get-pip.py --user

Then you'll need to add %AppData%\Python\Python38\Scripts or similar to your PATH manually.

Now you can run commands like:

pip install --user mkdocs

I'll add this to the documentation soon.

@archit9169
Copy link
Author

The option to disable these aliases already exist in windows settings. I was thinking of creating a hook or finding their respective registry path and changing that. In that way it wont feel hackish?

There is another package manager called scoop. They have implemented persistent data, that is data that might get deleted when apps are updated, kind of like pip and python/scripts. What is does is essentially create a persistent directory and symlink it to python/scripts. On each update, another symlink is created to new installed location and the previous one is deleted. Maybe something similar can be implemented here?

In feed files another field can be provided for this type of data, and when a new implementation is cached, new symlink can be created?

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

No branches or pull requests

2 participants