Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A recommend Solution to make Librewolf Portable the Standardapp #3

Open
solisinvictum opened this issue Nov 19, 2022 · 13 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@solisinvictum
Copy link

solisinvictum commented Nov 19, 2022

Hey,

im using Librewolf Portable as my standard Browser.


Use SetDefault.zip instead of the code below, or check #3 (comment)


To make Windows to use and set it as Standard, following Text:

set "CHRLAUNCHER_NAME=LibreWolf"
set "CHRLAUNCHER_NAME_SHORT=LibreWolf"
set "CHRLAUNCHER_DESCRIPTION=LibreWolf Portable"
set "CHRLAUNCHER_PATH=%~dp0LibreWolf-Portable.exe"
set "CHRLAUNCHER_ICON=\"%CHRLAUNCHER_PATH%\",0"
set "CHRLAUNCHER_ARGS=\"%CHRLAUNCHER_PATH%\" \"%%1\""

		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME% Document" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML\shell\open\command" /v "" /t REG_SZ /d "%CHRLAUNCHER_ARGS%" /f

		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME% Protocol" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "EditFlags" /t REG_DWORD /d "2" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "FriendlyTypeName" /t REG_SZ /d "%CHRLAUNCHER_NAME% Protocol" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "URL Protocol" /t REG_SZ /d "" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL\shell\open\command" /v "" /t REG_SZ /d "%CHRLAUNCHER_ARGS%" /f

		reg add "HKLM\Software\RegisteredApplications" /v "%CHRLAUNCHER_NAME_SHORT%" /t REG_SZ /d "Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\shell\open\command" /v "" /t REG_SZ /d "\"%CHRLAUNCHER_PATH%\"" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\InstallInfo" /v "IconsVisible" /t REG_DWORD /d "1" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationIcon" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationName" /t REG_SZ /d "%CHRLAUNCHER_NAME%" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "%CHRLAUNCHER_DESCRIPTION%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".htm" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".html" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".pdf" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".shtml" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".svg" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".webp" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".xht" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".xhtml" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\StartMenu" /v "StartMenuInternet" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "ftp" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "http" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "https" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "mailto" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "webcal" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "urn" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "tel" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "smsto" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "sms" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "nntp" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "news" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "mms" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "irc" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f

		%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=%CHRLAUNCHER_NAME_SHORT%

saved as librewolf.bat for example in the same path where librewolf-portable.exe is.

Running this as Admin, makes it possible to set Librewolf Portable as standard app (Windows 10 and latest 11 tested).

Got the Idea from: https://github.com/henrypp/chrlauncher/blob/master/bin/SetDefaultBrowser.bat

@ltguillaume
Copy link
Owner

ltguillaume commented Nov 19, 2022

I'm not exactly a fan of this to be honest. If you want to run LibreWolf like that, you might as well just install it. That at least makes sure that the proper registry keys are always set.

You're taking thsi from Chromium Launcher by henrypp. I know it well, and it does not allow for installation, simply because it's meant for portable use only, just like LibreWolf Portable. It makes sense to some extent for chrlauncher, but LibreWolf does have a regular installation process, so I don't see merit in this approach.

That being said, the set of registry keys made by this little script make sense and won't do any harm.

@solisinvictum
Copy link
Author

solisinvictum commented Nov 19, 2022

Yep. Good Point.

But there is really a reason (for me) behind that: If you automate your deployment of programs and settings (group policy, what ever), there is no way (none im aware of) to change the behavior of installed librewolf version, to let a user without admin privilege to update the browser. So the user is forced to use a outdated Version of the Browser, because the user dont have admin privilege like mentioned.

On Firefox and Chrome (and most other browser), this problem didnt exist, because they install with the install process a service, wich runs under admin privilege and updates the browser for the user (wich then dont need the privilege).

But Librewolf sadly dont offer a automatic update mechanism. And so no Service wich do it for normal User like mentioned Firefox or Chrome or many others do.

