Joachim Breitner

Created gaim-thinklight

Published 2005-06-26 in sections English, Digital World.

Because of Gnome 2.10's metacity focus stealing prevention feature, I would not notice new messaes in open gaim conversation windows. Since I have an IBM Thinkpad with a Thinklight attached to it (little LED on the top border of the display), I thought I'd use that to tell me about new messages.

Sitting here at the entropia again, I finished my gaim plugin hacking. Since the light is controlled via /proc, I had to write a suid program just to let the user control that file. That's not a nice solution, I wish /proc would be like /dev, where you just use chgrp et al to let the user control the devices. If any one is interested, I have (not very clean) debian packages.

Update: I have put okayish packages on http://people.debian.org/~nomeata/gaim-thinklight/. Comments are welcome. If there are enough comments, I'll consider putting it in debian, but only then, as it is quite specific.

Comments

I would be very interested in said packages! Please share.



Thanks!
#1 Adam G am 2005-06-27
I love it. Only one little bug that happens when you get two messages at almost the same time. The light gets "stuck" on because of a race condition.



If I have some free time I'll try and find a fix.



It would be nice too if it could periodically blink the light at a longer interval if you have unread messages.
#2 Chris (Homepage) am 2005-06-30
Hi, nice to hear that people are using it.



I thought about the race condition. I might fix it by setting the timer for the turn-off-light from within the turn-on-function.

I am also thinking (nothing more :-)) about making the blink sequence configurational, and have it blink differnetly for different events.



I don't know if you can make it blink while unread messages wait when the messages was actually shown but the window stays hidden (the reason I created the plugin in the first case). I'm not sure gaim knows whether the messages was not read...



Comments and patches welcome.
#3 nomeata (Homepage) am 2005-06-30
Very nice, thank you!

I added a note on http://www.thinkwiki.org/wiki/Ibm-acpi
#4 Arno Willig (Homepage) am 2005-07-16
Please add this to debian. I am getting myself a Thinkpad shortly and would love this feature.
#5 Rolf (Homepage) am 2005-07-26
It has been added, see http://packages.debian.org/unstable/net/gaim-thinklight (not in sarge, of course)
#6 nomeata (Homepage) am 2005-07-26
What is the license for this software, please?
#7 Mike am 2005-08-03
It's GPL, basically because I was too lazy to change the COPYING file from the gaim plugin that I used as a starting point :-).
#8 nomeata (Homepage) am 2005-08-03
Nevermind. Found it
#9 Mike am 2005-08-03
Works great, and I'm greatly amused! (It's useful too!)

One suggestion for development would be to be able to configure it to keep the light on until the message window gained focus, was typed in, etc. (like Message Notification plugin), in case you left the room or something and wanted to easily check whether any new messages had been received.

Also, being able to configure other options for how it blinks for different events would be fantastic.
#10 Tony Yarusso am 2005-10-07
Glad to hear you like it. Keeping the light on is a good idea, but see comment #2.1. The blinking sequence is already saved in a way that should allow easy customation, but someone just needs to hack up an UI.



Not sure if I'll get around to do any of this soon, but patches are welcome.
#11 nomeata (Homepage) am 2005-10-07
One other thing I noticed: If the light is already on, it will blink and end in the off state. In case someone was trying to use the light to work, would it be possible to have it blink and return to the state in was in previously? (By toggling its state rather than telling it to turn on and then off, or some such thing?)
#12 Tony Yarusso am 2005-10-07
This was requested a few times now. If you run debian unstable, you can get version 0.2 with this version with apt-get upgrade. To get the files directly, see http://packages.debian.org/unstable/net/gaim-thinklight
#13 nomeata (Homepage) am 2005-10-07
Hi... Im running GAIM 1.1.4 on Ubuntu Hoary. IBM ACPI is installed and running (can turn on light with echo on > /proc/acpi/ibm/light), but when I activate the plugin in GAIM, the program crashes when I receive an IM. Any ideas what might be going on?
#14 Alex Ravenel (Homepage) am 2005-10-20
Nope, no idea. Can you provide a backtrace? Also, maybe it needs to be rebuilt against the version in Hoary. Did you get your package from ubuntu universe? Then you might want to file a bug in the ubuntu bug tracking system.
#15 nomeata (Homepage) am 2005-10-20
Email sent with the backtrace. Thanks for the help.
#16 Alex Ravenel (Homepage) am 2005-10-20
Did you ever find a fix for this? I'm having the same issues. Compiled w/ debug mode, reports:



The program 'gaim' received an X Window System error.

This probably reflects a bug in the program.

The error was 'BadGC (invalid GC parameter)'.

(Details: serial 4610 error_code 13 request_code 60 minor_code 0)

