Microsoft has provided a way to customize the Surface pen via the Surface app. I find this approach still limited for my needs so I decided to do my own customization. I have always used and liked Eventghost for what it does and so I decided to use Eventghost again here.
Installation is a breeze but I find that it is almost always best not to install Eventghost to the normal default “C:\Program Files (x86)” folder as I experienced difficulties to launch Eventghost automatically during system startup. I have elected to install Eventghost to “C:\EventGhost” folder instead. YMMV.
So after Eventghost is setup on the SP4, it is now time to configure it properly. I created a new file from scratch and added a Keyboard plugin. The keyboard plugin is an important step.
Essentially the only customization we are doing to the Surface pen is to assign different macros to how the pen will react when we press the eraser button. The pen knows when you press the eraser button once, press the eraser button twice and long press (i.e hold and press) the eraser button. The reason it is able to distinguish this is that each of these actions represent a certain keystroke on the keyboard.
To cut the long story short, the keyboard sequence corresponding to the eraser button is as follows:
- Press the eraser button once – equivalent to pressing the Windows Key and function key F20.
- Press the eraser button twice – equivalent to pressing the Windows Key and function key F19
- Long press (hold and press) the eraser button – equivalent to pressing the Windows Key and function key F18
Each time a keyboard key is press, Eventghost will log the key press on a window. Eventghost will be able to trap these keyboard sequence and assign different macros to it.
So what we want to do is to create macros for the Win+F18, Win+F19 and Win+F20 key.
I wanted to do this:
- When I short press the eraser button, I want to start OneNote in a maximize screen and bring it in front of all applications. If OneNote is already running, I want to bring it to the front and if OneNote is not already running, I want to now start it. Once OneNote is now at the foreground, another short press of the eraser button should now bring up a new small OneNote window to create a side note.
- When I long press the eraser button, I want to do a screenshot by capturing a certain region of the screen. I like PicPick so will want to use that in this application.
- When I hold and press the eraser button, I want to bring up the Windows start menu.
Obviously everyone’s requirement is different. The beauty of Eventghost is that it is able to program specifically to suit different needs.
This is how my EventGhost configuration looks like. I must admit the script is still a bit buggy at times so I will look to improve the scripts in due course.
The script is quite simple and should be rather self-explanatory for most users.
Hopefully this post will be helpful to those who want a bit more customization to the SP4 pen. Give it a try