I am looking for the keyboard equivalent to pressing mouse middle roller-button while cursor is at window top title bar. This lowers that window so its behind all other windows.
I am looking for the keyboard equivalent to pressing mouse middle roller-button while cursor is at window top title bar. This lowers that window so its behind all other windows.
A shamlessly dirty solution
To achieve a command that does what you want turns out to be more complicated than it seems at first sight. The issue is to lower the window and maintain the window order (z-wise) at the same time, which seems nearly impossible. Both
xdotool
andwmctrl
provide commands to raise a window, but not to lower a window.The solution below is a dirty hack/workaround, but it works nicely and reliably nevertheless. It uses both
wmctrl
andxdotool
, which are not on your system by default.Although the script is run by a keyboard shortcut, it actually does exactly the same as when you middle-click on the top of your window. What it does:
xprop -root
)wmctrl -lG
as a window)This all happens in a split second, so you won't even notice the mouse moving and moving back. The only thing you notice is the window sent to back, which is exactly what you want.
The script
How to use
Install both
wmctrl
andxdotool
Copy the script above into an empty file, save it as
sendtoback.py
Test- run the script by opening a terminal, run the command in it:
The window should be sent to the background, exactly like you were used to when middle-clicked.
If all works fine, Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
to a key shortcut of your choice.
Note
In some cases (especially on slower systems), the sleep time in the line:
needs to be increased. On faster systems, it could be reduced.
Gnome provides keybindings via
gnome-keybinding-properties
in Gnome 2, and viagnome-control-center keyboard
in Gnome 3.In Gnome 2, the default active keybinding that comes close to what you want is
using a shortcut of Win+space
Edit: I'm using
mate
now, which is a fork of Gnome 2, and using the command line gives me either "Command not found" for gnome-keybinding-properties, or a core dump for gnome-control-center.But using the UI, the key binding are accessible under
System
->Control Center
->Hardware
->Keyboard Shortcuts
. It's easiest to collapse theSound
,Desktop
, andAccessibility
sections, which leavesWindow Management
. "Raise window if it's covered by another window, otherwise lower it" is in about the middle of the section, and, in Mate, is disabled.