Enabling the touchpad scrolling in VSCode (or electron apps) on Lenovo laptops

Issue

The touchpad scrolling on VSCode behaves like arrow keys:

  • When I scroll, the caret moves up or down instead of the scrollbar.
  • When I scroll with Ctrl key pressed, the scrollbar moves. Probably its because Ctrl+(Up|Down) is assigned to the scrolling in the default setting of VSCode.

Moreover, the scrolling on the tooltip does not work, so I had to drag&drop the scrollbar (troublesome!)

A hacky solution is suggested here:
github.com
It works, but the renaming can cause the problem in the automatic update, so I wanted a natural solution to this issue. And this situation of the task manager is terrible

My environment

Solution

Rewrite the registry and make the touchpad driver recognize that Code.exe has to be treated as an electron app.
Of course, it is strongly recommended to make a restoring point of System Restore, get the bitlocker key, and take the backup of the registry entry.

1. Open regedit.exe
2. Find "APOptimize" by searching, and go to "Google Chrome Browser" below. In my environment, it is at

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Elantech\APOptimize\Google Chrome Browser

3. Export the entry of "Google Chrome Browser", and save it.
4. Open the exported registry file by an editor and rewrite it like this (do not change "Option" and "Scroll":

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Elantech\APOptimize\VSCode]
"Text"="VSCode"
"Class"="VSCode_WidgetWin_1"
"FocusText"=""
"FocusClass"=""
"FileName"="Code.exe"
"Option"=hex:01,00,00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00
"Scroll"=hex:01,01,01,01,b9,9b,7d,5f,41,32,28,1e,a0,84,6c,58,48,3c,34,30,01,02,\
  05,07,0a,11,23,4b,02,5d,02,02,5d,02
"Zoom"=hex:58,28,18,10,0c,08,02,02,58,28,18,10,0c,08,02,02,01,02,05,07,0a,11,\
  4b,4b

5. Apply the modified registry file to the system.
6. Reboot. It should work.

How I solved it

According to the hacky solution above, the driver changes the behavior depending on the filename, so I run "ag chrome" in the driver directory, then I found it is writing about chrome things in the registry.