Skip to content

Various issues with menu items on Windows #5431

@gdementen

Description

@gdementen

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Commands I ran and their output:

> pixi global install -e py313larrayenv larrayenv --expose py313editor=larray-editor --with "python=3.13"
└── py313larrayenv (installed)
    ├─ dependencies: larrayenv 0.35, python 3.13.11
    └─ exposes: py313editor -> larray-editor
> pixi global shortcut add -e py313larrayenv larray-editor
Environment py313larrayenv was already up-to-date.
Installed shortcut larray-editor of environment py313larrayenv
> pixi global install -e py312larrayenv larrayenv --expose py312editor=larray-editor --with "python=3.12"
└── py312larrayenv (installed)
    ├─ dependencies: larrayenv 0.35, python 3.12.12
    └─ exposes: py312editor -> larray-editor
> pixi global shortcut add -e py312larrayenv larray-editor
Error:   x Shortcut larray-editor already exists

.pixi/config.toml

default-channels = ["main", "larray-project"]

pixi.toml/pyproject.toml file that reproduces my issue:

N/A

pixi info output (I don't think it's relevant but...):

System
------------
       Pixi version: 0.63.2
        TLS backend: rustls
           Platform: win-64
   Virtual packages: __win=10.0.26200=0
                   : __cuda=12.8=0
                   : __archspec=1=skylake
          Cache dir: C:\Users\gdm\AppData\Local\rattler\cache
       Auth storage: C:\Users\gdm\.rattler\credentials.json
   Config locations: C:\Users\gdm\.pixi\config.toml

Global
------------
            Bin dir: C:\Users\gdm\.pixi\bin
    Environment dir: C:\Users\gdm\.pixi\envs
       Manifest dir: C:\Users\gdm\.pixi\manifests\pixi-global.toml

~\AppData\Local\rattler\cache\pkgs\larray-editor-0.35-py_0\Menu\larray-editor.json (and ~\AppData\Local\rattler\cache\bld\pkgs\larray-editor-0.35-py_0\Menu\larray-editor.json):

{
    "$schema": "https://json-schema.org/draft-07/schema",
    "$id": "https://schemas.conda.io/menuinst-1-1-3.schema.json",
    "menu_name": "LArray",
    "menu_items": [
        {
            "name": {
                "target_environment_is_base": "LArray Editor",
                "target_environment_is_not_base": "LArray Editor ({{ ENV_NAME }})"
            },
            "description": "description editor new",
            "activate": false,
            "terminal": false,
            "command": ["{{ SCRIPTS_DIR }}\\larray-editor.exe", "%*"],
            "icon": "{{ MENU_DIR }}\\larray.ico",
            "platforms": {
                "win": {
                    "file_extensions": [
                        ".h5"
                    ]
                }
            }
        }
    ]
}

Issue description

No response

Expected behavior

I am trying to replicate my conda setup using pixi. What I have seen so far is extremely impressive but I have several issues regarding menu items. Because all my issues have the same setup and I am unsure all of them are uses cases you want to support, I will report them all here (as a single issue). Tell me if you want me to split the issue but in that case please also tell me which parts you consider valid and which not.

Please also note that I am porting from menuinst v1 at the same time, so I don't know whether some of those issues are in fact issues in menuinst that you inherited when porting to Rust (AFAICT) :

  • No menu nor desktop shortcut was created by using just the "global install" command. Is there a parameter necessary to install shortcuts? Reading the CLI help (there is a --no-shortcuts option but no --with-shortcuts option), I expected that would be the default behavior. When I used the pixi global shortcut add -e py313larrayenv larray-editor command explicitly, it worked though. To be honest I don't know whether this is a real issue, something that you purposefully do not do, or a consequence of the "menuinst config file" in the conda package being v1 (while apparently pixi only supports v2). I updated it inplace in the cache dir (see above) until pixi accepted it (via pixi global shortcut). But reinstalling the env now does not seem create any shortcut by default.
  • pixi global shortcut add -e py313larrayenv larray-editor tries to update the environment, which is unexpected to me.
  • pixi global shortcut remove larray-editor also wants to update the environment, which is even more unexpected to me.
  • The distinction between "target_environment_is_base" and "target_environment_is_not_base" in the menu.json file of the conda package does not seem to be respected, so the menu name does not include the environment name.
  • might be due to the previous issue, but I expected the commands I ran above to create two distinct menus items but pixi refused for the second with Error: x Shortcut larray-editor already exists. Yes, this is probably a bit unusual to want several versions of a single tool but not that uncommon for developers, I suppose. How can I achieve that?
  • The created shortcut links work but they open an empty terminal while the application is open, which looks unprofessional. The menuinst v2 migration guide suggests using cwp.py as a workaround, which works nicely when using conda but not with pixi (cwp.py does not exist). I can understand why you would not want to ship cwp.py but then is there a pixi-compatible way to avoid that empty terminal window?
  • Concerning file extension association, the type (as reported by Windows File Explorer) of the associated files are .h5 LArray Editor.AssocFile.h5 file instead of something more standard like just H5 File (or something user-configurable)
  • The icon of associated files is a generic "executable" icon instead of the icon I provided (which is used correctly in both the menu and desktop shortcuts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions