News, tips, partners, and perspectives for the Oracle Solaris operating system

Killing Xsun with a keystroke

Alan Coopersmith
Senior Principal Software Engineer

Every few months I get asked how to do this, and have to go dig it up again, so I may as well post it here to save me the trouble of trying to remember where I posted it last.

You can configure Xsun to let you kill it with a keystroke, much like the Xorg and XFree86 servers. To do this, you need to activate the X Keyboard Extension (XKB) which extends X keyboard handling in a number of ways. (It's on by default in recent versions of XFree86 and X.Org releases, but not in Xsun since there are still some issues in the Xsun implementation and XKB keyboard maps to work out.)

To do this, add +kb to the Xsun options in /etc/dt/config/Xservers to start in XKB mode. (If /etc/dt/config/Xservers doesn't exist, create it with "mkdir -p /etc/dt/config ; cp /usr/dt/config/Xservers /etc/dt/config/" .)

Now login and run 'xmodmap -pke | grep Delete' - it should print a line like this, though the number varies depending on keyboard type.

	keycode  83 = Delete
Take that line and feed it back into xmodmap with "Delete Terminate_Server" added to the end like this:
	xmodmap -e "keycode  83 = Delete Delete Terminate_Server"
Now pressing AltGraph (or the right Alt key on PC's) + Delete should cause Xsun to exit. To make it permanent, you probably want to stick the xmodmap command in your $HOME/.dtprofile or somewhere similar. You can pick other keys to modify if you prefer a different combination - though you probably want one that you won't hit by accident, are likely to press when you put a book down on your keyboard, or your cat decides it's time to get your attention by walking across the keyboard.


Join the discussion

Comments ( 1 )
  • KDC Tuesday, June 15, 2004
    working from home
    is the wave of the future
    but when your xserver hangs
    its just so much tuture (er...torture)
    ipfilter is configured
    to let no one in
    my MS laptop watches laughing
    its a shame and a sin
    why wont it unhang
    i press ctrl-c
    reboot it again
    son of a b.....
    so fridays production
    is just loads of fun
    my day consists of
    altgraph-deleting xsun ;)
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.