Skip to content

feat(uninstaller): remove autostart entry during uninstallation#12643

Merged
lucasfernog merged 5 commits intotauri-apps:devfrom
animeshchaudhri:feat/remove-autostart-on-uninstall
Mar 16, 2025
Merged

feat(uninstaller): remove autostart entry during uninstallation#12643
lucasfernog merged 5 commits intotauri-apps:devfrom
animeshchaudhri:feat/remove-autostart-on-uninstall

Conversation

@animeshchaudhri
Copy link
Contributor

Summary

This PR fixes issue #12422 by ensuring that the autostart registry entry at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
is removed when the application is uninstalled.

Previously, uninstalling an application that was set to autostart via tauri-plugin-autostart would leave behind an invalid registry entry, causing unintended behavior. This PR modifies the uninstallation process to clean up these entries properly.

Related PRs

  • This is similar to the fix implemented in PR #12427 for another registry cleanup issue.

Changes

  • Modify the uninstallation script to check and remove the autostart registry entry.
  • Ensure cleanup happens consistently during uninstallation.

Testing

  • Reproduced the issue by enabling autostart and uninstalling the app.
  • Verified the fix by checking the registry after uninstallation to confirm the entry is removed.

References

Closes #12422.

Signed-off-by: animeshchaudri <animeshchaudhri3@gmail.com>
@animeshchaudhri animeshchaudhri requested a review from a team as a code owner February 7, 2025 10:46
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2025

Package Changes Through fe3c028

There are 12 changes which include tauri with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-cli with minor, @tauri-apps/cli with minor, @tauri-apps/api with minor, tauri-bundler with patch, tauri-build with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.3.0 2.4.0
tauri-utils 2.2.0 2.3.0
tauri-bundler 2.2.4 2.2.5
tauri-runtime 2.4.0 2.5.0
tauri-runtime-wry 2.4.1 2.5.0
tauri-codegen 2.0.5 2.1.0
tauri-macros 2.0.5 2.1.0
tauri-plugin 2.0.5 2.1.0
tauri-build 2.0.6 2.1.0
tauri 2.3.1 2.4.0
@tauri-apps/cli 2.3.1 2.4.0
tauri-cli 2.3.1 2.4.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@FabianLars
Copy link
Member

thanks for the pr. do you think you can do the same for wix/msi ?

@ProjectNyaser
Copy link

ProjectNyaser commented Feb 23, 2025

thanks for the pr. do you think you can do the same for wix/msi ?感谢提交的 PR。你认为你能为 wix/msi 做同样的事情吗?

image

I'm not sure if this would work.. how can I test? @FabianLars

@animeshchaudhri
Copy link
Contributor Author

thanks for the pr. do you think you can do the same for wix/msi ?感谢提交的 PR。你认为你能为 wix/msi 做同样的事情吗?

image

I'm not sure if this would work.. how can I test? @FabianLars

I have tested this and it works and I am working on wix/msi now

@lucasfernog
Copy link
Member

from the WiX docs:

There is no standard way to remove a single registry value during uninstall

https://docs.firegiant.com/wix3/xsd/wix/removeregistryvalue/

so i think we're stuck with fixing for NSIS only

@FabianLars
Copy link
Member

This PR is somewhat wrong as well since we only remove it from the current user but removing hkcu keys of other users is hard and afaik frowned upon.

With how often i have orphaned autostart entries it seems like most programs just go with the "fuck it, not our problem" and i think we should too (this pr is fine though we may want to consider guarding it behind the installMode as well)

lucasfernog
lucasfernog previously approved these changes Mar 16, 2025
@lucasfernog
Copy link
Member

This PR is somewhat wrong as well since we only remove it from the current user but removing hkcu keys of other users is hard and afaik frowned upon.

With how often i have orphaned autostart entries it seems like most programs just go with the "fuck it, not our problem" and i think we should too (this pr is fine though we may want to consider guarding it behind the installMode as well)

so this only makes sense if the installmode is peruser right? auto-launch seems to try to enable it on local machine too: https://github.com/zzzgydi/auto-launch/blob/6542a3c4033fe1f3a8757dd65daf7e0c872a0756/src/windows.rs#L55

@FabianLars
Copy link
Member

so this only makes sense if the installmode is peruser right?

imo yes

auto-launch seems to try to enable it on local machine too: zzzgydi/auto-launch@6542a3c/src/windows.rs#L55

which is a bit problematic because (in tauri) whether the app runs with admin or not is unrelated to the install mode.

@animeshchaudhri
Copy link
Contributor Author

@FabianLars @lucasfernog Thanks, guys, for fixing the issue! This was my first PR. I’ve been assigned more issues, but nobody answers my questions related to Tauri architecture, even when I ping them on Discord. So, I had to YOLO it. lol

@FabianLars
Copy link
Member

we're yolo-ing it as well so this was a good start!

@lucasfernog
Copy link
Member

auto-launch seems to try to enable it on local machine too: zzzgydi/auto-launch@6542a3c/src/windows.rs#L55

which is a bit problematic because (in tauri) whether the app runs with admin or not is unrelated to the install mode.

I opened a PR to auto-launch to help us here zzzgydi/auto-launch#21

@lucasfernog lucasfernog merged commit 2b960df into tauri-apps:dev Mar 16, 2025
14 checks passed
@Legend-Master
Copy link
Contributor

which is a bit problematic because (in tauri) whether the app runs with admin or not is unrelated to the install mode.

That is added in only in the git version, so it's not used in our auto start plugin yet

I opened a PR to auto-launch to help us here zzzgydi/auto-launch#21

@lucasfernog There's one already zzzgydi/auto-launch#20

kandrelczyk pushed a commit to kandrelczyk/tauri that referenced this pull request Apr 7, 2025
…i-apps#12643)

* feat(uninstaller): remove autostart entry during uninstallation

Signed-off-by: animeshchaudri <animeshchaudhri3@gmail.com>

* add change file

* check when not updating

* delete registry value only if install mode is "currentUser"

---------

Signed-off-by: animeshchaudri <animeshchaudhri3@gmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] Remove invalid autostart during the uninstallation process

5 participants

Comments