Defindit Docs and Howto Home

This page last modified: Mar 10 2011
keywords:icewm,osx,quartz,xquartz,clipboard,macos,linux,x11,xterm,meta,xrdb,dot,Xdefaults,wierd,ascii,double,click,double-click,select,word,wrap,line,linewrap
description:Installation, configuration and hints X-windows, xterm, for Icewm window
manager on OSX, with other X windows and xterm hints.
title:X11 hints, xterm, also with hints for Icewm on Apple MacOS




Table of contents
-----------------
Introduction
Homepage for xterm and the xterm FAQ
Copy work around for xterm and the clipboard
Meta sends escape to fix emacs -nw in xterm
Build icewm with macports
Multi-item clipboard using Parcellite
Multi-item clipboard using xfce4-clipman




Introduction
------------

New hints about building icewm via MacPorts. This results in a
wonderful X desktop that is running in parallel with the normal Mac OS
Finder, but not sucking down CPU and memory like a virtual machine
does. Icewm is not quite as feature rich as KDE, but the fundamentals
are all there. Since I do most of my work inside Emacs, I pretty much
only need a desktop that supports proper alt-tab, multi-item
clipboard, xterm, and Emacs. IceWM is perfect.


Hints in this file have used to be more about xterm than IceWM. The
xterm info may eventually move. In any case, the information is
generally X11 related, and may apply to several window managers, not
just IceWM.




Homepage for xterm and the xterm FAQ
------------------------------------

As far as I can tell, Thomas Dickey is the current main programmer for
xterm. See his FAQ for more history and info including how to report
xterm bugs:

http://invisible-island.net/xterm/xterm.faq.html




Double click word select for line wrapped words in xterm
--------------------------------------------------------

The work around: double click the end of the word which is on the next
line (or in extreme cases, several lines down).

The unexpected feature: In some environments double click will select
only up to the visual break, leaving the part of the word which
follows on the next line(s) unselected.

The expected behavior: double clicking a word in xterm will select the
entire word, even if the word has been wrapped in xterm. With X11
windowing systems such as KDE this works as expected. By "wrapped" I
mean that the word has been broken at the right margin and continues
on the next line (or lines). The word is only visually wrapped and has
not been physically separated. A "word" in xterm is defined by a
regular expression which can be configured. 

Under Apple's Mac OS (OSX) Quartz window manager, and with IceWM on
the Mac, the expected feature is broken. Double click will select up
to the break. The work around is to select the end of the word which
is on the next line (or in extreme cases, several lines down). Select
works backwards to be beginning of the line. The unexpected feature
(bug?) is that select does not work forward to the end of the line.

Since select works forward and backward under KDE, the feature may be
an issue with the window manager, and not with xterm.




Copy work around for xterm and the clipboard
--------------------------------------------

This applies to xterm. If you use xterm, you may find that even when
xterm is set to copy selected text into the clipboard, it either
doesn't work, or it does work but the clipboard is not converted to
the quartz-wm OSX MacOS clipboard. Emacs copy works fine.

The work around: use the right mouse button. Instead of doing a
left-click selection of text to copy, use this technique:

Drag over a few characters at one end of selection.

Right click at the other end of the selection. The selection briefly
highlights.

Now you will find that your copied selection is in the X11 clipboard,
and has converted properly to the quartz-wm OSX MacOS clipboard.

This workaround applies to clipboard problems with native Linux KDE
desktops as well. 





Meta sends escape to fix emacs -nw in xterm
-------------------------------------------

This hint applies to xterm. By default the meta (alt) key in xterm
does some weird character modification and ends up typing some high
ascii characters. The meta key will work normally in X-windows Emacs
and xev which adds to the confusion.

The solution is to control-left click to bring up the first of the
three xterm menus, and choose "Meta Sends Escape". (Control-middle and
control-right bring up the other two xterm menus.)

To make this setting permanent, add the following line to your
.Xdefaults file in your home directory.

xterm*metaSendsEscape: true

The .Xdefaults setting should take effect the next time you create an
xterm window. In general, you should run xrdb to update your X
settings after changing .Xdefaults. Comments in .Xdefaults are
prefixed with the ! (exclamation) character. I add a comment to my
.Xdefaults with the follow command line as a reminder to myself:

xrdb -l .Xdefaults


Rumor has it that xterm defaults can also be set in the file:

/etc/x11/app-defaults/XTerm

Here is a small .Xdefaults file (between -- and --):

--
! This is a sample .Xdefaults file. Remember to run xrdb after
! modifications to this file.

! xrdb -l .Xdefaults


xterm*metaSendsEscape: true

--


Build icewm with macports
-------------------------


The first time I did this, I could not get icewm to build. This may be
an issue specific to my machine. Second time around I looked at the
MacPorts errors and found a quick fix. This is nice because MacPorts
is more standard so this build is easier to keep up to date. I
recommend this over other notes you may find in this document.



sudo port install icewm

# Macports extra commands, which I did not do. As far as I can tell,
# these command are not necessary.

sudo port install python_select
sudo python_select python26

# icewm build failed. Link of genpref failed due to confusion in make
# about x86_64, so must manually build genpref.  Must sudo first. Used
# "make -n" to find out the offending command.

cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_x11_icewm/work/icewm-1.2.37/src
/usr/bin/g++-4.2 -arch i386 -o genpref genpref.o 

# Once genpref built properly, re-run the icewm install and it
# succeeds.

sudo port install icewm

# This text from the macports install is wrong:

To start icewm put "exec icewm-session" in your ".xinitrc" file.
Don't forget to add the MacPorts Environment to the X Environment too!

