Debian center window keyboard shortcut
On Debian Stretch (9.5), wanting to add a keyboard shortcut which un-maximises the current window and centers it, making it slightly smaller than the screen resolution, so that some of the background can be seen.
Finds the Mozilla Firefox window and stops it from being maximised:
Finds the Mozilla Firefox window and sets it to a specific size. Note that if the window is maximised, this will appear to do nothing:
Uses xdotool
to get the active window rather than hard-coding “Mozilla Firefox”. Combines the above two commands into a one-liner:
This one-liner can then be bound to a keyboard command.
In Debian, go to Settings → Keyboard, then scroll to the bottom and click the plus sign to add a new keyboard shortcut. I pasted the above command, named it “Center window” and bound it to Ctrl+Super+Down.