How To Use A Keyboard Shortcut To Toggle Always On Top On GNOME, KDE, MATE, Xfce and Cinnamon Desktops
This article shows how to use a keyboard shortcut to set a window to be always on top, on GNOME, MATE, Xfce, Cinnamon and KDE Plasma desktops, as well as a generic shortcut that works with any EWMH/NetWM compatible X Window Manager (so this generic solution doesn't work on Wayland).
Set an Always on Top keyboard shortcut on GNOME desktop
GNOME doesn't have a default keyboard shortcut for Always on Top any more (it used to have Alt + Space
, then t
), but there is an option to set your own keyboard shortcut for this window feature. The option is not exposed in Settings - > Keyboard Shortcuts though.
To access the option that allows setting a keyboard shortcut for Always on Top, open Dconf Editor and go to /org/gnome/desktop/wm/keybindings
. There, set a keyboard shortcut for always-on-top
in this form (example): ['<Alt>1']
, ['<Control>2']
, ['<Control><Shift>a']
and so on, but obviously, set it to what you want to use for this. Disable the "Use default value" toggle to be able to enter a shortcut.
Set an Always on Top (Keep Above Others) keyboard shortcut on KDE Plasma
KDE Plasma has an option that you can use set a window Always on Top, called Keep Window Above.
To set a keyboard shortcut to toggle this Keep Window Above option on/off, go to System Settings -> Shortcuts -> Global Shortcuts
, search for Keep Window Above
, and then you'll see an option to assign a keyboard shortcut to this option, like in the screenshot above.
Using the built-in keyboard shortcut to toggle Always on Top on MATE, Xfce and Cinnamon desktops
MATE, Xfce and Cinnamon desktops have a built-in keyboard shortcut to toggle the Always on Top window option.
On MATE and Cinnamon, focus a window, then press Alt + Space
, then t
to set a window to be always on top. Toggle it off using the same key combination. Cinnamon also offers the ability to set a custom shortcut for this: System Settings -> Keyboard -> Shortcuts -> Windows -> Toggle always on top
.
For Xfce, toggle Always on Top using Alt + F12
. Or use the same Alt + Space
, then t
to enable Always on Top; however, to toggle it off, use Alt + Space
, then o
. Xfce offers the ability to change the key to toggle the window above option: Settings -> Window Manager -> Keyboard -> Toggle above
.
Using a generic way of setting a window Always on Top (X only)
If the desktop environment you're using doesn't have a way of setting a keyboard shortcut for the Always on Top window option, or you want to use a custom shortcut and the desktop environment you're using doesn't support this, you can use wmctrl to set a window always on top.
Here's the wmctrl official description: wmctrl is a command that can be used to interact with an X Window manager that is compatible with the EWMH/NetWM specification. wmctrl can query the window manager for information, and it can request that certain window management actions be taken.
Install wmctrl:
- Debian / Ubuntu and Linux distributions based on these 2, like Pop!_OS, Zorin OS, Elementary OS, etc.:
sudo apt install wmctrl
- Fedora:
sudo dnf install wmctrl
- Arch Linux / Manjaro:
sudo pacman -S wmctrl
- openSUSE:
sudo zypper install wmctrl
To use wmctrl to set Always on Top, open your desktop environment's custom keyboard shortcuts dialog, add a new shortcut and use this as the command:
wmctrl -r :ACTIVE: -b toggle,above
This uses wmctrl to toggle the "above" window property, so it sets a window Always on Top if it's not already, and it turns Always on Top off if it's active.
You might like:
- How To Record And Play Mouse And Keyboard Events Using Atbswp Macro Recorder (GUI)
- Run Or Raise Application Windows On Linux (X11) Using A Single Keyboard Shortcut With jumpapp
- How To Automate Repetitive Typing (Text Expansion) With AutoKey On Linux
- How To Bind Mouse Buttons To Keyboard Keys Or Commands (Linux Using X11)
- Use Espanso Text Expander To Save Time And Increase Productivity (Linux, Windows, macOS)