On Thu, 31 Dec 2009 19:41:48 +0100 Matthieu Herrb <mhe...@gmail.com>
wrote:

> I don't know why you are looking for so complicated things.
> 
> Option "DontZap" in the xorg.conf "ServerFlags" section still works
> 
> If you don't want to setup a full xorg.conf, you can create it with
> just this section:
> 
> Section "ServerFlags"
>     Option "DontZap"
> EndSection
> 
> and it works as expected.


It works for us. :-)

But...

The recent moves to disable 'Zap' by default and disable the 'Option
DontZap' feature of xorg.conf in other operating systems, such as
FreeBSD, ubuntu, archlinux, and possibly others, has made things
complicated. Yep, some OS's have even completely removed the
"Terminate_Server" keysym so it cannot be enabled. Since some people
strongly disagreed with with disabling 'Zap' some OS's have returned to
making it possible to enable this feature (through yet another new
method).

        $ setxkbmap -option terminate:ctrl_alt_bksp

Some people consider the 'Zap' feature too dangerous, others think
the change makes emacs more usable, but the change of defaults was more
likely prompted by the addition of "Magic_SysRq_key" stuff to linux and
elsewhere.

http://en.wikipedia.org/wiki/Magic_SysRq_key

Their goal was to terminate X without needing to count on X itself still
being functional (i.e. not locked up). If you've ever locked up X so
badly that you can't change to another virtual terminal, you can see
the advantages. Of course, this means *everone* has to learn something
new, namely alt +SysRq+K, and ignore the instances of information
already existing about ctrl+alt +backspace and the "DontZap true/false"
feature.

I'm certainly not telling Matthieu anything he doesn't already know, (he
is "*THAT* Dude" when it comes to xenocara :-), but finding 'Zap'
disabled on other operating systems was highly annoying for me.

My personal opinion of liking the 'Zap' feature is irrelevant, but
knowing how to use the tools to enable/disable/create this feature on
the fly without restarting X is certainly useful.

(note: mailer line wrapping)

Find the keycode where your backspace key is mapped to Terminate_Server:
$ xmodmap -pke | grep -i backspace
keycode  22 = BackSpace Terminate_Server BackSpace Terminate_Server
BackSpace Terminate_Server $ 

To turn Zap *OFF*:
$ xmodmap -e "keycode 22 = BackSpace BackSpace BackSpace BackSpace
BackSpace BackSpace"

To turn Zap *ON*:
$ xmodmap -e "keycode 22 = BackSpace Terminate_Server BackSpace
Terminate_Server BackSpace Terminate_Server"

Unfortunately, the xmodmap(1) man page does not explain why there are
six keysym's for each keycode, and I haven't dug into the source yet to
figure it out.

Of course, there are other "complicated" ways to do this same thing.

To turn *OFF* the ctrl_alt_backspace termination of the X server,
one way to do it is change the "Terminate_Server" KeySym to just be the
same as the "BackSpace" KeySym.

$ xmodmap -e "keysym Terminate_Server = BackSpace"

Basically, you just over-wrote the keysym for "Terminate_Server" with
the keysym for "BackSpace" --This means *nothing* can use the
"Terminate_Server" keysym to terminate X.

After over-writing the "Terminate_Server"  KeySym, turning it back on is
different. To turn *ON* the ctrl_alt_backspace functionality again, the
best way to do it is to just reload your default keysyms (aka "symbols")
with setxkbmap:

$ setxkbmap -symbols "pc/pc(pc105)+pc/us"

That would put everything back the way it was when X originally loaded,
so you now have a usable "Terminate_Server" keysym, and it's once again
mapped to crtl_alt_backspace.

Let's assume you're using fairly generic keyboard mapping, such as:

$ setxkbmap -print 
xkb_keymap {
        xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc/pc(pc105)+pc/us"    };
        xkb_geometry  { include "pc(pc105)"     };
};

That esoteric looking string for the `setxkbmap -symbols ...` command
above is easy to understand; it's just grabbing configuration data from
the following files:

        /etc/X11/xkb/symbols/pc/pc   (the "pc105" section within)
        /etc/X11/xkb/symbols/pc/us

As for simply turning 'Zap' off with setxkbmap, I think that might be
somewhat painful to figure out, and would most likely require writing
your own replacement configuration files for 'compat' while maintaining
the defaults.

If the OS you've been *forced* to use at work (i.e. not OpenBSD) has
removed the "Terminate_Server" KeySym for the 'Zap' feature, and you
don't want to enable/use the "Magic_SysRq_key" stuff, you can add your
own keysym to re-enable the functionality.

edit:   /etc/X11/xkb/compat/misc

make sure you have:
        default partial xkb_compatibility "misc"  {
                ...
                interpret Terminate_Server {
                        action = Terminate();
                };
                ...
        }

Yep, all of the above are "complicated ways" to do things, but they
allow you to make changes without restarting X, and the very easy way
available on OpenBSD is not always available elsewhere.

I'm not sure which is more of a pain in the ass; forgetting the
classic 'Zap' that's been used of decades and (re)learning to use the
Magic_SysRq_key stuff instead, or repairing X on all the non-OpenBSD
systems you have to use?

I think next I'll rant about needing to have an alias on linux
so `shutdown -hp now` is remapped to `shutdown -hP now` ;-)


-- 
J.C. Roberts

Reply via email to