Mac-Expose-Clone (very fast minishots of windows)


I saw several topics in this board, how to get an “snapshot”-overview of all opened windows.

The scripts i found for this have a problem:

they use an external tool to create the snapshot, then they load the images from harddisk and display them.

This is slow.

The following solution was written in C using imlib2.
Just the internal window-list itself is created with a patched commandlineversion of wxbasic.

I think this is far the fastest solution, as the snapshots are created “in memory” (imlib2) and directly copied from there to an overview-window (xlib).

It is small, just a 160 kb-download.





Wow that looks awsome. Thats one of the big features i miss when i deleted my mac partition. I can’t wait to give this a whirl.


Edit: Darn it won’t work on my ibook. Says i can’t execute binarys.

I compiled it on Linux-mandrake 9.2, which is a bit older.

You might need to install “compatibilty-libs” that include libstdc5++

I will make a source-package with an “complie-script” in some days, and I will install a current linux in some days too and recomplile it.


I have libstdc5++. I think your binarys are compiled for a x86 where as i have a ppc.


Oh, that does not work of course.

I just created a sourcepackage with an installscript.

Before I’ll upload, I’ll try to eleminate another bug:
currently the program just works, when xcompmgr (shadows) is running.

I hope I can upload the fixed version in approx 2 hours.

Thanks for your feedback :slight_smile:


I made an update including source and bugfixes.

See “installation” on bottom of this page:

Please tell me, if there still are problems.

Greets, Mark

Man i got all excited when it compiled with out error and when i executed and the little icon popuped. But when i click the icon i get

{voider}$ *** glibc detected *** free(): invalid pointer: 0x1003e590 ***

I get this error with some other programs aswell like nedit.
imlib2 version 1.2.–r2.
glibc version
gcc version 3.4.3-r1
kernel 2.6.10
If you need anymore info please ask i really like the look of this and can’t wait to get it running.


ok, please type

cd resource
./wxbasicconsoleewmh test.wxb

If you get the same error, I will have to change my wxbasic-patch.

If it works correct, it should give output like this:

edevelop :: View Forum - Tools - Mozilla {Build ID: 2004042110}
mark@terminatux: /usr/local/wxb-desktop01/resource/test/expose2

If it works, you could try expose:
Open a xterm.
Your cursor becomes a cross.
Click on the xterm, there should be displayed an ID like this:

Now run expose:
./expose 0x280010d test
(use the ID you just found out).

If you get the error here, I will have to search the error in expose.c

Both might take 1-3 days unfortunately :unamused:

Greetings, Mark

I got feedback in my german board.

Someone also got an error
“free(): invalid pointer 0x806a2cc!”

But Expose itself works.

I uploaded a new version (2.2).
It has an additional script “”.

This will launch expose directly without the icon.
I also replaced the “usleep”-call with an own version, as usleep seems to be missing on some systems.

You might try if this solution works for you, too.


I have the same problem, except the it works. I only have the error message

free(): invalid pointer 0x806b2cc!

However, when the shots are taken, if the window is not completly visible, it only displays the visible part, and if the window was below the icon, the icon and the tooltip are on the screenshot.

Yet, do you think you could somehow modify your code so that it goes on the system tray?

After doing some searching around i found that the error is caused by malloc. Im not quite sure what it is but making and alias in my ~/.bashrc file like this

 alias="MALLOC_CHECK_=0 /home/voider/bin/expose2/"

then running expose for the command line and it works beautifully. Heres a link to the page that goes in to good detail about what it is. LINK
Hope that helps and thanks for a great little app.



Thanks, the link really helps me.

I can reproduce the error (expose.c).
Maybe I used too many imlib_free_image in my code, I will uncomment the corresponding lines for tests and post an update later :slight_smile:


Yes, I am aware of this problem.

What I will try in version 3 is:
before a snapshot is made, the position is determined.
Then thewindow is moved to 0,0.
After the screenshot, the window is removed to the original position.

