Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Recently I wanted to test a keyboard shortcut, which is supposed to kill X server (hence very useful when you have a crash). That shortcut is not dependent on any particular window manager (like lxde, unity, kwin etc). So, it must work, even when you have unresponsive (to keybings) window manager (as opposed to Alt+Ctrl+Backspace which kills the session, and bring you a login screen).

That's why I interested to make my window manager(unity) unresponsive. Is past, it was very easy. Opening a terminal, typing unity --replace and then force close the terminal, was the simplest procedure. But unfortunately, This is not true in Ubuntu 12.04, (they make it very robust) Because whenever I kill the terminal, Unity automagically restart itself.

I also tried compiz --replace but wasn't successful.

My question is: How can I make Unity unresponsive to any keyboard shortcuts (of it's keybindings) while I am in Unity session, so that I can test the global shortcut.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The answer from Eliah Kagan was great, But I think, I can answer now from my experience in less technical words.

There are two ways (as revealed to me) to test that keyboard shortcut:

  • Open a terminal and type unity or unity --replace (both are same) and hit Enter

    If you want a crash like look of Unity

    • While you are on the terminal, Press Ctrl + C, the unity will be stopped immediately.
    • Then try your global shortcut.

    If you want a decent look of Unity (Freeze)

    • While you are on the terminal, Press Ctrl + Z (as suggested by @Eliah Kagan), the unity will be suspended immediately. Everything will be freezed, except the cursor.
    • Then try your global shortcut.

keyboard shortcut to kill X:

That particular keyboard shortcut was : Alt + PrtSc + K . You will need this, if you wanted to try.


Thanks to @Mahesh, for revealing that shortcut

share|improve this answer

Running unity --replace and then closing the Terminal doesn't make unity unresponsive in any version of Ubuntu. It causes unity to not be running altogether.

It seems that in 12.04, unity will (usually) then restart by itself; in previous versions, it generally won't.

If you actually need to make unity unresponsive, you'll have to use a different technique. Perhaps you could edit your question to elaborate about your specific needs.

A generic way to make a program stop responding is to press Ctrl+Z in its controlling terminal. So if you run unity --replace in a Terminal window (or virtual console), you can do that, and it will stop, without terminating.

You can also do this manually with SIGSTOP and SIGCONT (that is, kill -STOP PID and kill -CONT PID, where PID is the process ID of the process you want to make unresponsive). But having an associated terminal for the process in which you press Ctrl+Z is better because then the shell running in that terminal will let you use job control on the process. That is, it will be listed with jobs, and you can make it respond again with either bg or fg. See the official bash documentation for more information.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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