> which icewm
/opt/local/bin/icewm

# See notes in .xinitrc. This is the short version. It must be done
# this way. Do not run quartz-wm or icewm-session.

exec /opt/local/bin/icewmbg &
exec /opt/local/bin/icewmtray &
exec /opt/local/bin/icewm

# Options are in ~/.icewm or /usr/local/share/icewm/.

# It was necessary to create a little shell script to run the correct
# version of emacs. Call this shell script from the icewm menu and
# toolbar.


> cat ice_emacs.sh 
#!/bin/bash
cd $HOME
/sw/bin/emacs




Multi-item clipboard using Parcellite
-------------------------------------

In March 2011 I attempted to build xfce4-clipman under Mac OSX and ran
into several serious issues. It might be possible, but the xfce
clipman requires several large software packages. While clipman itself
may not be bloated, all the extra stuff is simply crazy for a
"lightweight" install.

I accidentally found an alternative GTK clipboard called
Parcellite. As you'll see below, it is fairly easy to build from
source once you have Xcode and some MacPorts packages installed.

You will have to edit the makefiles. It seems like there should be a
way to add "-arch i386" to the make command line, but I can't find
it. It was necessary to add that to the flags for ld, cc (gcc, g++),
and cpp, and that required editing 2 makefiles.

Apparently there is some tooltray standard that icewm, xfce, KDE,
Gnome, etc. all follow because the clipboard seems to just know that
it should put itself in the tooltray.

Parcellite seems to have more or less the same features as Klipper and
xfce4-clipman. I only need a few things: multi item clipboard, auto
sync with xterm select, auto sync with X applications copy (especially
Emacs). Parcellite seem wonderful.


x parcellite gtk clipboard manager
http://parcellite.sourceforge.net/?page_id=16

tar -xf parcellite-1.0.0.tar.gz 
cd parcellite-1.0.0

# try to build parcellite from source
# gtk-2 is already installed
sudo port install glib2 # nothing happened, already installed

./configure --disable-gtktest --disable-glibtest
emacs Makefile ./src/Makefile
# change LDFLAGS, CFLAGS, CPPFLAGS -arch i386

--- twl8n@d-137-155-220 /Users/twl8n/archive/parcellite-1.0.0 Tue Mar 08 03:31:04 ---
> grep "arch i386" Makefile
CFLAGS = -arch i386 -g -O2
CPPFLAGS = -arch i386
LDFLAGS = -arch i386
--- twl8n@d-137-155-220 /Users/twl8n/archive/parcellite-1.0.0 Tue Mar 08 03:31:17 ---
> grep "arch i386" src/Makefile
CPPFLAGS = -arch i386
LDFLAGS =  -arch i386
--- twl8n@d-137-155-220 /Users/twl8n/archive/parcellite-1.0.0 Tue Mar 08 03:31:22 ---
>

make 

# Works for a quick test, but the icon is missing from the tooltray.
./src/parcellite &

sudo make install

emacs -nw ~/.icewm/menu ~/.icewm/toolbar

# The icon file (second arg) is for icewm. Parcellite knows where it's
# own icon is located for use by the parcellite in the tooltray.

> grep parcellite -h ~/.icewm/menu ~/.icewm/toolbar
prog parcellite /Users/twl8n/.icewm/icons/clip /usr/local/bin/parcellite
prog parcellite /Users/twl8n/.icewm/icons/clip /usr/local/bin/parcellite

After make install, parcellite works great in icewm. I still launch
the clipboard manually since the autostart features of icewm do not
work with tool tray applications.

Note: I still have not been able to get Parcellite to auto-launch from
.xinitrc and I assume there is something about icewm that prevents
this. I added parcellite to the menu and toolbar, and I just launch it
manually by clicking the toolbar icon or selecting parcellite from the
menu.


Multi-item clipboard using xfce4-clipman
----------------------------------------

(Update: I wasn't able to get xfce4-clipman to build more recently, so
I've switched to Parcellite. See above.)

This brief note is about about icewm, clipboard, multiple item
clipboards, and clip board managers. I couldn't find a web page with
this simple solution to the icewm clipboard issue.

To get a multi-item clipboard in icewm, run the icewmtray (in the
background), then run the xfce4-clipman clipboard. (You'll typically
exec icewmtray from your .xinitrc file.

Icewmtray doesn't seem to do anything until there are plugins. Then
the plugins magically appear next to the date (at least in my icewm
toolbar).

The Xfce4 clipboard plugin xfce4-clipman saves items that you've
copied. When used with "quartz-wm --only-proxy", the clipboard
synchronizes with OSX.

As far as I can tell, xfce4-clipman is a clipboard manager that has
all the basics available in Klipper, but without the KDE overhead.

While it may seem odd, I'm running xfce4-clipman via an ssh session to
a Linux server. Parts of my X desktop are local to the Macintosh, and
parts are coming from the Linux server via the forwarded X windows session.

Use ssh -Y to export X11 untrusted to the Linux server. It is not
necessary to have X11 running on the Linux side. 

This all works fine with OSX 10.6. I had serious problems with getting
icewm to build under 10.5. MacPorts seems to work much better than Fink.

Here is my .xinitrc. Put this file in your home directory, for example
"/Users/mst3k".

exec quartz-wm --only-proxy &
exec /usr/local/bin/icewmbg &
exec /usr/local/bin/icewmtray &
exec /usr/local/bin/icewm

In my case ssh'ing to a Linux server where I run xfce4-clipman, but
you should be able to run xfce4-clipman on the Mac.