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

Spread the love

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.

The easiest way without any configuration

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.

Setting your custom keyboard shortcut

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.

Conclusion

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.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Damien Oh

Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.

Comments (2)