Fink & Apple's X11

      / X11 v0.1- FAQs /


- The Macosxhints Forums -


Apple X11 Beta v0.1
Frequently Asked Questions


This page was written while testing Apple's X11 Beta version.


For information about Apple's X11 1.0 and Fink read the following pages:
Essential
Fink & Panther
Fink-Panther 2
X11 1.0 FAQs



General Information

X11, Xfree86, X-Window
X11 installation
Locating software to run on X11
Installing software to run on X11
What is Fink?
Using Fink to install Software in Apple X11
Fink: Setting your PATH environment variable
(Miscellaneous - forthcoming)
Opening software with xterm or the apps launcher
The .xinitrc file

Tips and troubleshooting

Run X11 applications from Terminal.app
Problems with the hide command
The Mac menu bar coverup problem
Minimized windows
Events to the X11 root window
Hover events from underlying app
Cut and Paste Problem
Resize gadget completely covers the scroll
How to run apps at launch
Trouble getting ssh-agent working with Apple X11
Problem with zombies
Problem with KDE and Apple's X11
Problems replacing Fink Xfree86 with Apple's X11
Confusion with Fink 'system-xfree86' placeholder package
Reflections on Firewall rule for X11 usage
How to pause a Fink installation for X11
To tell Matlab to use Apple's X11 public beta
Make xterm in Apple's X11 behave more like Terminal.app
Apple's X11 won't start anymore
Apple X11 Library Warning
Uninstalling Apple's X11

Keyboard Issues

Keyboard Problem
Delete key
To specify your Keyboard type (French Keyboard example)
Switching from USA to Italian Pro Keyboard in X11
Specific German keymapping Problem
Japanese keyboard input
Spanish Keyboard with X11

Font Issues

True Type Fonts are working well under Apple's X11
Adding to the font repository in Apple X11 on OSX
Apple's X11 and freetype aware applications
Tip for OpenOffice
Add extra X11 fonts






X11, Xfree86, X-Window

What is X11 for Mac OS?

From:
Apple's X11 Page

"X11 for Mac OS X offers a complete X Window System implementation for running X11-based applications on Mac OS X. Based on the de facto-standard for X11, the open source XFree86 project, X11 for Mac OS X is compatible, fast and fully integrated with Mac OS X. It includes the full X11R6.6 technology including a window server, libraries and basic utilities such as xterm".

What does "X11-based applications" mean?

These are applications that run in the X Window System, which is an open source graphic rendering engine used in Unix and Linux operating systems. Some of these applications include the popular Gimp graphic editing application, AbiWord word processor, and Open Office, which is a suite of applications similar to MS Office. To Learn more about X11 visit:

X.org web site

What is Xfree86?

From:
XFree86.org web site

"The XFree86 Project, Inc is the "organisation which produces XFree86, a freely redistributable open-source implementation of the X Window System which runs on UNIX(R) and UNIX-like operating systems such as Linux, all of the BSD variants, Sun Solaris x86, Mac OS X (via Darwin), as well as other platforms like OS/2 and Cygwin."


Summary:

Just as the Classic environment makes it possible to run classic Mac OS applications in Mac OS X, so does Xfee86 make it possible to run X11 applications in Mac OS X. Apple's X11 has radically simplified the process of installing this environment.





X11 installation

A.
Go to:
Apple's X11 Page

to download the most recent version of X11.
The download is around 40 MB.

B.
Check the bottom of that web page for 'Apple's SDK' package and download it (3.8 MB)

C.
Double-click the disk image of these downloads to install as with any other application.

--------------

If you have installed Xfree86 with Fink and want to install Apple X11:

First make sure that you remove your existing Fink xfree86 packages, use dpkg with the --force-depends option from the Command-Line, like so:

sudo dpkg -r --force-depends xfree86-rootless xfree86-rootless-shlibs xfree86-base xfree86-base-shlibs

Then install BOTH, Apple's X11 Public Beta (41.4 MB) and the Mac OS X Public Beta SDK. (3.8MB).

