ScoopInstaller / Extras

📦 The Extras bucket for Scoop.
https://scoop.sh
The Unlicense
1.74k stars 1.31k forks source link

[Bug]: notepadplusplus registers context menu for folders #11122

Open leumasme opened 1 year ago

leumasme commented 1 year ago

Prerequisites

Package Name

notepadplusplus

Expected/Current Behaviour

When using the install-reg script for notepadplusplus, context menu entries are created for right-clicking directories and the current directory/explorer background.
Notepad++ can only edit files, and opening it to a directory this way either just opens it to the last active file or opens and freezes it. Notepad++ seems to attempt to open every file in the folder, often causing it to freeze.
A normal Notepad++ installation (via official installer) does not create these context menu entries, so I believe the scoop context menu script shouldn't either.

Steps to Reproduce

- install notepadplusplus via scoop
- install 'install-context.reg' as written in the manifest note
- open file explorer
- navigate to a folder (e.g. C:/)
- right click empty space or a directory
- observe that a "Open with Notepad++" context menu entry is present

Possible Solution

I don't know anything about the registry keys in question, but from simply looking at the names, removing the keys starting with
HKEY_CURRENT_USER\Software\Classes\Directory\shell\Open with &Notepad++ and
HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Open with &Notepad++
seems like an obvious choice, leaving only the HKEY_CURRENT_USER\Software\Classes\*\shell\Open with &Notepad++ keys

Scoop and Buckets Version

Current Scoop version:
v0.3.1 - Released at 2022-11-15

'extras' bucket:
9a40c738e (HEAD -> master, origin/master, origin/HEAD) ferdium: Add version 6.2.6 (#11121)

'games' bucket:
4deb07d8 (HEAD -> master, origin/master, origin/HEAD) vita3k: Update to version 3113-92764c6

'java' bucket:
aadb1b61 (HEAD -> master, origin/master, origin/HEAD) zulufx8-jre: Update to version 8.70.0.23

'main' bucket:
3b14a8ac7 (HEAD -> master, origin/master, origin/HEAD) resvg: Update to version 0.32.0

'nirsoft-alt' bucket:
3053d31 (HEAD -> master, origin/master, origin/HEAD) Update url list [ci skip]

'versions' bucket:
8bf440d10 (HEAD -> master, origin/master, origin/HEAD) spotdl-beta: Update to version 4.1.8

Scoop Config

last_update     : 23.4.2023 21:09:27
aria2-enabled   : False
alias           : @{i=scoop-i; ls=scoop-ls; s=scoop-s; up=scoop-up}
cat_style       : grid,numbers
show_update_log : False
scoop_branch    : master
scoop_repo      : https://github.com/lukesampson/scoop

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.3.3
PSEdition                      Core
GitCommitId                    7.3.3
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional Softwares

No response

leumasme commented 1 year ago

I would test the suggested .reg changes and make a PR for this, but I'm not sure how to handle existing users updating.
Users who already have the registry keys installed and then update the package via scoop would keep the context menu entries, and even uninstalling the package would not remove them (assuming the uninstall-context.reg was also updated to no longer contain the entries for directory&background)

HUMORCE commented 1 year ago

A normal Notepad++ installation (via official installer) does not create these context menu entries, so I believe the scoop context menu script shouldn't either.

TL;DR: If you want to make improvements to content already exists in the bucket, I will work with you to merge it.


I'm expressing my opinion here and saving it as a quick reply.

First of all, adding context menus, startup, associations, etc. for apps defeats the Purpose of Scoop(part) and Criteria of official buckets(part).

  • Eliminates permission popup windows
  • Hides GUI wizard-style installers
  • Avoids unexpected side-effects from installing and uninstalling programs

https://github.com/ScoopInstaller/Scoop#what-does-scoop-do

  • Fairly standard install (e.g. uses a version-specific download URL, no elaborate pre/post install scripts) *

https://github.com/ScoopInstaller/Main/blob/master/.github/ISSUE_TEMPLATE/package-request.yml

If they are added by Scoop, means that they should be removed by Scoop, then we will see lines in the scripts that looks like these:

Scoop download portable apps or make apps portable. In case Scoop does not have best practices for specific apps, using winget/choco or the official installer would be better.

The best practices usually provided by users familiar with the app.

Obviously I'm not the one who uses notepad++ and can improve the manifest. If you want to make improvements to content already exists in the bucket, I will work with you to merge it.

leumasme commented 1 year ago

I agree that registry patches to add&remove context menu entries arent quite conform to the scoop spirit, but I don't see the examples you are giving applying to context menu entries.

Eliminates permission popup windows Hides GUI wizard-style installers Avoids unexpected side-effects from installing and uninstalling programs

Stop-Process or : breaks user woking on Start-Sleep ...: troublemaker if (!(is_admin)) { error \"$app requires admin rights to $cmd\"; break}": breaks updating/uninstalling There are still some I did'nt remember

None of these apply to context menu entries as they are (usually) handled by shipping a .reg file with the app, which contains registry keys to (un)install the context menu entries. Applying these is not done automatically on install and does not require an explorer restart or admin rights.

I believe context menu entries have a right to exist as they are essential to a decent number of (gui) applications and they can't be easily managed by the user without external tools. (For comparison, adding an application to autostart can simply be done by putting a shortcut into the autostart folder; Opening a file association with an application can be done by just using the "open with" context menu entry)

The situation could surely be improved, for example by making context menu entries a first-class feature in scoop like shims are so we can stop shipping ".reg" files and telling users to install them in the manifest note, but considering scoops main focus on cli applications, its reasonable that this will likely never happen.

In case Scoop does not have best practices for specific apps, using winget/choco or the official installer would be better.

I enjoy scoop's portabe-style silent installer-less installing, which winget does not offer, which is why I prefer scoop over winget whenever possible, but context menu entries are still an essential feature for many applications that I use (including 7zip, which scoop itself requires).

TLDR yeah things could be better but i find this reasonable

HUMORCE commented 1 year ago

None of these apply to context menu entries as they are (usually) handled by shipping a .reg file with the app, which contains registry keys to (un)install the context menu entries. Applying these is not done automatically on install and does not require an explorer restart or admin rights.

Some apps need to register DLLs for context menu.

I believe context menu entries have a right to exist as they are essential to a decent number of (gui) applications and they can't be easily managed by the user without external tools.

I enjoy scoop's portabe-style silent installer-less installing, which winget does not offer, which is why I prefer scoop over winget whenever possible, but context menu entries are still an essential feature for many applications that I use (including 7zip, which scoop itself requires).

extras/notepadplusplus, which it's installer contains It's own special implementation of context menu but not include in portable package. main/7zip, which it can manage context menu in it's GUI, but people still creating scripts for this.