How to use keyboard shortcuts to always switch between GNOME, KDE, MATE, Xfce and Cinnamon desktops

This article explains how to use keyboard shortcuts to set the window to always be on top of the GNOME, MATE, Xfce, Cinnamon and KDE Plasma desktops, and how to use the universal shortcuts with any EWMH/NetWM compatible X window manager (hence the The general solution does not work on Wayland).

GNOME no longer has a default keyboard shortcut for “always on top” (it used to have Alt + SpaceAnd then t), but there is an option to set your own keyboard shortcut for this window function. However, this option is not displayed in “Settings” -> “Keyboard Shortcuts”.

Dconf editor is always on top

To access the option that allows setting keyboard shortcuts for Always on Top, open Dconf Editor and go to /org/gnome/desktop/wm/keybindings.There 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 purpose. Disable the “Use Default” toggle button to be able to enter shortcuts.

KDE Plasma provides an option that you can use to set the window to always be on top, which is called the reserved window above.

KDE is always on top, keeping the window on top

To set a keyboard shortcut to toggle this “keep window above” option, go to System Settings -> Shortcuts -> Global Shortcuts, search for Keep Window Above, And then you will see an option to assign a keyboard shortcut to that option, as shown in the screenshot above.

MATE, Xfce and Cinnamon desktops have built-in keyboard shortcuts to switch the “always on top” window option.

On MATE and Cinnamon, focus on a window and press Alt + SpaceAnd then t Set the window to always be at the top. Use the same key combination to turn it off. Cinnamon also provides the function of setting a custom shortcut for this: System Settings -> Keyboard -> Shortcuts -> Windows -> Toggle always on top.

For Xfce, use Alt + F12.Or use the same Alt + SpaceAnd then t to enable Always on Top; However, to turn it off, use Alt + SpaceAnd then o. Xfce provides the function of changing the key to switch the window above the options: Settings -> Window Manager -> Keyboard -> Toggle above.

If you are using a desktop environment that cannot set a keyboard shortcut for the “always on top” window option, or you want to use a custom shortcut, and the desktop environment you are using does not support this method, you can use wmctrl Always place the window at the top.

This is the official description of wmctrl: wmctrl is a command that can be used to interact with the X Window Manager compatible with the EWMH/NetWM specification. Wmctrl can query the window manager for information, and can request certain window management operations.

Install wmctrl:

  • Debian/Ubuntu and Linux distributions based on these two, such as 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 set Always on Top using wmctrl, open the custom keyboard shortcuts dialog of the desktop environment, add a new shortcut and use it as a command:

wmctrl -r :ACTIVE: -b toggle,above

This uses wmctrl to toggle the “above” window properties, so it sets a window Always On Top (if it is not already open), and turns Always on Top off (if it is active).

You might like:

  • How to use Atbswp macro recorder (GUI) to record and play mouse and keyboard events
  • Use single keyboard shortcuts with Jumpapp to run on Linux (X11) or trigger applications Windows
  • How to use AutoKey on Linux to automatically perform repeated typing (text expansion)
  • How to bind mouse buttons to keyboard keys or commands (Linux uses X11)
  • Use Espanso Text Expander to save time and increase productivity (Linux, Windows, macOS)