Better aterm transparency

For the past several years, I’ve been using aterm as my terminal emulator. The main reason I keep coming back to it is the off-focus fading support (it dims all the terminal content anytime the main window frame loses focus). It’s possible to implement off-focus fading for any window or class of windows using a Compiz plugin, but it’s a much bigger PITA than just setting the aterm*fading resource in ~/.Xdefaults.

Unfortunately, aterm has a couple of limitations. One is that it doesn’t handle XK_ISO_Left_Tab, which is incredibly annoying since it means you can’t back up in e.g. a bash or VIM completion list. I think this has something to do with changes in when and how XK_ISO_Left_Tab gets sent versus a simple shifted-Tab, and I think the whole thing is as usual the fault of motherfucking i18n which I hate. I sent a patch to fix this problem to the aterm maintainer but I never got a response. Perhaps I should try pushing it through Ubuntu instead. Anyway, I digress.

Another limitation, which is the subject of this post, is that aterm’s transparency is of the cheap hack form where it just reads the window background and blits it to the terminal window. After giving up on gnome-terminal for like the twentieth time this morning, I went back and hacked in slightly better transparency support using the _NET_WM_WINDOW_OPACITY hint. Support for this hint in the EWMH spec was proposed like three years ago, and for some reason it’s still not there, but it works in the window managers I care about (compiz, xfwm4, and metacity w/ xcompmgr).

So, my new hacked aterm can read a new commandline argument of the form -tp %, where % is the transparency value (greater than 0 and less than 100). It can also read the same value from a new resource, aterm*transparency. It takes this value, converts it into a fractional multiple of the opaque value (0xffffffff), and then sets the _NET_WM_WINDOW_OPACITY property accordingly (I just copied the code from xcompmgr).

I’m uploading an AMD64 binary that runs on Ubuntu Gutsy. If you’re running 32-bit, go fuck yourself. No seriously, perhaps if I get more motivated I will build a 32-bit version, and upload packages as well. In the meantime, I’ll upload the patch too - it’s quite simple and it’s pretty easy to see how you could do this for any program. I’m also including a gratuitous screenshot that probably contains confidential information that I shouldn’t be posting on the intarweb.

The main remaining limitation is that this makes the entire aterm window, frame, text, and all, transparent according to the specified percentage. The right thing to do is to use an ARGB visual when creating the background window, so that the text and frame remain opaque. This is what Keith Packard’s hacked transparent xterm does. I may give that a shot if I get bored/annoyed by this in the future.


No Responses to “Better aterm transparency”  

  1. No Comments

Leave a Reply

You must log in to post a comment.