Binding transparency to the mouse wheel in Openbox

The Gentoo wiki suggests using transset-df to adjust window transparency on the fly under xcompmgr.

I couldn’t find transset-df in the Ubuntu repositories, so this was actually done in Arch first. The package is in AUR and is marked safe, so Arch users can rig this up in a jiffy. When I get a chance, I’ll compile transset-df and make sure it works in Ubuntu (I don’t see why it wouldn’t).

Unfortunately, the Gentoo wiki only describes using xbindkeys; for Openbox, it’s all about the rc.xml file. You should have one in your ~/.config/openbox/ folder. If you don’t, copy it from the default location at /etc/xdg/openbox/ with this command:

cp /etc/xdg/openbox/rc.xml ~/.config/openbox/

Don’t just wildly copy *.xml from that location; you’ll overwrite the menu.xml file as well, and that could make your system menus real weird real fast.

Editing rc.xml is a little daunting at first, unless you’re used to XML. What you’re looking for in this example is the section marked context name="Titlebar". You can add this code just about anywhere, but it might take a little editing to make it work.

Insert this code, or copy and paste it. Remember that WordPress won’t allow proper XML tags, so replace the curly brackets with the appropriate greater-than and less-than symbols.

{mousebind button="C-Up" action="Click"}
{action name="Execute"}
transset-df -p --inc 0.2

That makes CTRL+mousewheel-up on the titlebar of a window increase the opacity of the window. Now for the opposite.

{mousebind button="C-Down" action="Click"}
{action name="Execute"}
transset-df -p --min 0.2 --dec 0.2

(By the way, those are double-dashes in front of min, inc and dec. WordPress doesn’t do those well either. If you just want to cut and paste my rc.xml, it’s in the Ubuntu-nl pastebin here. You might get a little weird behavior afterward, but don’t fret.)

That last section makes CTRL+mousewheel-down on the titlebar decrease the opacity, or make it more transparent. Save the file and restart Openbox (just from the right-click menu is enough. You don’t have to stop X altogether).

I strongly recommend making sure you use the --min flag on the decrease command. I lost a window somewhere before I started using the flag, and I’m still looking for it. ;)

Remember that it will only work when the mouse cursor is hovering over the window’s titlebar. If you want it to work on another part of the window decoration, move (or copy) those tags to the appropriate area in rc.xml. If you want to use a different key command (like CTRL+ALT+SHIFT or something), make sure you change the C-Up and C-Down parts to C-A-S-Up and C-A-S-Down, or whatever.

Have fun!

About these ads

5 Responses to “Binding transparency to the mouse wheel in Openbox”

  1. 1 ofek 2007/02/22 at 12:20 PM

    The keybindings worked perfectly and mimicked the beryl plugin with almost no memory footprint. Great idea and usage off transset-df.

  2. 2 Melroy van den Berg 2011/05/04 at 7:47 AM

    I would like to repost your code + my custom code:
    (this is my full content titlebar part of rc.xml)

    Your pastebin says Server not found.

  1. 1 Hello world! « Urukrama’s Weblog Trackback on 2007/11/26 at 9:37 AM
  2. 2 An Openbox Guide « Urukrama’s Weblog Trackback on 2007/11/26 at 10:48 AM
  3. 3 Setting Window Transparency from the Keyboard « console matt Trackback on 2009/04/09 at 5:04 AM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Visit the Wiki!

Some recent desktops

May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF

May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games

Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers


This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,959,647 hits



Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: