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

feat(windows): add boot switch #12995

Merged
merged 3 commits into from
Jan 31, 2025
Merged

Conversation

rc-swag
Copy link
Contributor

@rc-swag rc-swag commented Jan 23, 2025

Fixes: #12994
This updates the registry entry run on start-up to use -boot, add the -boot switch
to initprog. The fmBoot option code allows update state machine code so that
on boot a prompt can let the user the new update is about to install.

User Testing

TEST_BOOT_SWITCH_POP UP

  1. Install Keyman attached the PR
  2. Install the Gff_Amharic 3.1.1 version keyboard.
  3. Start Keyman
  4. Open the Keyman Configuration dialog.
  5. In the Options tab
  6. Navigate to the "Keyboard Layouts tab".
  7. Verified that the installed keyboard shows an older version.
  8. Navigate to the "Update" tab.
  9. Open the "C:\Users"yourusername"\AppData\Local\Keyman\UpdateCache" folder.
  10. Open the regedit window (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
    WinR type regedit Go the current user key update state
    Press F5 to keep it refreshing it.
    The state will go to usDownloading to usInstalling at the same time keep checking the UpdateCache folder.
  11. Select the "update state"
  12. In Keyman Configuration press the "Check for new updates" button.
  13. Verified that the "UpdateCache" folder is updating or adding files)
  14. On Regedit window. Verify the state changes from usUpdateAvailable --> usDownloading --> usWaitingRestart
  15. Logout and Back into Windows
  16. Verify a pop-up Keyman is ready to install with two buttons install and close.

TEST_ON_STARTUP_UPDATED

I wasn't able to attach an older build but you can install the build from PR #12956 or even the latest version 17 from Keyman.com
2. Open Keyman Configuration and check Start with Windows option
2. Open the regedit window
WinR type regedit Go the current key Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Keyman
3. Observe that is "C:\Program Files (x86)\Keyman\Keyman Desktop\kmshell.exe" -s
4. Download the Keyman for windows attached to this PR.
5. Double-click on the file to install it. Ensure you choose the install options and select the 18.0.175-alpha-test-12995
6. The setup will ask you to reboot the computer to continue installing. Once rebooted and the installing is complete.
7. Open the regedit window
WinR type regedit Go the current key Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Keyman
8. Observe that is "C:\Program Files (x86)\Keyman\Keyman Desktop\kmshell.exe" -boot

This updates the registry entry or run on start up and the switch
to initprog. TODO is to actually process the switch correctly when
set.
@rc-swag rc-swag self-assigned this Jan 23, 2025
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label Jan 23, 2025
@github-actions github-actions bot added the feat label Jan 23, 2025
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Jan 23, 2025

User Test Results

Test specification and instructions

@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S20 milestone Jan 23, 2025
@rc-swag rc-swag changed the base branch from master to feat/windows/kmshell-switch-handling January 28, 2025 07:30
Add fmBoot option code and update state machine code so that
on boot a prompt can let the user the new update is about to install.
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed and removed user-test-missing User tests have not yet been defined for the PR labels Jan 28, 2025
@rc-swag rc-swag marked this pull request as ready for review January 28, 2025 14:13
@rc-swag rc-swag requested a review from ermshiperete as a code owner January 28, 2025 14:13
@rc-swag rc-swag requested review from mcdurdin and ermshiperete and removed request for ermshiperete January 28, 2025 14:13
@dinakaranr
Copy link

Test Results

I tested this issue with the attached "18.0.175-alpha-test-12995" build(28/01/2025) on Windows 10 and Windows 11. I'm sharing my observation here.

  • TEST_BOOT_SWITCH_POP (Passed):
  1. Install Keyman attached the PR
  2. Install the Gff_Amharic 3.1.1 version keyboard.
  3. Start Keyman
  4. Open the Keyman Configuration dialog.
  5. In the Options tab
  6. Navigate to the "Keyboard Layouts tab".
  7. Verified that the installed keyboard shows an older version.
  8. Navigate to the "Update" tab.
  9. Open the "C:\Users\Dinakaran\AppData\Local\Keyman\UpdateCache" folder.
  10. Open the regedit window (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
  11. WinR type regedit Go the current user key update state
  12. Press F5 to keep it refreshing it.
  13. The state will go to usDownloading to usInstalling at the same time keep checking the UpdateCache folder.
  14. Select the "update state"
  15. In Keyman Configuration press the "Check for new updates" button.
  16. Verified that the "UpdateCache" folder is updating or adding files)
  17. On Regedit window. Verify the state changes from usUpdateAvailable --> usDownloading --> usWaitingRestart
  18. Logout and Back into Windows
  19. Verify a pop-up Keyman(Keyman update) is ready to install with two buttons install and close.
  20. Press the install button on the dialog.
  21. Verified that the two dialog appear to install the build. ("Do you want to allow this app to make changes to your device?")
  22. Press the yes button on the dialog.
  23. Verified that the "Keyman setup" dialog appears and has a "restart now" button.
  24. Press the "Yes" button to restart the machine.
  25. Login into Windows
  26. "Do you want to allow this app to make changes to your device?" dialog appears and then press the yes button.
  27. Verified the installation dialog and completed it.
    It works well. Thank you.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Jan 29, 2025
