4

Is there a setting in "Global Keyboard shortcuts" to center a floating window vertically and horizontally on the current desktop?

1
  • I have updated the answer.
    – DK Bose
    Mar 26, 2020 at 4:06

1 Answer 1

4

No, there isn't a default keyboard shortcut to center windows. (See the comment by mgraesslin in this reddit thread for why not!)

A convenient way to see what's available, by default, is to look at the[kwin] section in your ~/.config/kglobalshortcutsrc.

However, if you want windows to be centered when they're initially opened, navigate to System Settings > Window Management > Window Behavior > Window Actions and Behavior. In there, click on the Advanced tab and then make your choice from the dropdown that appears when you click on Placement.

If you want an existing window currently not centered to be centered by using a keyboard shortcut, look at the available Kwin Scripts compatible with your version of software.

Move Window to Center is one such script:

A simple KWin script that introduces a KDE Global Shortcut (Meta+C by default) for centering the active window in the current screen.

To install this script in Kubuntu 18.04***:


Before installing this script, please ensure that Meta+C has not already been assigned to something else. This script requires that Meta+C be available as the keyboard shortcut.


  • Open System Settings > Window Management > KWin Scripts.
  • Click on Get New Scripts ….
  • A new window opens. Enter "center" in the search box.
  • Look for Move Window to Center by artemisfowl2007 and click on Install. Once the installation is done, you can close the window.
  • Reboot. Pressing Meta+C should now move the active window to the center of your screen without altering its dimensions.

***This script also works in Kubuntu 19.10 (with Plasma 5.18.3) or in Kubuntu 20.04 (scheduled for release in April 2020).

1
  • Instead of reboot, you can just press Alt+F2 and run command kwin_x11 --replace. Feb 24, 2022 at 1:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .