Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Sunday, February 18, 2024

Disable Windows double-finger-click

My new work laptop did not have dedicated buttons, and by default Windows set it up so that a two-finger tap or click on the touchpad would trigger a right-button click. I turned on the non-default setting that lets me click in the lower-right part of the touchpad to get a right button click, and turned off the two-finger tap options. There is no way to turn off the option for generating a right-button click with a two-finger click. 

This might seem quite innocent, but I kept on getting fake right-button clicks instead of left-button clicks when clicking the touchpad. I changed the registry settings to make the right-click area really small. It didn't solve the problem. Finally, I figured out what was going on: I click the touchpad with the side of my right thumb. This seems to result in the touchpad occasionally registering the tip and joint of my right thumb as separate contacts. The bad right-clicks were driving me crazy. I searched through registry and Windows .sys and .dll files for some hidden option to turn off the two-finger click for right-button clicks, finding nothing. Nothing. I tried to install some older proprietary touchpad driver, but none of them worked.

Finally, it was time to write some code to disable the bad right clicks. After a bunch of hiccups (I almost never write code that interacts with the Windows API), and a Python-based prototype, I wrote a little C program. Just set disable-two-finger-right-click.exe to run as Administrator in Task Scheduler on login, and it takes care of it. The code uses rawinput to get the touchpad HID report, uses the HidP-* functions to parse it, and registers a low level mouse hook to remap the bad right clicks to left clicks based on some heuristics (mainly based around how long ago there was a two-finger click before the right click, while ignoring the official right-click area of the touchpad). 

So many hours that would have been saved if Microsoft just added an extra option.

Monday, August 31, 2020

Reinstall Microsoft Store on Windows 10

This is really just a note to self for future reference. I had uninstalled Microsoft Store very completely on my Win10 laptop, but then wanted it back. None of the solutions I found online worked out of the box. Finally, here is what worked (a variant of something I found online):
  1. Go to https://store.rg-adguard.net/
  2. Enter in the URL: https://www.microsoft.com/store/productId/9WZDNCRFJBMP and click on the checkmark
  3. Download the latest WindowsStore*.AppxBundle and WindowsStore*.BlockMap files
  4. Start powershell in admin mode
  5. cd [your download directory]
  6. get-item *WindowsStore*.appx* | Add-AppxPackage

Friday, January 26, 2018

Windows clip command

The Windows command-line clip command is really great. You can pipe text into it, and it puts it into the clipboard. I write most of my blog posts in a text editor, run them through a bash script that does

pandoc -S $1 | perl -pe 's|(.*?)|$1|g' | iconv -f utf-8 -t utf-16le | clip
and then just paste them right into blogger. Sometimes when I want to write an email to all my students, I run a python script that extracts the emails from the csv file on our class list server, pipe the output into clip, and then just paste it into my email.

Wednesday, January 29, 2014

wincloudprint.py: Google Cloud Print Windows service

We're thinking of replacing my wife's netbook with a Chromebook, but printing is an issue. Our laser printer is over a decade old and while it works fine on our network (with a network adapter) it certainly doesn't support Google Cloud Print. Google really should have added support for local network printers. Their standard solution is a proxy that runs on some computer on the network via Chrome. But the standard way of doing that has two problems: (1) Chrome presumably takes up a lot of memory (I haven't checked just how much) and I don't want it running in the background all the time, and (2) it runs as a user application, not as a service, so a user for whom this has been configured needs to be actually logged in on the computer. Google has a solution to (2), but I didn't manage to get it working.

Fortunately, I managed to adapt the Linux python scripts from cloudprint to make a Windows solution, available here as "wincloudprint" (GPL3). Alas, installation is a bit of a bear due to license issues (I can't just include everything in one self-contained download): you need to install python, pywin32, SumatraPDF and wincloudprint. (SumatraPDF is used for handling the actual printing.) All the instructions are at the link. I don't know know that anybody other than myself will be interested in this, but I thought I'd share it.