@@ -451,14 +453,14 @@ procedure RunKMCOM(FMode: TKMShellMode; KeyboardFileNames: TStrings; FSilent, FF
Exit;
end;

if not FSilent and (FMode in [fmStart, fmSplash, fmMain, fmAbout]) then // I4773
if not FSilent and (FMode in [fmStart, fmSplash, fmMain, fmAbout, fmBoot]) then // I4773
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? Previously, we used -s as the boot switch, which meant FSilent = True. So I don't think fmBoot should be checking TIP install status?

Copy link
Contributor Author

@rc-swag rc-swag Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because we were overloading the -s to use it for boot which wasn't a perfect match. For boot we wanted -s to supress splash screen or configuration. but checking the DoCheckTIPInstallStatus?
I have changed it back. DoCheckTIPInstallStatus does nothing anyway as it is all commented out. DoCheckTIPInstallStatus
I have created an issue to investigate cleaning this up. #13100

@@ -323,7 +323,7 @@ procedure TUtilKeymanOptionEntry.CustomSave;
if OpenKey('\'+SRegKey_WindowsRun_CU, True) then
begin
if FBoolValue then
WriteString(SRegValue_WindowsRun_Keyman, '"'+TKeymanPaths.KeymanDesktopInstallPath(TKeymanPaths.S_KMShell)+'" -s')
WriteString(SRegValue_WindowsRun_Keyman, '"'+TKeymanPaths.KeymanDesktopInstallPath(TKeymanPaths.S_KMShell)+'" -boot')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to reapply the -boot flag to the setting when we upgrade from an earlier version of Keyman? AFAICT, the registry setting is not rewritten during the upgrade.

Copy link
Contributor Author

@rc-swag rc-swag Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I read it is that RunTools.PrepareForReboot Deletes the key SRegValue_WindowsRun_Keyman.

// Delete the Keyman autostart; it will be reinstated when setup finishes

Then it is setup again with firstrun via the options being passed through the command line ..... and the those options being applied. I didn't step all the way through.

I will add a test to this attaching an old build with the -s then have it be upgraded with this PR build

@keymanapp-test-bot keymanapp-test-bot bot added the user-test-required User tests have not been completed label Jan 30, 2025
@dinakaranr
Copy link

Test Results

I tested this issue with the attached "Keyman-18.0.175-alpha-test-12995" build(30/01/2025) on Windows 10. I'm sharing my observation here.

  • TEST_ON_STARTUP_UPDATED (Passed):
  1. Installed the "Keyman-18.0.175-alpha-test-12956" PR build.
  2. Open Keyman Configuration and check Start with Windows option
  3. Open the regedit window
    WinR type regedit Go the current key Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Keyman
  4. Verified that the "C:\Program Files (x86)\Keyman\Keyman Desktop\kmshell.exe" -s
  5. Uninstalled the "Keyman-18.0.175-alpha-test-12956.exe" file
  6. Download the Keyman for Windows attached to this PR("Keyman-18.0.175-alpha-test-12995").
  7. Double-click on the file to install it. Ensure you choose the install options and select the 18.0.175-alpha-test-12995
  8. The setup will ask you to reboot the computer to continue installing. Once you have rebooted, the installation is complete.
  9. Open the regedit window WinR type regedit Go the current key Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Keyman
  10. Verified that the "C:\Program Files (x86)\Keyman\Keyman Desktop\kmshell.exe" -boot
    It works well. Thank you.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Jan 30, 2025
Base automatically changed from feat/windows/kmshell-switch-handling to master January 30, 2025 23:59
@rc-swag rc-swag requested a review from mcdurdin January 31, 2025 00:15
@rc-swag rc-swag merged commit 53daacd into master Jan 31, 2025
6 checks passed
@rc-swag rc-swag deleted the feat/windows/12994/add-boot-switch branch January 31, 2025 02:09
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.182-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

feat(windows): Add -boot switch to kmshell
5 participants