When done, then install Fink 'system-xfree86' package:

For binaries:

'sudo apt-get update'
'sudo apt-get install system-xfree86'


Or

To install the latest 'system-xfree86' package from CVS, run:
(you will need to install Apple December 2002 Developer Tools)

'fink selfupdate-cvs'
'fink install system-xfree86'






Locating software to run on X11

A. Check out:

OpenDarwin.org

for available X11 packages, most notably Gimp. Download and install as you do OS X applications.

B. For Open Office, go to:

OpenOffice web site

C. Installing packages with "Fink":

Fink currently lists a total of 2114 packages in 22 sections (as of 1-2-03) you could install in precompiled binary packages or build from source.

Download Fink from here

D. Installing packages with "FinkCommander":

FinkCommander is a graphical user interface for the Fink software packaging system for Mac OS X.

To download FinkCommander:

FinkCommander web site





Installing software to run on X11

First, make sure you download and install "BOTH", X11 Public Beta (41.4 MB) and the Mac OS X Public Beta SDK. (3.8MB) from Apple X11 web page:

Download Apple's X11

Do not download the "common toolkits" from OpenDarwin, they will likely interact poorly with Fink's installation.

Then, download and install Fink:

Download the Fink Installer

Once Fink's is installed, make sure that you install with it, the 'system-xfree86' package, version 4.2-3 or higher by running the following commands in terminal.app:

For binaries:

'sudo apt-get update'
'sudo apt-get install system-xfree86'


Or

To install the latest 'system-xfree86' package from CVS, run:
(you will need to install Apple December 2002 Developer Tools)

'fink selfupdate-cvs'
'fink install system-xfree86'






What is Fink?

Fink is free, fast and reliable. It offers the easiest and most painless install of Xwindows on macOS X. Fink currently lists in its database 2114 packages in 22 sections you could install, including the unstable tree and the latest packages from CVS (as 1-29-03). And, thanks to the hard work of the Fink developers, the fink packages seem to get updated fairly quickly to follow the updates in the basic unix source. If you feel you don't need fink anymore, it's extremely easy to uninstall, as it keeps all the things at one place. Fink has support 24/7 through the fink-mailing lists. For more information:

Fink Web Site






Using Fink to install Software in Apple X11

To install the software Fink uses package managment tools ported over from Linux:

apt-get, dselect

and it's own tool named ...'fink'

You can choose between two installing models:

1-Pre-compiled binary packages:
When you install a binary package what you get is a ready to run program saving you the time for compiling. The packages are tailor-made for Mac OS X / Darwin. The tools Fink use to install pre-compiled binary packages are:

'apt-get' and 'dselect'

2-The source distribution:
If you install from source you have the advantage to usually get newer software. You get to test the latest packages. With Fink, you can install packages from source, using its own tool named 'fink'.

So, if you run in terminal:

fink install 'packagename'

Fink will download the package, it will unpack it, apply any needed patches, auto-configure, compile, test, and install into a .deb file which gets installed for you by dpkg. Compared to binary installs, it's a slow process -- but it can be much more reliable in many cases.

To install packages from source with Fink, you need the latest version of Apple Developer Tools installed. After you register for free, you can get them from the ADC:

ADC





Fink: Setting your PATH environment variable

If you use tcsh (the default on Mac OS X), add the following line to the .cshrc file in your home directory:

source /sw/bin/init.csh

If you don't have a .cshrc file, run these commands:

Go to your home directory:

cd

Open the text editor pico, and create a file named .cshrc:

pico .cshrc

When the text editor open, type:

source /sw/bin/init.csh

at the end of the line press Return once.

Then press Control-O, Return, and control-X

to save the file and return to the prompt.

Now you should type rehash or close-open the terminal window.

Attention:
If you use tcsh and happen to have a .tcshrc file in your home directory, this will be read instead of .cshrc .

In this case, write then 'source /sw/bin/init.csh' in your .tcshrc file.

If you are using bash, sh or zsh:

Type in .profile:

source /sw/bin/init.sh

