Archive

Posts Tagged ‘Macbook Pro’

HOW-TO: Get the ALT key to function properly under Mac OS X in Inkscape (and other X11 apps)

September 17th, 2013 No comments

This is a repost of my April 5, 2008 posting on InkscapeForum.com.

Please note that X11 does not support Mac OS X Mountain Lion, however we  have an alternative which is supported by Apple named XQuartz. XQuartz work same as X11, with few more features.

I’ve spent the last day or so struggling to get the ALT key working properly, and would like to share my solution. While there are a few postings out there on this topic, I’ve yet to find one that addresses both the lack of ALT key functionality and the correct displaying of ALT-key related status bar text.

Before proceeding, please be aware that this approach will overwrite any existing “.Xmodmap” file in your home directory, should one be present (if this makes no sense to you then don’t worry, you probably don’t have one and are safe to proceed). Also, I’ve tested this with Tiger, and with a two-button mouse. I’m not sure how Leopard differs (perhaps someone can confirm this?) and am not sure how this will function with a one-button mouse since we’re going to need to turn off the X11 setting that handles three-button emulation for the button-challenged users out there.

Step-by-step instructions

1
Launch X11 from Applications/Utilities

2
Open the preferences window and enable the “Use the system keyboard layout” preference. This will force X11 to use it’s system default keyboard layout.

3
Open an xterm window (Command-N) and perform the following:

$ xmodmap -pke > ~/.Xmodmap

This captures the current xmodmap settings to a hidden file located in your home directory. It’s this ~/.Xmodmap file that X11 will by default use to override any system mappings.

4
Edit your .Xmodmap file by typing the following in the same xterm window:

$ open -e ~/.Xmodmap

Change the line: “keycode 66 = Mode_switch” to “keycode 66 = Meta_L”
Change the line: “keycode 69 = Mode_switch” to “keycode 69 = Meta_R”

Save the file and exit TextEdit.

5
Disable the X11 preferences “Emulate three button mouse” and “Use the system keyboard layout”, then close the preferences window.

These settings basically say “don’t treat ALT as a special key, and don’t override my .Xmodmaps file with system defaults”.

6
Close the X11 preferences window, any opened xterm windows, and then the X11 application.

That’s it. Now when you launch Inkscape, the ALT key should work as expected, and the status-bar will correctly display any ALT-key-specific help when that key is pressed (e.g. when using the Selection tool).

One final note: from an xterm window, you can debug your key mappings by typing “xev”. This program will open an interactive test window that will echo information about current key/mouse presses, and is a handy utility for determining keycodes and what they’re currently mapped to.

Feel free to provide any feedback and/or request for further clarification.

Happy ALT-keying!