Request to Support Windows Calculator Protocols

Issue #904 invalid
Emily Mabrey created an issue

I am running SpeedCrunch version 0.12 on Windows 10 version 1903 build 18362.53.

Previously, in issue #569, support was requested for adding an installation option and/or program option to set SpeedCrunch as the Windows default calculator using the URL:calculator protocol under Windows 10.

I have determined that adding support for being the default calculator would actually require adding changes to the registry to support both the URL:ms-calculator protocol and the URL:calculator protocol. After making those modifications you are able to open SpeedCrunch simply by running calc.exe (on Windows 10).

The modifications I made were as follows:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator]
@="URL:ms-calculator"
"URL Protocol"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator\shell\open\command]
@="\"C:\\Program Files (x86)\\SpeedCrunch\\speedcrunch.exe\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator]
@="URL:calculator"
"URL Protocol"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator\shell\open\command]
@="\"C:\\Program Files (x86)\\SpeedCrunch\\speedcrunch.exe\""

Note that my SpeedCrunch installation is located at "C:\Program Files (x86)\SpeedCrunch\". If this enhancement were made to SpeedCrunch the install location would need to be used and not just this default location.

I am requesting a modification similar to the one requested in issue 569, except using the URL:ms-calculator protocol in addition to the URL:calculator protocol. I am requesting both because, as you can see in the application manifest of the Calculator app, both protocols are registered for the application.

I am attaching an exported .reg file containing my modifications for the fix under the file name speedcrunch-protocol.reg. Running this file will directly change the registry on your computer to have the changes I listed above. Note that you shouldn't run any registry modifications without reviewing them for safety and correctness. I am not responsible for anyone using the modifications. That said, it is what worked for me. Also make sure to point the registry to the install location of SpeedCrunch if you did not install it in the default location.

These exact changes could be rolled into the program itself using winreg.h functions. For adding this support to the installer we could add a a Registry section to pkg\winsetup.iss.

If the main developers/contributors are unwilling to make this enhancement please don't close the issue immediately, as I am willing to make the changes myself if the support for this feature is something compatible with the project and it is just an issue of allocation of resources. I was going to accompany this issue with a pull request, but given the older issue was closed without changes (I believe) I wanted to verify that the pull-request to implement this kind of change would even be wanted. I simply need a yes/no on if this pull request would be welcome in addition to wanting a newer issue to refer to in the pull request.

Comments (5)

  1. Emily Mabrey reporter
    • edited description

    Added more details on potential implementation. Added more elaboration for the purpose of the request/desire to make a pull request.

  2. Helder Correia repo owner

    I am running SpeedCrunch version 0.12 on Windows 10 version 1903 build 18362.53.

    Previously, in issue #569, support was requested for adding an installation option and/or program option to set SpeedCrunch as the Windows default calculator using the URL:calculator protocol under Windows 10.

    I have determined that adding support for being the default calculator would actually require adding changes to the registry to support both the URL:ms-calculator protocol and the URL:calculator protocol. After making those modifications you are able to open SpeedCrunch simply by running calc.exe (on Windows 10).

    The modifications I made were as follows:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator]
    @="URL:ms-calculator"
    "URL Protocol"=""
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator\shell]
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator\shell\open]
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-calculator\shell\open\command]
    @="\"C:\\Program Files (x86)\\SpeedCrunch\\speedcrunch.exe\""
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator]
    @="URL:calculator"
    "URL Protocol"=""
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator\shell]
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator\shell\open]
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\calculator\shell\open\command]
    @="\"C:\\Program Files (x86)\\SpeedCrunch\\speedcrunch.exe\""
    

    Note that my SpeedCrunch installation is located at "C:\Program Files (x86)\SpeedCrunch\". If this enhancement were made to SpeedCrunch the install location would need to be used and not just this default location.

    I am requesting a modification similar to the one requested in issue 569, except using the URL:ms-calculator protocol in addition to the URL:calculator protocol. I am requesting both because, as you can see in the application manifest of the Calculator app, both protocols are registered for the application.

    I am attaching an exported .reg file containing my modifications for the fix under the file name speedcrunch-protocol.reg. Running this file will directly change the registry on your computer to have the changes I listed above. Note that you shouldn't run any registry modifications without reviewing them for safety and correctness. I am not responsible for anyone using the modifications. That said, it is what worked for me. Also make sure to point the registry to the install location of SpeedCrunch if you did not install it in the default location.

    These exact changes could be rolled into the program itself using winreg.h functions. For adding this support to the installer we could add a a Registry section to pkg\winsetup.iss.

    If the main developers/contributors are unwilling to make this enhancement please don't close the issue immediately, as I am willing to make the changes myself if the support for this feature is something compatible with the project and it is just an issue of allocation of resources. I was going to accompany this issue with a pull request, but given the older issue was closed without changes (I believe) I wanted to verify that the pull-request to implement this kind of change would even be wanted. I simply need a yes/no on if this pull request would be welcome in addition to wanting a newer issue to refer to in the pull request.

  3. Tey'

    During setup, SpeedCrunch sets the correct registry keys to indicate it supports the URL:calculator protocol. You still have to select SC as the handler for that protocol in Windows settings, as applications are not supposed to do it by themselves since Windows 10. You can do that by going to Settings > Apps > Default Apps, scrolling down and clicking on Select defaults by protocol, and changing the app for URL:calculator.

    No such thing is done for the portable version, as portable apps shouldn't change the system configuration.

    I don't think we should handle the URL:ms-calculator protocol, as it clearly looks like a specific MS stuff, and is not required to make calc.exe command to launch SC anyway (handling URL:calculator is enough for that).

  4. Log in to comment