Choco: Support not adding desktop icons

Created on 6 Jan 2015  路  7Comments  路  Source: chocolatey/choco

0 - Backlog Enhancement

Most helpful comment

Apps putting shortcuts on desktop or in menu bar drives me nuts on Windows. Please support global switch to prevent them from doing this by default. Only desktop icon I have is Firefox. That is all.

All 7 comments

Without a description, the intent of this issue is a little up for grabs, so I'm going to take a stab at it...

I would love to have a "universal" (i.e. not dependent on the package maintainer) option to prevent/remove a desktop icon. This would need to be an attempt, but I suspect it could be successful most of the time.

Reason

Some installers have a switch to prevent desktop icons, and for those, the installing user can pass those through to the installer via --installarguments. Some package maintainers can/will included code to handle -packageparameters that will allow the package to deal with unwanted icons, but most maintainers do not. Some packages actually add an icon when the installer does not. It is entirely the maintainer's choice, and often out of the control of the installer.

Chocolatey installs are often scripted, and while the scripter could create custom code to manage the icons for each package install, it would be much nicer and more efficient to simply add a switch to the choco install call.

Issue

  • Identifying which icons to remove.
Mitigation

The most likely successful process for doing this is to track all the shortcut icons before the install, let the install finish, and then remove the new shortcut icons. Then the issue is reduced to determining which icons were dropped on the desktop due to the package as opposed to placed there by a user during the install or by another simultaneous install or process. Further reductions to the risk of false positives:

  • The switch should have a value (defaulting to ".*") that can be used as a regex match for icon names. That will give the (obviously knowledgeable) installing user fine-tuned control over the icons that are removed. If a value is provided, it should override other checks.
  • It would be highly unusual for an installer to place icons in both the CommonDesktopDirectory and the current user's desktop. If new icons are in both locations, only delete those from the common desktop.
  • Check that the target for each new icon is a subdirectory of the install location before deleting. For package installs for which the install location is not known, attempt a regex match of the $env:ChocolateyPackageName or the SoftwareName to the icon names.

You developers are smarter than I am, so I'm sure there are additional/better methods to handle this, but I would love to see this feature.

Thanks!

I think it is easier and less intrusive to implement a global flag (set through config) and provide package maintainer some PowerShell helper to query user preference. This is less enforcing, but it will guarantee to work if package maintainer implements it in chocolateyInstall.ps1.

This is less enforcing, but it will guarantee to work if package maintainer implements it in chocolateyInstall.ps1.

The limitation of that is it relies on the package maintainers. My interest in this is to give control to the installer, regardless of the maintainer's willingness/interest/ability to implement anything.

Apps putting shortcuts on desktop or in menu bar drives me nuts on Windows. Please support global switch to prevent them from doing this by default. Only desktop icon I have is Firefox. That is all.

Hi guys, sorry for digging up this issue but is there any news on this ?

Not related, but related:
https://github.com/chocolatey/choco/issues/1185
^^^^ If the above got implemented, this issue could be handled by a post run helper.

Just to clarify the relation of my issue #2016 and issue #344 to this one:

There are (at least) four kinds of icons/shortcuts:

  1. Desktop
  2. Start Menu
  3. Explorer Context Menu
  4. Send To menu

and there are (at least) three policies w.r.t. adding these shortcuts:

  1. Always add them
  2. Never add them
  3. Add them on installation, but not on update

and these policies can be set at:

  1. Package scope
  2. System (chocolatey) scope

Now, here's what these issues ask for:

| Issue | Kind of shortcut | Requested policy | Policy scope |
| -------- |:------------------:|:-------------------:|:--------------:|
| #4 (this one) | 1 | 2 | 2 |
| #344 | 1 | 2 | 1 |
| #344 | 1 | 3 | 1 |
| #2016 | 2 | 3 | 2 |

Was this page helpful?
0 / 5 - 0 ratings