How to make a window stay always on top

A lot of Enhancer for YouTube™ users have asked me to add an option to make the pop-up player stay always on top of other windows, but it's not possible because browser extensions have limited capabilities so I'm gonna show you how you can easily do it using AutoHotkey, a popular free and open source software for Windows.

If you use Linux simply right-click on the title bar and select “Always on top".

How to install and use AutoHotkey

First you need to download AutoHotkey so go to the download page and click the “Download AutoHotkey Installer” button. Once downloaded, execute the file and select “Express installation”. If you select “Custom installation” it is recommended to select one of the “Unicode” versions. Once the installation is complete click on “Exit” to close the “AutoHotkey Setup”.

Now follow these steps to create the script that will be used by AutoHotkey:

  • On your desktop, right-click on an empty space and select “AutoHotkey Script” inside the “New” menu.
  • Give the script a name (e.g. AlwaysOnTop) and save it.
  • Right-click on the script and select “Edit Script”.
  • Replace the content of the file with the following code:
    #Space:: Winset, AlwaysOnTop, Toggle, A
  • Save the file.

That's it! Now double-click the script to run it then select the window you want to keep on top of the others and press W (Windows icon key) and Spacebar on your keyboard. When you want to restore the default behavior select the same window and press those keys again. When you want to completely stop the script right-click the green AutoHotkey icon in the system tray and select “Exit”. If you want to use a different key combination let me know in the comments.
If you want to set the size and position of the window you can modify the script to use WinMove. The following code will move the window in the top right corner but obviously you can specify your own X and Y coordinates and also the width and height of the window:

Winset, AlwaysOnTop, Toggle, A
WinMove, A, , (A_ScreenWidth - 854), 0, 854, 510