2024年12月24日
Copilot in Windows made headlines with the news that it’s the first new key to be added to PC keyboards in about 30 years. Recently, I got a new PC after three years (this time, I chose Fujitsu’s ultra-light FMV Zero) which does have a keyboard with the Copilot key. But how often will I actually use the Copilot app day to day? It’s quite iffy. At the moment, AI integration into Windows OS isn’t yet so practical, so it feels like Microsoft added the key more as a preparation for the future —and to garner attention— than anything else. In reality, I find ChatGPT more convenient than the current iteration of Copilot because it lets you choose the latest LLMs or use new features like Code Interpreter (especially if you subscribe to ChatGPT Plus). So apologies to Microsoft, but as the first thing to do after buying a new PC, let’s re-map the Copilot key to open the ChatGPT app! (Of course, if you follow the steps here, you can map the key to any other app, not just ChatGPT.)
Note: ChatGPT for Windows does already include a built-in “Companion Chat,” which you can launch by pressing
Alt + space
. However, this method doesn’t let you view your past conversation history, so can be a bit inconvenient.
First, install the ChatGPT for Windows app from the Microsoft Store.
To launch a Microsoft Store app via code, you need to know its App ID. This ID should remain the same even if the app is updated, but there’s a chance it could change. If that happens, you’ll need to update the script (introduced later) with the new ID.
Once ChatGPT is installed, open PowerShell and run Get-StartApps
. You’ll see a list of apps installed for the current user, along with their IDs. Look for ChatGPT’s ID and copy it. It should look something like OpenAI.ChatGPT-Desktop_********!ChatGPT
.
Below, I’ll explain two different ways to set this up. I recommend the first method, which uses AutoHotKey, because it had less lag before ChatGPT launched.
Windows + Shift + F23
. We just need to intercept this shortcut and do the following:
Alt + Tab
).This way, each time you press the Copilot key, you can toggle between your current app and ChatGPT. (Because this is a fairly simple implementation, be aware that on multi-monitor setups, Alt + Tab
may bring up “the last-used app on the current monitor,” which might cause unexpected behavior.)
Save the following script as something like launch_chatgpt.ahk
. Replace CHATGPT_APP_ID
in the code below with the ID you copied earlier:
#Requires AutoHotkey v2.0+
; Place this script in the 'shell:startup' folder so it runs automatically on every boot.
; Hotkey: Left Win + Left Shift + F23 (corresponds to the Copilot key)
<+<#F23::
{
; Define the executable name of the ChatGPT app
appExe := "ChatGPT.exe"
; Check if the ChatGPT app is currently active
if WinActive("ahk_exe " . appExe) {
; Emulate Alt+Tab to return to the previous application
Send("{Alt Down}{Tab}")
Sleep(100) ; Small delay to ensure smooth execution
Send("{Alt Up}")
} else {
; Check if the ChatGPT app is running
if WinExist("ahk_exe " . appExe) {
; If running, bring ChatGPT to the foreground
WinActivate("ahk_exe " . appExe)
} else {
; If not running, launch the ChatGPT app
Run("shell:AppsFolder\CHATGPT_APP_ID")
}
}
return
}
Then double-click the file to load this script and test whether pressing the Copilot key launches ChatGPT.
To have this script run at startup, press Win + R
, enter shell:startup
, and drop your .ahk
file into the folder that appears. This will ensure the shortcut is activated every time you log in.
You can do something similar using Windows’ (quasi) built-in PowerToys, but it ends up taking about a second to run the .bat
file, which makes it feel laggy. Just for completeness, here’s a short overview of that method:
.bat
file to launch the ChatGPT app (using the AppID
mentioned above).
start shell:AppsFolder\CHATGPT_APP_ID
.bat
file.
.bat
file, select “Show more options,” etc..bat
file.Ctrl + Alt + A
.Windows + Shift + F23
to the newly-assigned Ctrl + Alt + A
.Enjoy a smoother LLM lifestyle with this little trick!
□