Skip to content

Menu Shortcut Config Structure

Eric Prestat edited this page Apr 2, 2021 · 13 revisions

Windows

{
    "menu_name": "World",
    "menu_items":
        [
            {
                "script": "${PREFIX}/some_command.exe",
                "scriptarguments": ["list", "of", "arguments"],
                // The following options can be applied to any shortcut type:
                "name": "Hello World",
                "workdir": "${PREFIX}",
                "icon": "${MENU_DIR}/app.ico",
                "desktop": true,  // Also create desktop shortcut
                "quicklaunch": true  // Also create "Quick Launch" bar shortcut
            },
            {
                "pywscript": "${PYTHON_SCRIPTS}/helloworld_ui-script.py"
            },
            {
                "pyscript": "${PYTHON_SCRIPTS}/helloworld-script.py"
            },
            {
                "webbrowser": "https://hello.com"
            },
            {
                "system": "path to executable.  No environment modification is done.",
                "scriptarguments": ["list", "of", "arguments"]
            }
        ]
}

Available variables include:

  • ${PREFIX}: Python environment prefix
  • ${ROOT_PREFIX}: Python environment prefix of root (conda or otherwise) installation
  • ${PYTHON_SCRIPTS}: Scripts folder in Python environment, ${PREFIX}/Scripts
  • ${MENU_DIR}: Folder for menu config and icon files, ${PREFIX}/Menu
  • ${PERSONALDIR}: Not sure
  • ${USERPROFILE}: User's home folder
  • ${ENV_NAME}: The environment in which this shortcut lives.
  • ${DISTRIBUTION_NAME}: The name of the folder of the root prefix, for example "Miniconda" if distribution installed at "C:\Users\Miniconda".
  • ${PY_VER}: The Python major version only. This is taken from the root prefix. Used generally for placing shortcuts under a menu of a parent installation.
  • ${PLATFORM}: one of (32-bit) or (64-bit). This is taken from the root prefix. Used generally for placing shortcuts under a menu of a parent installation.

Linux

{
    "menu_name": "World",
    "menu_items":
        [
            {
                "cmd": ["/usr/bin/helloworld", "arg1", "..", "argn"],
                // The following options can be applied to any shortcut type:
                "id": "id1",  // For shortcut file name, becomes "World_id1"
                "name": "Hello World",
                "comment": "Hello World application",
                "terminal": true,
                "icon": "path/to/icon"
            },
            {
                "cmd": ["{{FILEBROWSER}}", "~/HelloWorld.txt"]
            },
            {
                "cmd": ["{{WEBBROWSER}}", "https://hello.com"]
            }
        ]
}

There don't seem to be any variables available. So how does one make shortcuts for entry points in a particular environment/prefix?

OSX

{
    "menu_name": "World",
    "menu_items":
        [
            {
                "cmd": "${BIN_DIR}/helloworld",
                "name": "Hello World",
                "icns": "${MENU_DIR}/app.icns"
            }
        ]
}

Available variables include:

  • ${BIN_DIR}: {prefix}/bin
  • ${MENU_DIR}: {prefix}/Menu

Note that ${PREFIX} is not available! You would have to do ${BIN_DIR}/...

Clone this wiki locally