Rough Book

random musings of just another computer nerd

Running aterm (or any other X app) rootless, without a DOS console on Cygwin

This guide is outdated. Please check out the updated version of this guide here.

On any system that I plan to use for an extended period of time, I will always install Cygwin. This is mainly because I like have UNIX tools on Windows, and also so that I can use the console to do things that DOS is not able to do. I started using Cygwin in 2000, and I’ve continued using it since. One of the cool things you can do with Cygwin is run X, which means that you can have X applications running on the Windows desktop. When I was interning at Motorola, I used to run eXceed, with fvwm. This was where I first ran into aterm. What I liked most about aterm is the eye-candy. You can have transparent windows with shading effects and all sorts of other cool stuff. I tried to get aterm running on my machine at home by compiling it from source under Cygwin. I was eventually able to do this (install libjpeg, libpng, libAfterImage, zlib, and the X includes and libraries first), but what I didn’t like was the fact that you had to start up a Cygwin console to open up X, and then aterm. I wanted aterm to start up and run directly without that ugly DOS/Cygwin console window. Of course, you can’t simply run the aterm executable because it needs X and Cygwin to be running. I eventually figured it out (actually a few months before leaving on my “extended vacation”) by starting out with X running with a rootless window. Oh, and run.exe proved to be very helpful. Anyway, here is how you do it:

First you need to add C:\cygwin\bin to your PATH Environment Variable. You can do this from My Computer > Properties > Advanced > Environment Variables. You might also have to add C:\cygwin\usr\X11R6\bin to PATH.

Then you need to create two batch files. The first one is to start X, and the second one is to start aterm (or whatever X app you want to start). The example I’m going to show includes starting up X with a wallpaper (using xv), and then running aterm. I run aterm with a transparent background, using the X wallpaper. However, you can also load aterm with a background image of your choice.

The batch file to start X, which I call xwin.bat looks like this:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\X11R6\bin\xwin.exe -multiwindow -clipboard -silent-dup-error
C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\local\bin\xv.exe -display :0 -root -quit -be -maxpect /cygdrive/c/Wallpapers/upper_limit_wp_dark_1600.jpg

This will start up X in a rootless window with upper_limit_wp_dark_1600.jpg as your X wallpaper. Next, you write a batch file (aterm.bat) that will load aterm:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "aterm -sh 50 -tr -trsb -fade 20 -tint gray -bl -sb -st -sr -sl 1000 -tn xterm"

This batch file will load aterm with the background image at 50% brightness, transparent background, transparent scrollbar, 20% fading on losing focus, gray tint, borderless window (sometimes works), scrollbar, trough-less scrollbar, scrollbar on the right, 1000 scrollback lines, and with xterm terminal emulation. One issue I have had with this, is that aterm may load up with the default (checkered) X background. This is because the xv did not properly execute in xwin.bat. I have no idea why this happens, sometimes it works, and sometimes it doesn’t. If it doesn’t, you can modify aterm.bat:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "xv -display :0 -root -quit -be -max /cygdrive/c/Wallpapers/upper_limit_wp_dark_1600.jpg && aterm -sh 50 -tr -trsb -fade 20 -tint gray -bl -sb -st -sr -sl 1000 -tn xterm"

This batch file will load xv every time you start aterm, so there is a slight performance hit on startup. However, it’s not that big of a deal because the xv instance quits right after it sets up the wallpaper, and so you’re not loading a new instance of xv into the memory every time.

Well, there you have it. I hope it was helpful!

X with XP
Screenshot of my XP desktop, with aterm, xcalc, xclock, xeyes, and xterm running

Popularity: 18% [?]

March 27, 2007 - Posted by | Computers, Cygwin, Operating Systems, Software, Windows | , , , , , ,

10 Comments »

  1. Very helpful, thanks.

    ReplyReply

    Comment by Jason | April 2, 2007

  2. pretty cool! thanks! i wonder if you can get compiz-fusion running under cygwin lol

    ReplyReply

    Comment by Will | January 21, 2008

  3. Haha! I don’t know, but it would be fun to try out! I know I was successfully been able to get KDE running under Cygwin a few years ago, but it was really slow. Compiz-Fusion would probably be really slow as well.

    ReplyReply

    Comment by vivin | January 22, 2008

  4. thats pretty sweet dude. if ur into eye-candy check out the Beryl window manager, itll blow ur mind

    ReplyReply

    Comment by Sheehan Alam | March 27, 2008

  5. I can’t find "xv" on cygwin’s installation page. Do you know what section / package it is under?

    ReplyReply

    Comment by janvaar | November 26, 2008

  6. janvaar,

    You can get xv from here. I remember the last time I did this, I had a bit of trouble with xv. So I think I used xsetroot instead. That binary should come with the X windows package on Cygwin.

    ReplyReply

    Comment by vivin | November 26, 2008

  7. Thanks got it working w/ cygwin. One hiccup I ran into on the way is when building aterm from the source. I got an error regarding an unsupported parameter "-rdynamic". I did some digging and found that the copy of gcc that comes with cygwin expects "–rdynamic" with two dashes.

    ReplyReply

    Comment by janvaar | November 26, 2008

  8. Janvaar,

    Yeah, I probably should have mentioned that, but it’s been a while since I compiled it from source. It’s one of the gotchas when building from source in cygwin. Glad you got it working!

    ReplyReply

    Comment by vivin | November 26, 2008

  9. [...] while ago, I wrote up a quick guide about running X/Windows applications (specifically, aterm) without root windows on Windows, using [...]

    Pingback by Rough Book » An update to running aterm (or any other X app) rootless, without a DOS console on Cygwin | September 9, 2009

  10. best for you for promotion code to your friends

    ReplyReply

    Comment by Aloffchastity | December 11, 2011


Leave a Comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
All original content on these pages is fingerprinted and certified by Digiprove