I think I will add this as an option, as it might slowdown the program.
When the Windows is UNDER the icon… hm… I will try to “lower” it, when the snapshot is taken.

There are several, which do you use?
In a local german magazine I found some hints:

Alltray: (should be great for fvwm)

To add it to a tray, do not use (this would launch the icon), but instead from version 2.2 (this will start the overview immedeatly).

Thanks for your tips and feedback :slight_smile:


Ah, i see… this free() -errormessage…

There is a nice small commandlineprogram written in c, called “wmctrl” ( ).

It allows you to get a list of all active windows like this:
wmctrl -l

But the result just is printed to the screen.

So I tried to add this programm as functions to the wxbasic-interpreter.

Like this I can return the result as an array, and do nice things like sorting or analyzing.

Unfortunaltely, wxbasic uses its own datatype “wvariant”.

So I had to add many changes to wmcontrol, to get the conversion from int, gchar and so on done.

I’m a newbie concerning C, and so my code is a mess, even memory is not cleaned up correctly.
If you use it for a small application like expose, this is not such a problem.

But I work on another project ( … /index.htm ), where wmcontrol-functions are called every second.
After 3 hours, 10 MB of memory are unfreed :frowning:

I already could track it down, first versions have eaten up 60 MB in 1 hour :open_mouth:

wxbasic+wmctrl is an ongoing “testarea” for me to learn memory-management, so it might take some weeks (months? years? scream :wink: until I tracked the problems down.

But for expose, this should not matter, as wxbasic is just run once (and not in a loop) with a click, and then teminated immedeatly.


To stop the free()-Error, open source/wxbasic/wmctrlnew.c in an editor.

In the end, delete the line 1695


which is before the line
//** return the wList to wxBasic

Now run again

Then the error should diasappear, as nwxb is freed earlieron.


I added this to a new download (2.2.3)

Again thanks again to VoiDeR, this will help me to track down other bugs too, I hope :slight_smile:


Actually, I’d hope you would know :blush:. I use a small panel (called fbpanel), but which works well with different programs (xfcalendar, skype, gmpc), so I guess there is somewhere a normative reference in

However, I guess it should be easy for fvwm user to swallow your app in a bar. Using one of the “standard” system trays, it could integrate well in gnome, kde, xfce…

About the icon that is on the snapshot, you can hide it before taking the shot using ewmh. As already mentionned, wmctrl car do it

wmctrl -r <window_name> -b add,hidden


wmctrl -i -r <window_id> -b add,hidden

replace add by remove to show it back.



I will have a closer look to the tray-mechanism, so expose will be compatible with it in future.


Meanwhile, you can add this to
(fbpanel must not run while you add this)

Plugin {
    type = launchbar
    config {
        button {
            Image = /usr/local/wxb-desktop01/tools/expose2.2/resource/expose.png
            tooltip = Expose
            action = /usr/local/wxb-desktop01/tools/expose2.2/

You must change the paths of course.
Then start fbpanel, and you have a new Icon for expose in it.

hide Icon (wmctrl):

yes, this is what I will add.

And here a small tip for people, who do not use shadows, because they are too slow:

run xcompmgr with the option -a
This will activate fast serverside compositing without the slow “special effects”.
You should not feel a difference when for example moving windows.

But now you can run ,which is faster, because for a snapshot not every window has to be raised.

Greets, Mark

Thanks ! It’s great. I still have a “free” errors. Thank you for investigating the system tray.

Just a quick question…is imlib2 the only requisite to run this? It looks really good, and it’d be a shame to miss dependencies (I cannot download them from my home computer)


wxbasic is a consoleversion in this case, so no further requirements.

To draw the window, I use xlib (the X-Server-low-level-functions).

Imlib2 is used to take snapshots and “paint” the window.

I use in on 6.8.0 or 1, so i don’t know if it will run on XFree86.