Kill the currently active window with a keyboard shortcut

I think you are looking for xkill.

Start it in a shell, then click on the offending window.

Alternatively, you can do Alt-F4 and wait - then you will be asked

the program is not responding - terminate it? (you will lose unsaved work)

Use xdotool to kill the currently active window:

xdotool getwindowfocus windowkill

On Ubuntu, make a keyboard shortcut:

  1. Open Keyboard settings (shown below).
  2. Create a shortcut with the command: xdotool getwindowfocus windowkill

I chose: Ctrl+Alt+x

This shortcut will kill the currently active window immediately. It will not wait for the application to respond, terminate, save, close files, finish up, etc.

Keyboard Settings

The default kill-window shortcut for me in KDE is Ctrl+Alt+Esc

enter image description here

(There's a separate Alt+F4 "close window" entry)

System Settings -> Shortcuts and Gestures -> Global Keyboard Shortcuts -> KWin