0

I'm hoping to write a custom keyboard shortcut that will kill whatever program is in focus. I'm basically trying to copy cmd+Q from apple. I'm running ubuntu 17.10 so this is with the new gnome desktop environment. Any suggestions would help.

Thank you

2
  • Alt + F4 works with most GUI programs.
    – sudodus
    Jan 11 '18 at 19:20
  • xkill command displays cross instead of cursor, If you click with left button, it kills current window, if you click with right button, the command will stop. But this KILLS the window, so there can be data loss especially with libreoffice, so use this only if app freezes and doesn't respond.
    – FK-VH
    Jan 12 '18 at 17:12
1

If you're looking for Cmd-Q functionality, that's akin to Alt-F4 which sends the window close event. Other programs have their own shortcuts to activate a full 'quit' event. (e.x. Ctrl-Shift-Q in Chrome)

If you want to kill the current program in focus, we can set that up using a keyboard shortcut.

There's a similar question on SuperUser: https://superuser.com/questions/757160/kill-the-currently-active-window-with-a-keyboard-shortcut

From Kamil's answer: xdotool getwindowfocus windowkill will kill the current active window.

You can learn about setting these shortcuts in the official Ubuntu docs: https://help.ubuntu.com/stable/ubuntu-help/keyboard-shortcuts-set.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.