The scripts also add /usr/X11R6/bin and /usr/X11R6/man to your path so you can use X11 when it is installed.






(Miscellaneous - forthcoming)






Opening software with xterm or the apps launcher

In an xterm:
simply type the directory path of the Application and hit Enter.

- e.g.
/sw/bin/AbiWord

or just type:

AbiWord &

and hit Enter.

In X11, follow these steps:
A. Choose Customize from the Application menu.

B. Click "Add Item"

C. Double Click under Name in the new item and type the name of the application.

D. Double Click under Command and type the absolute path to the application:

- e.g.
/sw/bin/AbiWord

repeat steps B and C as needed.





The .xinitrc file

The .xinitrc file is a shell script that runs when you start the X11 system (or when it automatically starts for you).

This file contains the commands to define which applications are started when your X11 system boots up.

It contains, for example, the commands to start the window manager, some xterms or a desktop environment (like GNOME or KDE), along with various command line options to control their behavior or appearance, such as setting sizes, background colors, fonts, etc.

By default, Apple's X11 will execute the .xinitrc file if one is present. If not, it will launch the quartz-wm and launch an xterm.

If you want to run a bunch of apps at launch, add them to your .xinitrc file and add 'exec quartz-wm' if you want them to run with Apple's window manager. If you want Apple's X11 to run with another window manager, add 'exec wmanagername' to your .xinitrc file.

What is typically done is to start applications in the background and then finally start the window manager in the foreground. In this way, when exit from the window manager, the .xinitrc script exits and the X11 system goes away.

When the .xinitrc script exits, the X11 system will close down and allow you to logout.

You will find XFree86 xinitrc default file in:

/usr/X11R6/lib/X11/xinit/xinitrc

To make your own .xinitrc file, copy this file to your home directory:

cp /usr/X11R6/lib/X11/xinit/xinitrc ~/.xinitrc

Then, you can edit it with your own choices.

Some simple .xinitrc examples:

It will start 'autocutsel' and 'Windowmaker':
(You don't need autocutsel anymore in Apple's X11)
source /sw/bin/init.sh

autocutsel &

exec wmaker

This .xinitrc file will start an xterm and Apple's quartz-wm:
source /sw/bin/init.sh

xterm -geometry 75x34+687+40 &

exec quartz-wm

To use blackbox window manager, and start other apps at launch:
source /sw/bin/init.sh

xterm -geometry 75x34+687+40 &

multi-gnome-terminal --geometry 75x34+687+40 &

wmCalClock &
wmMoonClock &
wmSpaceWeather &
gkrellm -w &

exec blackbox







Run X11 applications from Terminal.app

To start X11 applications from Terminal.app:
Write in your .cshrc or .login or .tcshrc file:
if (! $?DISPLAY) then
   setenv DISPLAY :0.0
endif

----------

If you are using Bash:

if [ ${#DISPLAY} -eq 0 ]; then
   export DISPLAY=':0.0'
fi

----------

The 'standard' way to do it in the Bourne shells:

: ${DISPLAY:=':0.0'}
  export DISPLAY

This also works with zsh.





Problems with the hide command

Problem:

The hide command actually destroys the X11 windows. Any solution?

Workaround:
You should be able to revive all X11 windows after hiding. Just select X11 and then select "Bring All to Front" from the Window menu.





The Mac menu bar coverup problem

Window title bars disappear under the Mac menu bar.

Workaround:

1-
If you use wmaker instead of quartz-wm, one of the preference panels allows you to put a starting point for new windows (it works along with the automatic setting). You could start new windows at x=64 and y=64 for example.

2-
In icewm you can define an area for docks, start menus and other stuff, which programms cannot overlap. This is meant to be used with the gnome-panel, but it should also work with the apple-menu.

3-
Open your X11 applications with the geometry option:

Most all properly written X11 applications accept -geometry

(some use --geometry)

To start them at launch, write them in your ~/.xinitrc file, for example:

xterm -geometry 80x24+50+60 &

This will open an xterm that is 80 characters wide, by 24 high, that is 50 pixels right and 60 pixels down from the upper left corner of your screen.

multi-gnome-terminal --geometry 75x34+687+40 &


or write them in the X11 Application menu X11:
(Application menu -->Customize)

sw/bin/xemacs -geometry 70x30+100+40

sw/bin/gvim -geometry 80x30+687+40

The "units" in some programs are characters (xterm, emacs) and others use pixels.

For most programs the position +100+40 is in pixels.

To learn more about geometry check 'man X'
(GEOMETRY SPECIFICATIONS)





Minimized windows

Minimized windows sometimes become "passive": clicking doesn't maximize them and they can't be removed from the dock. Curiously, quitting X11 does not help: the minimized windows simply stay in the dock, do not respond to a click and still can't be removed. Restarting X11 doesn't change this. Up to now I've seen this only with xterm windows.

Workaround:
kill the Dock
logout - login helps





Events to the X11 root window

Greg Parker wrote 'xroot tool', it creates a small X11 window that routes input events to the X11 root window. In particular, you can click on it to get window manager menus.

You can get xroot tool from here:

sealiesoftware.com






Hover events from underlying app

An X application in the background still gets hover events when it should not. Little tooltips pop up from the underlying app even though you are in the Apple Mail application for example or if you have a GTK+ app open, and then move a non-X11 window over the GTK+ app, then the GTK+ tooltips appear over the non-X11 window.

This is caused by the way in which the X server gets pointer events from the real window server. They have recently fixed most of these problems, but fixing all cases may have to wait for the next version of the operating system.





Cut and Paste Problem

Apple X11 currently does not support cut and paste between other window managers and Aqua in the current beta release. This may get resolved in the next release.





Resize gadget completely covers the scroll

For those X-windows that have rightside scroll-bars that are the full height of the window and have a bottom scroll arrow, the quartz-wm resize gadget completely covers the scroll arrow.

Workaround:
The only workaround at present is to use a different window manager. Apple is aware of this problem and are trying to find a way to make the resize box less intrusive..






How to run apps at launch

To run a bunch of apps at launch, add them to your ~/.xinitrc file together with 'exec quartz-wm' if you want to run Apple window manager.





Trouble getting ssh-agent working with Apple X11

On other Unix-like systems I have ssh-agent launch the window manager, so I tried the following in my ~/.xinitrc:

exec ssh-agent /usr/X11R6/bin/quartz-wm

the agent is running...but the window manager isn't passing crucial env vars to its child processes, so trying to run ssh-add in an xterm results in "Could not open a connection to your authentication agent."

Workaround:
The problem is that quartz-wm has no child processes, it's the X server that spawns the commands in the Applications menu. So to make this work the way you want, you'll need to get the SSH_ variables into the initial environment of the X server, perhaps by starting it by hand from a shell.





Problem with zombies

(conversation I read at Apple's x11-users list)

When ever I exit from X, menu->quit, I get an X11 zombie that is left around.

It's a known problem, and has been mentioned on this list a couple of times. I believe the suggestion is that it will be fixed in the proverbial Upcoming Release.

If I log out, all the zombies disappear.

-Yup. That's when zombies are reaped.

What does the system do to get rid of the zombies??

-"The system" doesn't do anything. The parent of the zombified children either exits, in which case 'init' collects them and disposes of them; or it calls (or should call) wait(2) or one of its friends to collect them. That's not happening right now. Logging out will cause the former to occur.

Can I kill off the zombies without logging out??

-They're already dead, Jim. As has been observed at least once before, zombies are fairly benign, unlike movies about them. They essentially take up a process slot, but no (or few) other resources. Unless you are churning out a lot of processes, you shouldn't have to worry. It's mostly a cosmetic deal (which will be corrected, in the fullness of time).






Problem with KDE and Apple's X11

Problem:
If you open up any window in KDE, it stays behind the current windows you have open in Mac OS X. If you put the mouse pointer over the window, it activates it, but does not bring it above the OS X window.

Answer:
This is one of the known bugs of Apple's X11.app. They have promised to fix it in the next release. You cannot do anything about it, except hide the Aqua windows.





Problems replacing Fink Xfree86 with Apple's X11

Problem:
If you had Fink's XFree86 installed, and you replaced it with Apple's X11, and now everything's crashing:

Answer:
First of all, if you previously had the "threaded" versions of Fink's XFree86 packages installed, you may need to rebuild the application that is crashing. Some programs check for the availability of threading at build time, and then from then on believe that threading is available to them.

Secondly, you may have just hit an Apple X11 bug. As of the time of this writing, a number of bugs are known by the Apple team and are being worked on.






Confusion with Fink 'system-xfree86' placeholder package

Many people get confused between Fink's:

'xfree86-base' - 'xfree86-rootless' packages
(used to install XFree86)

and Fink's:

'system-xfree86' package

which is just a placeholder package for an "outside Fink" installed Xfree86, in this case Apple's X11, which installs it's own implementation of XFree86.

So, if you want to work with Fink and you install 'Apple X11' be sure to install Fink 'system-xfree86' placeholder package version 4.2-3 or higher.





Reflections on Firewall rule for X11 usage

Question:
What would be a good firewall rule on the Mac, so you can use x11 without having to switch off the firewall?

IANA has ports 6000-6063 registered to the X Window System:

x11 6000-6063/tcp X Window System
x11 6000-6063/udp X Window System


If X11.app is like every other X server around,

it listens by default on port 6000 for display :0.

If you open up port 6000, you should be fine.

-----------

This works, of course, but pundits will be quick to point out that it's low on the security scale. A better scheme, if it works for you, is to use "X forwarding", via ssh. Cf the ssh man page for details.

-----------

You do _not_ need to change _any_ firewall settings to use X11 through ssh if ssh is already working. That's the whole idea of X11 forwarding in ssh -- everything will go through your ssh session on port 22.

It is a _bad_ idea to open ports 6000-60xx and connect directly through this. Anybody listening to you connecting will see all key presses in clear text. Just think of, what this means when you enter passwords.

BTW:
Using X11 forward in ssh saves you a lot of trouble setting things up.

-----------

Ssh and Xauth:

Ssh does encryption and compression of the stream. The encryption is why it's secure, but it can make the connection very slow. In my experience, and that of pretty much everyone else I work with, the delays necessitated by ssh encoding make the connection tremendously slower than if you bypass ssh. You may want to try turning on compression in ssh (with the -C option or a config file setting). It will very much depend on the bandwidth of your network.

However, if you bypass ssh, you have to ensure security. If you do not secure your connection somehow, you've pretty much opened your machine to anyone who cares to listen. Even the keyboard "locking" that xterm provides does not protect you from snoopers.

X11 has a good per-user authentication mechanism called xauth. Do not use the older "xhost", as it only does per-machine authentication. If you use xauth authentication, opening ports 6000-6063 is not a security hole.

For setup time speed, use ssh to forward the connection. It's the easiest way to get going. It may also be the slowest network route, though. Run some tests and decide what's best for your setup.

-----------

Xauth is very basic. When using the MIT-MAGIC-COOKIE-1 scheme the authentication is done by sending a random number known to both server and client across the network. If the numbers match, the connection is allowed. However, the number is sent unencrypted, so it's possible for anyone watching the network stream to capture the random number and connect to your server.

Also, the data sent across the connection isn't encrypted either, so even if the authentication method is secure, eavesdroppers can still see everything sent between server and client, e.g. the keys you type.

In summary:

If you're connecting across an unsecure network use ssh.





How to pause a Fink installation for X11

When you install a large package it can take up to several hours to compile it. If you want to do some other work in the meantime, the compilation in the background sometimes slows down the work which can be annoying. Is it possible to pause a compilation for a while and then after the other work is done to resume it. If you started the installation manually in Terminal.app, you can just press:

Ctrl+Z

while you're in the Terminal.app window that "contains" the compilation process. The process will be stopped and put to sleep in the background. You can then go and do the other work, and when you're ready to continue just return to the Terminal.app window where you stopped the process and type:

'fg' (without quotes). fg = foreground

If you are not sure whether you have stopped jobs in a given Terminal.app window, just type:

'jobs'

and you will get a list of jobs that you have put in the background. If there are several of them they will be marked with a number. Type for instance:

'fg 2' to continue with job 2.

You could also say:

'bg 2' to continue job 2 in the background.

You are then free to type other commands on the shell prompt while the job runs in the background. Note that the background job will still send all output to the screen as if it were in the foreground. This can interfere with the output of another command that you have started in the meantime, or even with the command that you're typing right now. The interference is actually harmless - it will not affect how another command is executed, nor will the output mix with anything that you type. If you're not sure about this, just fool around with harmless commands such as "find" that generate lots of output.

If you find yourself in a situation where a "runaway" background job is wildly polluting your window with output and it seems you're helpless, just try the following:

- blindly type 'fg x' (where x is the number of the runaway job)

- now you have the job in the foreground and you can just type:

Ctrl+Z to put it to sleep, or Ctrl+C to abort it.

If you'd like to start a job in the background from the first moment, just type your command as normal and then append an & (ampersand) to the very end of the command.

If you started the installation with FinkCommander:

Just find the pid of the fink process by:

'ps aux | grep fink' or something

then 'kill -STOP thePid'

which is similar to Ctrl+Z.

And when you want to continue it:

'kill -CONT thePid'

which is similar to 'fg'.





To tell Matlab to use Apple's X11 public beta

From a terminal type:

/Applications/MATLAB6p5/bin/matlab &

Or you can set things up so that you have a click-able icon

courtesy of John Iversen (iversen@nsi.edu)

To convert matlab to smoothly use Apple's X11 for OS X:

Go in to:

/Applications/MATLAB6p5/LaunchMatlab.app/Contents

and you'll find a file called 'launch_matlab.sh'.

Copy this to something else for safekeeping

(e.g. 'launch_matlab.sh.oroborosx')

Then replace the original launch_matlab.sh with the following:

#!/bin/sh
# $Revision: 1.1 $
# Copyright 1997-2002 The MathWorks, Inc.

#modification to work with Apple's X11
# 1/7/03 John Iversen (iversen@nsi.edu)

if [ "`ps xc | grep X11`" ]; then
# Bounce less if X11 for OS X is already started
# (starts up much faster than oroborosx)
       sleeptime=10
       echo LaunchMatlab: Using previously started X11 for OS X
else
       sleeptime=15
       echo LaunchMatlab: Starting X11 for OS X
fi

open /Applications/X11.app

cd ../..

bin/mac/setsid bin/matlab -desktop -display :0.0 &

# Bounce to let user know MATLAB is starting up.
/bin/sleep $sleeptime

You can modify yours to match.

The only important thing is adding the line reading:

"open /Applications/X11.app"

and commenting out the line opening oroborosx.

The rest is just to let you know what it's doing.





Make xterm in Apple's X11 behave more like Terminal.app

Courtesy of Mathias Meyer (mathmeye@users.sourceforge.net)

If you want to make xterm in Apple X11 behave more like Terminal.app you can create a file called .Xdefaults in your home directory or just add the following if it already exists:


Click here for screenshot






Apple's X11 won't start anymore

The console output would read something like this:

Fatal server error:
Could not create server lock file: /tmp/.X0-lock

Workaround:
If you don't quit X11 via "Quit" in its menu but by some other method then it leaves behind the lock file:

/tmp/.X0-lock

and maybe also a file:

/tmp/.X11-unix/X0

You have to manually remove these files first before you can start X11.app again.

To have this done automatically:
(Tip by wgscott)

Add a -LogoutHook switch to the console line of the /etc/ttys file. Then after -LogoutHook put in the absolute path to a shell script that contains the following:

#!/bin/csh
chmod a+w /tmp/.X0-lock
chmod -R a+w /tmp/.X11-unix
rm -f /tmp/.X0-lock
rm -f -R /tmp/.X11-unix
exit

You have to restart to get it to work.

The -LoginHook and -LogoutHook are documented here:
(tip by Gary Kerbaugh)

Developer.apple.com





Apple X11 Library Warning

The following was posted on Fink's news on 2003-01-26:

"While Apple's X11 works just fine with existing binaries, it has a bug in the install name of the libraries that can cause some software to build incorrectly, and will break forward-compatibility with future X11 releases.

Ben Hines has created a script that you can use that will fix the install_name entries in Apple's X11 libraries, but it will not repair software you have already built against the broken libraries".

The script is available here:

script

The reponse from Apple has been:
from Haroon Sheikh
(Manager Graphics Software, Apple Computer, Inc.)

"We are looking into this issue and hope to have it resolved in the next public release of X11ForMacOSX (no comments on when that will be)".





Uninstalling Apple's X11

sudo rm -rf /usr/X11R6
sudo rm -rf /etc/X11
sudo rm -rf /Applications/X11.app





Keyboard Problem

Problem:
In the 'X11 application Menu' the 'azerty' keyboard is properly recognized, in all 'xterm' windows it switches to 'qwerty'.

Answer:
Apple is working on fixing this.





Delete key

To make the delete key in Apple's X11.app behave like that in XDarwin:

If the behavior of the delete key is different between XDarwin and Apple X11. This can be rectified by adding the following lines to the appropriate X startup files:

.Xmodmap:

keycode 59 = Delete


.Xresources:

xterm*.deleteIsDEL: true
xterm*.backarrowKey: false
xterm*.ttyModes: erase ^?



.xinitrc:

xrdb -load $HOME/.Xresources
xmodmap $HOME/.Xmodmap






To specify your Keyboard type (French Keyboard example)

The following example is for French Keyboard
(adjust to your own language).
You have to start X11 from the terminal with: (all in one line)

/Applications/X11.app/Contents/MacOS/X11 --xquartz-be-xinit -keymap
/System/Library/Keyboards/Francais.keymapping


Place in .xinitrc:
xmodmap -e 'keycode 66 = Mode_switch'
xmodmap -e 'keycode 69 = Alt_L'


Or

Without modifying anything in /System:
mkdir ~/Library/Keyboards
cd ~/Library/Keybaords
ln -s /Library/Keyboards/Francais.keymapping USA.keymapping


and then restart X11.app.

Or

% startx -- -keymap Francais.keymapping &
% xterm &


In xterm:
% cd
% xmodmap -pke > .Xmodmap


exit xterm and quit X

Add in .xinitrc:
xmodmap $HOME/.Xmodmap
xmodmap -e 'keycode 66 = Mode_switch'


Add in .tcshrc:
stty -istrip

Then restart X11 by double-cliking the icon.





Switching from USA to Italian Pro Keyboard in X11

Check the following page:

Tastiera italiana 'PRO' con X11





Specific German keymapping Problem

This is specific to the German keymapping and it's not just a problem with Apple's X11, but with XDarwin etc. as well.

If you launch X11 like this:

/Applications/X11.app/Contents/MacOS/X11 --xquartz-be-xinit -keymap
/System/Library/Keyboards/Deutsch.keymapping


and use

xmodmap -e 'keycode 66 = Mode_switch'

You can use the German keyboard layout just fine.

But the @ character is mapped to Shift-Alt-1 (one), just like it used to be up to Mac OS 8.6. With the introduction of Mac OS 9 Apple moved that character to Alt-L. The file Deutsch.keymapping does not seem to reflect that.


Some keymappings in /System/Library/Keyboards have not been updated from a long time. This could explain the problem with the German keymapping.






Japanese keyboard input

"With X11 applications now, the way to get Japanese keyboard input is to run kinput2 and Canna (or some other back end). Keyboard switching and input is all done using the XIM protocol. The X11 application talks to kinput2, which in turn uses Canna to do kanna to kanji conversion.

OSX has a perfectly good keyboard layout and input method for Japanese already. What would be really nice is if Apple could write their own XIM server to replace kinput2. Apple's could use all the powerful stuff they already have to implement this".





Spanish Keyboard with X11

(Thanks to Artemio Gonzalez Lopez (artemiog@mac.com) )

The usual way to start X11 from the terminal with the command:

/Applications/X11.app/Contents/MacOS/X11 --xquartz-be-xinit -keymap
/System/Library/Keyboards/YourDesiredLayout.keymapping


*doesn't work* with the Spanish ISO keyboard.

Apple's Spanish.keymapping is very old

and doesn't match the modern ISO keyboard.

The way to do it is as follows:

Write in your .xinitrc file:
xmodmap ~/.MyXmodmap
xmodmap -e 'keycode 66 = Mode_switch'


To create .MyXmodmap file:

Copy/paste the following to .MyXmodmap file in your home directory.

.MyXmodmap, is a simple keymap that works very well with xterm.

It has the necessary modifications to the USA keymapping in order that all the characters that are drawn in the Spanish ISO keyboard will appear as indicated by the drawings on the keyboard. Including the characters like @#~ that are called with the option key.


.MyXmodmap file:
keycode 18 = masculine ordfeminine backslash backslash
keycode 22 = e E EuroSign cent
keycode 26 = 1 exclam bar exclamdown
keycode 27 = 2 quotedbl at oneeighth
keycode 28 = 3 periodcentered numbersign sterling
keycode 29 = 4 dollar asciitilde dollar
keycode 30 = 6 ampersand notsign fiveeighths
keycode 32 = exclamdown questiondown asciitilde asciitilde
keycode 33 = 9 parenright
keycode 34 = 7 slash paragraph doubledagger
keycode 35 = apostrophe question
keycode 36 = 8 parenleft
keycode 37 = 0 equal
keycode 38 = plus asterisk bracketright dead_macron
keycode 41 = dead_grave dead_circumflex bracketleft dead_abovering
keycode 47 = dead_acute dead_diaeresis braceleft braceleft
keycode 49 = ntilde Ntilde asciitilde dead_doubleacute
keycode 50 = ccedilla Ccedilla braceright dead_breve
keycode 51 = comma semicolon
keycode 52 = minus underscore endash emdash
keycode 55 = period colon
keycode 58 = less greater bar brokenbar
keycode 66 = Mode_switch





True Type Fonts are working well under Apple's X11

To set-up True Type Fonts under XDarwin, write in your ~/.xinitrc file:

xset fp+ /usr/X11R6/lib/X11/fonts/TTF





Adding to the font repository in Apple X11 on OSX

Add fonts to /Library/Fonts or /System/Library/Fonts, then run:

xftcache as root

Any applications that use Xft for font management should automatically pick up the native fonts.

which xftcache
/usr/X11R6/bin/xftcache






Apple's X11 and freetype aware applications

If using Apple's X11.app:

add the following directories to /etc/X11/XftConfig:

# add OS X system-wide font directories
dir "/Library/Fonts"
dir "/System/Library/Fonts"


This would work with freetype aware X11 applications (like xterm).

You can run:
xterm -fa Monaco -fs 14

to get an xterm with Monaco fonts or write in your .xinitrc file:

/usr/X11R6/bin/xterm -sb -fa monaco -fs 14 &





Tip for OpenOffice

Run the admin program:

% cd /Applications/OpenOffice.org1.0.1/program/
% ./spadmin


click on fonts, add the ones you want (that are unix enabled via fondu) and click add.





Add extra X11 fonts

For extra X11 fonts, you can try the fonts available at:
(will work with Gimp fairly easily)

Extra X11 Fonts

The urwfonts are a good place to start. Untar them and place them anywhere you like.

Normally, they go in /usr/X11R6/lib/X11/fonts directory.

Then run the following commands:
xset +fp [path to fonts file]
xset fp rehash


If it works, put them in your .xinitrc file so they'll be avaliable everytime you start X11 (or XDarwin).








astronaut / Make Contact /
drop me a line at:           sao1@mac.com

MacOS X,    Fink,    X11,    Unix    ...and other related things