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”}
{execute}
transset-df -p –inc 0.2
{/execute}
{/action}
{/mousebind}

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”}
{execute}
transset-df -p –min 0.2 –dec 0.2
{/execute}
{/action}
{/mousebind}

(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!

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


  1. 1 ofek February 22, 2007 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.

  1. 1 Hello world! « Urukrama’s Weblog Trackback on November 26, 2007 at 9:37 am
  2. 2 An Openbox Guide « Urukrama’s Weblog Trackback on November 26, 2007 at 10:48 am

Leave a Reply




Welcome!

Most recent desktops


September 2, 2008
IceWM-lite on Ubuntu 8.0.4.1
1Ghz Pentium III 512Mb PC133


August 14, 2008
Openbox 3.4.7.2 on Arch Linux
750Mhz Celeron 128Mb PC100


August 27, 2008
Openbox 3.4.7.2 on Crux Linux
550Mhz Celeron 192Mb PC100


June 22, 2008
IceWM 1.2.35 on Arch Linux
OLPC XO-1

Most recent game


StellaX 2.6.1 on Crux Linux
1Ghz Pentium III 512Mb PC133

Be counted!

License

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

Blogs worth watching

Ubuntu Feeds

RSS Planet Ubuntu Users

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 749,012 hits

Categories