How to Set a Keyboard Shortcut for “Always on Top” In Ubuntu

In Linux you can easily set a particular window to be always on top of other windows by right-clicking on the title bar and selecting the “Always On Top” option. This is useful when you need to constantly refer to the information in a window. However, if you are more of a keyboard user, you will find it troublesome to reach out to your mouse to activate the “Always On Top” function. Here is how you can set a keyboard shortcut for the “Always on Top” function in Ubuntu.

Note: this tutorial will work for most Linux distro, though the way to set the keyboard shortcut might differ.

There is a hotkey assigned to the “Always on Top” function. For any window that you want to make float, all you have to do is press the “Alt + Space” combination to bring up the menu option, then press “T” to activate the “Always on Top” function.


This is the easiest way so far, and it works out of the box, regardless of the distro you are using. The bad thing is that it is a two-step process, and the placement of the shortcut keys might not be convenient for you.

Another way is to set your own keyboard shortcut to quickly toggle the “Always on Top” function. For this to work, you will need to install wmctrl – a command line tool to interact with X Window Manager.

To get started, install wmctrl with the following command:

sudo apt-get install wmctrl

Once installed, go to “System Settings -> Keyboard -> Shortcuts”. On the left pane, select “Custom Shortcuts” and click the “+” button.


In the popup window, enter the following:

Name: Toggle Always on Top
Command: wmctrl -r :ACTIVE: -b toggle,above


Click “Apply.”

Next, click on the “Disabled” field and add your own keyboard shortcut for this toggle. In this case, I have used the shortcut “Alt + Shift + A” to toggle the “Always on Top” option.

That’s it.

The “Always on Top” function is very handy, and having a keyboard shortcut to toggle it can help improve your productivity. Try it out, and let us know if it works for you.