(Note to programmers: normally, X errors are reported asynchronously;

that is, you will receive the error a while after causing it.

To debug your program, run it with the --sync command line

option to change this behavior. You can then get a meaningful

backtrace from your debugger if you break on the gdk_x_error() function.)
#17 Joe Glass (Homepage) am 2006-04-05
Sorry, no idea. I don't think my plugin can cause X errors, as it does not do anything graphical...
#18 Joachim Breitner (Homepage) am 2006-04-05
Cool idea. I'm working on setting it up now.
#19 phisrow am 2005-10-25
<strong>Trackback:</strong> <a href="http://joachim-breitner.de/blog/archives/112-Lightweight-Replacement-for-111-lines-of-code.html">Lightweight Replacement for 111 lines of code</a><br />

Chris Lamb has announced his gaim plugin &#8220;gaim-lightthink&#8221; both on his blog and on the thinkpad-linux mailing list. His plugin does basically the same thing as my gaim-thinklight plugin. I was a bit surprised to read that his plugin is supo
#20 nomeata's mind shares (Homepage) am 2005-11-16
Thanks!



Very cool feature. Here's hoping it works with the newest verison!
#21 Gaim-butt am 2005-11-18
Great util, THANKS!
#22 Vinnie (Homepage) am 2005-12-07
would it be possible to activate the light only when a message arrives in a window which is out of focus? the idea is simply great, but I get kind of annoyed if it is constantly blinking during a "talk".



thx,

wolfgang
#23 fechter am 2006-01-03
Hi,



that idea makes sense, but I don't know enough about the internals of gaim, and I am currently too lazy to find out. If you or someone how ever can point me to the appropriate docs that tell me how to code that, I can certainly do that.
#24 Joachim Breitner (Homepage) am 2006-01-08
hi joachim,



I'm completely clueless on this topic - but there is a routine in the regular preferences for the sound ("sounds when conversation has focus" yes/no) perhaps one can salvage something there?



danke für die antwort,

wolfgang
#25 fechter am 2006-01-09
This comment box won't let me post my script or a link. Click the Link next to my name to see the script I call with 'blinklight %s'. Change delay and repeats to your liking.
#26 stephen (Homepage) am 2006-05-28
Hi Joachim!

Short question: will there ever be an update to make it work on gaim v2?

thx!
#27 buvens am 2006-06-01
No changes to the code are required, just re-compile it (if you have compiled it from source) or get the newest version from Debian experimental (see http://packages.debian.org/gaim-thinklight)
#28 Joachim Breitner (Homepage) am 2006-06-01
Well installing the deb. package didn't work, but I got some help and finally it works now. Recompiling the sources solved the problem...



...and last but not least:

Great plugin! I love it :)
#29 buvens am 2006-06-02
May I ask on what distribution the .deb did not work, and why it did not work?



Glad you like it!
#30 Joachim Breitner (Homepage) am 2006-06-02
I was the one who helped him :) The debian experimental did not work on Ubuntu Dapper with unofficial gaim2 packages from

"deb http://people.ubuntu.com/~seb128/deb ./" (unofficial repo from the official ubuntu gaim maintainer). It did not work because the debian gaim is named 2.0 and the ubuntu one 1.99. So I recompiled the gaim-thinklight package from the official repos with gaim-dev 1.99. And now it works :) If you want, I can send you the .deb I made.



greets

fabio
#31 Fabio Berta am 2006-06-02
I see, just a temporary problem until 2.0 gets into unstable and regular ubuntu. You could ask seb128 to put your deb along his gaim version in the meantime, if you want.
#32 Joachim Breitner (Homepage) am 2006-06-02
Hello there!



Well, excellent plugin I must say, though I second the opinion of fechter that the blink should only occur in out of focus windows. I haven't found a way to do that yet, but I'm looking into it (no idea where to start!).



Secondly, how is this installed on a non-Debian system? I'm sure the source must be extractable somehow, but I'm unfamiliar with .debs.



Thanks
#33 Bob am 2006-07-11
You can grab the .orig.tar.gz from http://packages.debian.org/unstable/net/gaim-thinklight and build it as usual. Note that you have to manually build and install the hinklight-fixperm program.



If anyone wants to fix this by fixing all that ugly autoconf stuff, I'll happily accept patches.
#34 Joachim Breitner (Homepage) am 2006-07-11
Hi just installed the plugin and makes me feel happy happy :D

Keep up the good work, I've always known thinkpad is the best ;)
#35 marin am 2006-08-15
any ports for windows?
#36 munkay am 2006-08-26
Not from my side, and unless someone ports the /proc filesystem and the ibm kernel module to windows, not from my code. Sorry :-)
#37 Joachim Breitner (Homepage) am 2006-08-26
I added some bits so the current state of the light before the message is left after the 'blink'. I think this is important because I may be using the light and I don't want it turned off when the blink is done.



It isn't pretty, but it works.



44a45

> #define LIGHT_STATUS "/tmp/ibm_light_status"

70a73

> char status_cmd[256];

71a75

> char write_cmd[256];

72a77

> char cmd2[1024] = "{ ";

73a79,95

> // Find the status of the light.

> sprintf(

> status_cmd,

> "cat %s | grep status | sed 's/.*\\\(o.*\\\)/\\1/' > %s ; ",

> LIGHT_FILE,

> LIGHT_STATUS

> );

>

> // Reset status of light

> sprintf(

> write_cmd,

> "cat %s > %s ; ",

> LIGHT_STATUS,

> LIGHT_FILE

> );

>

>

85a108

> strcat(cmd, status_cmd);

89a113

> strcat(cmd, write_cmd);
#38 greg am 2006-09-27
Thanks for the patch. Do you have the newest version? It _should_ keep the state already. If not, it's a bug...



Also, it's always nicer to get patches in the "unified" format ("-u"), and by mail.
#39 Joachim Breitner (Homepage) am 2006-09-28
<strong>Trackback:</strong> <a href="http://www.joachim-breitner.de/blog/archives/187-Im-responsible-for-reduced-attention-in-a-NY-university.html">I'm responsible for reduced attention in a NY university</a><br />Some Brett from Rensselaer Polytechnic Institute in Troy, NY writes on his blog that my gaim-thinklight plugin is bad for attention in class. Sorry, guys :-)
#40 nomeata's mind shares (Homepage) am 2006-10-13
Crashed.



1. Successfully Compiled from source on Fedora Core 6 with Gaim 2.0.0-0.26.beta5.fc6.



2. Enabled plugin, gaim crashed.

3. Restarted Gaim, enabled plugin, gaim stayed running with weird gui problems.

4. Gaim crashed.

5. restarted gaim, gaim crashed.

6. removed plugin files from /usr/lib/gaim/...restarted gaim.



Done.



it's late...i'm going to bed.
#41 Vince am 2007-02-05
Sorry, it is not crashing here, so I need your help to get that fixed, if it is a problem with gaim-thinklight at all. I am surprised that it affects the GUI: What kind of GUI problems are that? Does it also happen with gaim-text (if FC6 ships that)? Can you run it in gdb or strace to see when it is crashing? Is it crashing when a new message arrives?
#42 Joachim Breitner (Homepage) am 2007-02-05
I'm experiencing the same thing.
#43 Bryan (Homepage) am 2007-02-14
Again, I’m at a loss what is causing this.



Could you, Bryan, try to produce a backtrace with gdb? Are you also on FC6?
#44 Joachim Breitner (Homepage) am 2007-02-14
Joachim,



Are there any plans to release a new vesion for Pidgin (Gaim's successor)?

So far I think this is the best plugin ever if you have a Thinkpad!
#45 Hendrik-Jan (Homepage) am 2007-05-11
Yes, there are plans and I hope I’ll get around to do it beginning of next week.



I’ll also probably name it “pidgin-blinklight”, because it now supports ASUS laptops (or so I’ve heard, I coudn’t test that code of mine :-))



If I haven’t done it next week tuesday, feel free to bug me by mail, ICQ or Jabber . And thanks for the praise!
#46 Joachim Breitner (Homepage) am 2007-05-11
do you intend to include any of the discussed features? I'm still hoping for the "only blink if out of focus"-feature, otherwise it is far too annoying. :)



ansonsten: gute arbeit,

wolfgang
#47 fechter am 2007-05-11
I’m still not interested a lot in that feature myself. But if someone provides a patch (or maybe a gift certificates for the movies or amazon ;-)), it would be implemented as an option.
#48 Joachim Breitner (Homepage) am 2007-05-11
Allright, I have some packages here. I don’t know when I will upload them to Debian, but if you want to test them: You are welcome! Comments appreciated, of course.



http://people.debian.org/~nomeata/gaim-thinklight/
#49 Joachim Breitner (Homepage) am 2007-05-11
<strong>Trackback:</strong> <a href="http://www.joachim-breitner.de/blog/archives/239-gaim-thinklight-pidgin-blinklight.html">gaim-thinklight → pidgin-blinklight</a><br />

I once wrote a plugin gaim called gaim-thinklight, which simply blinks your ThinkPad’s ThinkLight when you get a new messge. Very recently, gaim was renamed to pidgin, so gaim-thinklight is now called pidgin-blinklight. I changed the second part not bec
#50 nomeata’s mind shares (Homepage) am 2007-05-15
Hi .. nice tool, though it would be cool if there was an option to keep the light on until I read the message .. this would be pretty helpful if you're not always at your laptop and it is therefore locked, so you don't even see the blinking tray-icon
#51 Martin Raißle am 2008-06-07
Sure, why not. I’ll accept patches :-)
#52 Joachim Breitner (Homepage) am 2008-06-09
Hi!

Wouldn't it be possible to adapt that for a thunderbird addon/plugin ?

Thanks, Dirk
#53 Dirk Haar am 2010-07-11
It would probably be possible – you just have to convince someone to create it...
#54 Joachim Breitner (Homepage) am 2010-07-11

Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.