From dc8939b912c5aaf0ce90cb37175821f0f3fa8000 Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 25 Jan 2024 15:50:22 -0800 Subject: [PATCH 1/6] Add note on start menu directories on Win 11 --- docs/source/defining-shortcuts.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/source/defining-shortcuts.md b/docs/source/defining-shortcuts.md index a0eab1a9..c5e4d62c 100644 --- a/docs/source/defining-shortcuts.md +++ b/docs/source/defining-shortcuts.md @@ -201,3 +201,12 @@ You can add a dependency on `__osx>=10.14.4` on your conda package if you wish t ] } ``` + +## Notes on Windows shortcuts + +### Directories do not appear under `All apps` in the Start Menu + +Directories defined by `menu_name` may not always appear in the Start Menu. +On Windows 11, directories are only shown if they contain more than one shortcut. +Otherwise, the shortcut will appear directly under "All apps". +This behavior is normal for Windows 11 - `menuinst` still creates the directories correctly. From 05f0b6ea9eaf22b5f5c52e786b99303807af426c Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 25 Jan 2024 15:53:38 -0800 Subject: [PATCH 2/6] Add section about migrating pywscript and pyscript to v2 --- docs/source/defining-shortcuts.md | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/docs/source/defining-shortcuts.md b/docs/source/defining-shortcuts.md index c5e4d62c..91a192c1 100644 --- a/docs/source/defining-shortcuts.md +++ b/docs/source/defining-shortcuts.md @@ -210,3 +210,72 @@ Directories defined by `menu_name` may not always appear in the Start Menu. On Windows 11, directories are only shown if they contain more than one shortcut. Otherwise, the shortcut will appear directly under "All apps". This behavior is normal for Windows 11 - `menuinst` still creates the directories correctly. + +### Migrating `pywscript` and `pyscript` to `menuinst v2` + +`menuinst v1` contained `pywscript` and `pyscript` fields that allowed python scripts inside +a `conda` environment to be called. + +```json +{ + "menu_name": "App", + "menu_items": [ + { + "name": "Launch App", + "pywscript": "${SCRIPTS_DIR}/app-launcher.py" + } + ] +} +``` + +However, these wrappers just adjusted `PATH` and did not activate the `conda` environment +so that environment variables were unavailable. + +These fields have been removed with `menuinst v2`. Instead, the environment should be activated +and the script executed directly. + +```json +{ + "$schema": "https://json-schema.org/draft-07/schema", + "$id": "https://schemas.conda.io/menuinst-1.schema.json", + "name": "App", + "menu_items": [ + "name": "Launch App" + "description": "Launch App", + "activate": true, + "command": ["{{ PREFIX }}/pythonw.exe", "{{ SCRIPTS_DIR }}/app-launcher.py"], + "platforms": { + "win": { + } + } + ] +} +``` + +This will briefly open a terminal Window to launch the python instance. +If this flashing is not desired, `menuinst v1` behavior can be restored +by explicitly calling the wrapper: + +```json +{ + "$schema": "https://json-schema.org/draft-07/schema", + "$id": "https://schemas.conda.io/menuinst-1.schema.json", + "name": "App", + "menu_items": [ + "name": "Launch App" + "description": "Launch App", + "activate": true, + "command": [ + "{{ BASE_PYTHONW }}", + "{{ BASE_PREFIX }}/cwp.py", + "{{ PREFIX }}", + "{{ PYTHONW }}", + "{{ SCRIPTS_DIR }}/app-launcher.py" + ], + "platforms": { + "win": { + } + } + ] +} +``` From c3c06b56c9e84dfe1015c7ee9b1184ffbf914a2f Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 25 Jan 2024 15:54:47 -0800 Subject: [PATCH 3/6] Remove backtics from headers --- docs/source/defining-shortcuts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/defining-shortcuts.md b/docs/source/defining-shortcuts.md index 91a192c1..55e64b9e 100644 --- a/docs/source/defining-shortcuts.md +++ b/docs/source/defining-shortcuts.md @@ -204,14 +204,14 @@ You can add a dependency on `__osx>=10.14.4` on your conda package if you wish t ## Notes on Windows shortcuts -### Directories do not appear under `All apps` in the Start Menu +### Directories do not appear under All apps in the Start Menu Directories defined by `menu_name` may not always appear in the Start Menu. On Windows 11, directories are only shown if they contain more than one shortcut. Otherwise, the shortcut will appear directly under "All apps". This behavior is normal for Windows 11 - `menuinst` still creates the directories correctly. -### Migrating `pywscript` and `pyscript` to `menuinst v2` +### Migrating pywscript and pyscript to menuinst v2 `menuinst v1` contained `pywscript` and `pyscript` fields that allowed python scripts inside a `conda` environment to be called. From 50fd46985dc398b1cfbd3c0bb4d30ac341fe2096 Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 25 Jan 2024 15:55:41 -0800 Subject: [PATCH 4/6] Make commands multi-row --- docs/source/defining-shortcuts.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/source/defining-shortcuts.md b/docs/source/defining-shortcuts.md index 55e64b9e..90beb824 100644 --- a/docs/source/defining-shortcuts.md +++ b/docs/source/defining-shortcuts.md @@ -243,7 +243,10 @@ and the script executed directly. "name": "Launch App" "description": "Launch App", "activate": true, - "command": ["{{ PREFIX }}/pythonw.exe", "{{ SCRIPTS_DIR }}/app-launcher.py"], + "command": [ + "{{ PREFIX }}/pythonw.exe", + "{{ SCRIPTS_DIR }}/app-launcher.py" + ], "platforms": { "win": { } From 855f136f88b76b99378af0de1d528a70ddfa05a0 Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 25 Jan 2024 15:56:11 -0800 Subject: [PATCH 5/6] Use PYTHON_SCRIPTS placeholder for v1 json --- docs/source/defining-shortcuts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/defining-shortcuts.md b/docs/source/defining-shortcuts.md index 90beb824..d40452c8 100644 --- a/docs/source/defining-shortcuts.md +++ b/docs/source/defining-shortcuts.md @@ -222,7 +222,7 @@ a `conda` environment to be called. "menu_items": [ { "name": "Launch App", - "pywscript": "${SCRIPTS_DIR}/app-launcher.py" + "pywscript": "${PYTHON_SCRIPTS}/app-launcher.py" } ] } From 11658ebd80810703f3e1610a4ca51c7982421ffd Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 25 Jan 2024 16:00:50 -0800 Subject: [PATCH 6/6] Add news --- news/181-windows-shortcut-notes | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 news/181-windows-shortcut-notes diff --git a/news/181-windows-shortcut-notes b/news/181-windows-shortcut-notes new file mode 100644 index 00000000..43c4208b --- /dev/null +++ b/news/181-windows-shortcut-notes @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* + +### Deprecations + +* + +### Docs + +* Add notes on "missing" Start Menu directories on Windows and on how to migrate `pywscript` and `pyscript` to menuinst v2 (#181) + +### Other + +*