Transparent terminals without Beryl etc.
Jun 13th, 2007 by dmess0r
There exist too many articles floating around which describe methods to apply transparency to terminals without the use of Beryl and other Xgl counterparts. There also exist too many of these articles which make the user jump through ridiculous hoops of clicking, selecting and typing in values to get the transparency they want.
All of those articles are ridiculous. The following method is mindlessly simple, yet will always result in the application of transparency against the terminal you want. This article also assumes that you have all the bits necessary on your system, functioning, and in your path.
Whichever window manager you’re using, make sure xcompmgr gets started up
xcompmgr &
Next, lets create a really simple rc file
~/.transrc
(or not, your choice) to execute the following:
transset-df -n foo 0.65 &>/dev/null
The way this is designed is to set all new shells with a 65% opacity, which means 45% transparency. For me, this is all I need. Play with the value as you need. Don’t mind the “foo” bit, I explain it later where it makes more sense.
Now one personal configuration detail is that I symlink my .profile to my .bashrc because I want a consistent bash configuration irrespective of of “login shell” state.
Now my ~/.bashrc looks like this:
# .bashrc
. ~/.transrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
Why put the ~/.transrc above the sourcing of /etc/bashrc? I’ll tell you why. When we finally execute our terminal, /etc/bashrc sets this lovely environment variable called PROMPT_COMMAND. It is this variable which alters the contents of the titlebar of your terminal window. If you place the ~/.transrc below, your shell will end up with a title bar which isn’t all that helpful. Continue reading alright?
Remember above seeing the “foo” bit with the transset-df command? Well here is where we use it. I use Eterm as my primary shell, simply because of the sheer number of command line options and settings. It is pretty damn fast. In order to make this work, we have to make sure that the TERM environment variable gets set correctly (or fix /etc/bashrc to use Eterm) and black out the Eterm background, otherwise the transparency looks a bit odd.
Execute the following:
Eterm –term-name xterm –name foo –shade 100
See how clean that is?
All you need to do now is setup whatever keybinding mechanism you like to make this a single-keystroke. Personally I use xbindkeys, but I will save that post for another time.
So let us count the number of steps.
- Run xcompmgr
- Make ~/.transrc
- Alter ~/.bashrc
- Execute Terminal
Done.