So, if you want to be sure, the user is safe. You must use the Portable Version and your great updater. Both under a user accessable path.

@ltguillaume
Copy link
Owner

ltguillaume commented Nov 19, 2022

Ok, so you're doing this because you'll then only need admin privileges once. That makes sense.

I do have a question, though (and I'm currently struggling with this in a new version, one that should allow for multiple different portable instances to be run simultaneously): how does LibreWolf Portable, used this way, handle opening URLs when there's already a window opened? Does it open a new window, or just a new tab in the exisitng window (as is desired)?

@solisinvictum
Copy link
Author

solisinvictum commented Nov 19, 2022

like you desire/set this in the settings of librewolf. In a new window, or new tab.

For example: I got a email notice of your reply, i clicked on the link in betterbird (a thunderbird fork), and it opened a new tab with this page where i can reply.

Edit:

this solution, dont work for multiple librewolf portable instances/"folder". Then you have duplicate choices under "Standard App Setting" in Windows. Wich would have all the same name if you dont change the "CHRLAUNCHER_NAME" variable.

Sure, you could make it: CHRLAUNCHER_NAME=Librewolf+$somerandomgeneratedname

But this really over the top.

Sure, my Suggestion is for these guys helpfull, wich want to be able to make it possible that the normal user have everytime a up-to-date browser.

@ltguillaume ltguillaume added the documentation Improvements or additions to documentation label Nov 19, 2022
@ltguillaume
Copy link
Owner

ltguillaume commented Nov 19, 2022

OK, cool, opens in a tab.

Thing is, when multiple instances are running, I need some way to control which instance opens the URL.

As for adding multiple instances to the registry, too, no that's not what I intend to do.

Here's your script in file form, by the way (extract next to LibreWolf-Portable.exe):
SetDefault.zip

@solisinvictum
Copy link
Author

solisinvictum commented Nov 19, 2022

I test it in few minutes.

I already tried to change the variables too in a lazy way (simply replace in notepad++) (to LIBREWOLF instead CHRLAUNCHER). but for some reason that didnt worked. But didnt bothered to look why.

if you have multiple instances running FROM THE SAME PATH (so the same "installation"), it opens a new tab in the active window.

if a user have for example a instance open from C:\Librewolf1 and C:\Librewolf2, a clicked link in Windows or other Application except the librewolf instance self, would open the link in the librewolf instance, wich is definded as standard. In Librewolf1 instance for example if this is maded the standard one over the little script.

Edit: Your adjusted script works.

@solisinvictum
Copy link
Author

Just to clearify:

I wouldnt make this default with your librewolf-portable.

What i would do: Maybe a default Startpage, wich mention if the user want to make this portable version/instance default, to execute the delivered *.bat file as admin.

Or simply to deliver the *.bat file with librewolf-portable, and to mention it here in a documentation/wiki page.

@h8nor
Copy link

h8nor commented Nov 21, 2022

You can try to change the browser installation script by default in the system
https://gist.github.com/winhelponline/5ba152dd99e41a9cd4e1b2eb79085fd5

@ltguillaume
Copy link
Owner

ltguillaume commented Nov 22, 2022

@solisinvictum I don't think it will be added by stanzabird to the LibreWolf zip-file, but I might just link to this from the readme here.

By the way, a few days ago I updated the script, because earlier I forgot to add a few lines to auto-elevate the script if it's not yet run as administrator.

@h8nor How is this different from the batch script?

@h8nor
Copy link

h8nor commented Nov 22, 2022

Batch script installed. After launching the application I see an error
error

@ltguillaume
Copy link
Owner

That isn't related to the batch script. Just click "Continue".

@moya2162
Copy link

moya2162 commented Jun 16, 2023

Recommend check out following project to register portable browser as system default. I have personally used it on Windows 11 with LibreWolf portable and am able to click links and have them open in my portable instance in a specific profile too.

https://github.com/SiL3NC3/PortableRegistrator

@NastyFlytrap
Copy link

This is what i've been looking for days and neither brave nor google sent me here until now

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants