1. Home
  2. Windows Tips
  3. Use a script to pin a window to the top with a keyboard shortcut

Use A Script To Pin A Window To The Top With A Keyboard Shortcut [Windows]

Our daily workflow often involves one app that we simply cannot function without. It might be the web browser for some and Photoshop for others. It depends on what you do but what many people often need, regardless of what line of work they’re in, is to pin an app on top of all others so that it’s never ever sent to the background even when out of focus. Some apps have this feature built-in but they are a very rare breed. Third-party apps like PinMe do a decent job of letting users pin any app or window to the top but they aren’t the most convenient to use given they lack support for hotkeys. If you’re looking for a way to pin the current active window to the top in Windows 10, you can use AutoHotkey and a little script to get it done. The script will let you use the Ctrl+Space bar shortcut to pin a window to the top. Here’s how it works.

Step 1: Download and install AutoHotkey. It’s a tried and tested, and very reliable app that’s been around for a good long while.

Step 2: Once installation is complete, right-click on your desktop and select New>AutoHotkey Script. This will create a new AutoHotkey file on your desktop. Rename it ‘Pin To Top’ or something similar so you know what it’s for.

newhotkeyscript

Step 3: Right-click the file and select ‘Edit Script’ from the context menu. Paste the following in it (you don’t need to keep any of the default script) and save it.

^SPACE::  Winset, Alwaysontop, , A

hotkeyscript

Step 4: Close the file, right-click the file icon and select ‘Run Script’ from the context menu. A small H icon should appear in the system tray to indicate the script is running.

runsript

Step 5: Bring any app window into focus and hit Ctrl+Space to pin it to the top. To unpin it, hit Ctrl+Space again. It works like a charm. It will work on Windows 7, 8/8.1, and 10.

1 Comment

  1. I have had an AHK freeware utility out there for years called Topmost Toggle. Hitting the hotkey toggles the topmost attribute of the active window. Also a ToolTip is shown to indicate the setting toggled on or off. The attribute is ORed or XORed with the existing window attributes so that only the Topmost bit is effected. Googling TopmostToggle should find it.