Skip to content

Instantly share code, notes, and snippets.

@sk22
Last active October 29, 2020 09:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sk22/770960609386251989e14aee8b7877ce to your computer and use it in GitHub Desktop.
Save sk22/770960609386251989e14aee8b7877ce to your computer and use it in GitHub Desktop.
Replace "PC Manager" Fn key with play/pause

Replace "PC Manager" Fn key with custom action

How I replaced the "PC Manager" Fn key on my Huawei Matebook X Pro with a play/pause button.

Background

The Huawei Matebook X Pro, as well as other devices from various manufacturers have a Fn key with a proprietary function. On the Matebook, it's a button that does nothing but open the so-called PC Manager software, and is located on the F10 key. Since at least I really don't need this function and am missing a play/pause Fn key, I decided to try replacing the function.

I first tried using SharpKeys to remap the key, but doing that results in all Fn keys acting as a play/pause button, which obviously wasn't what I wanted.

I don't know where the path to the PCManager.exe is set, but I assume it's hard-coded in the driver somewhere. However, it'd be easiest to just use the function that was already there (launch that specific exe file) and replace the file with something else.

Procedure

  1. Locate the exe file that is launched by pressing the specific Fn key.

    To do so, you can open the Task Manager and look for the program that is opened when pressing that key. Right-click the corresponding Task Manager item and click "Open file location".

    On my Matebook, that lead me to this path: C:\Program Files\Huawei\PCManager\PCManager.exe

  2. Uninstall the software. You probably won't need it anyway, but it's your decision. You could, alternatively, rename the PCManager.exe (or whatever it's called in your case) to something else, so you don't have to uninstall it, but I can't guarantee that the program would still start/run without problems.

  3. Create a custom EXE file that does what you want. I've decided to go with a simple AutoIt script and compile that to an EXE. For compiling, you need to install AutoIt, which will allow you to run scripts as well as compile them to an EXE file. Or, you can just use any other EXE file.

    You can also download the compiled EXE from here: https://gist.github.com/sk22/1116d05f3afbd7e7ef8c895926783b18/raw/7507e3d582d5e518cdcaebd6959217a1bf56335b/play-pause.exe

  4. Place the EXE in the path where the previously uninstalled software (PCManager in my case) was. In my case, I had to re-create the folder structure (C:\Program Files\Huawei\PCManager\), rename my EXE to PCManager.exe and place it in that folder.

Note that for some reason, the play/pause function won't work by double-clicking the EXE. Luckily tho, it will work by starting the EXE from a terminal window, or, how we need it anyway: by pressing that Fn key.

Send("{MEDIA_PLAY_PAUSE}")
; Download the compiled exe from here if you trust me:
; https://gist.github.com/sk22/1116d05f3afbd7e7ef8c895926783b18/raw/7507e3d582d5e518cdcaebd6959217a1bf56335b/play-pause.exe
; Note that you shouldn't normally trust strangers on the internet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment