I use Pidgin for my instant messaging, but I also use a tiling window manager. Getting the conversation window to appear in the right place is a tricky problem. After years of horrible kludges, I finally got around to solving this problem the right way: by changing Pidgin to make new conversation tabs appear inside the Buddy List window. So, I just have to put that window in the right place once, and all (one of) my pidgin windows are in the right place all the time.
Now, I am not a Pidgin developer. I've never even made a Pidgin plugin until tonight. So, the pre-pre-alpha-quality code which I'm revealing here is about as much of a horrible kludge as all my previous window manager tricks. But, this kludge works better than all the previous ones, so I'm sticking with it, and I'll get the code cleaned up over time.
By the way, there is a two-year-old enhancement request for this feature on the Pidgin Trac. The approach suggested in the comment there by deryni is the approach I used, and it seems to work fine.
So what is that approach? First, there is a plugin. Pretty much all the functionality is in the plugin (but not quite, because I needed to extern some functions that used to be private to the conversation window module, and I made a slight addition to the heirarchy of GTK containers inside the Buddy List window). So, in order to use this plugin, you actually need to build the entire Pidgin source tree with my patches.
Oh yeah, my patches. Here they are. There are two files in there that you need. patch is a diff of my changes to the main Pidgin source tree. onewin.c is the plugin source. Put it in $PIDGIN/pidgin/plugins, and once you've built the Pidgin source, go into $PIDGIN/pidgin/plugins and run make onewin.so to build the plugin. Then copy onewin.so into ~/.purple/plugins. (Note: it seems that you can't just run the pidgin binary from the source tree, because it can't find some important modules, like the IM protocol handlers.)
One more step is required for the plugin to work, but first I will digress a bit into its implementation. Pidgin has a concept called "conversation placement functions." There are a bunch of default placement functions which provide behavior like "one conversation per window" or "all conversations in one window." My plugin provides a new conversation placement function called "onewin" that puts conversations inside the Buddy List window. In order for my plugin to actually do anything, though, Pidgin has to decide to use the onewin placement function. I haven't yet figured out how to do that in any reasonable way, so I just edited ~/.purple/prefs.xml so that /purple/conversations/placement was set to onewin. (You also need to have the plugin enabled. Right now, it will show up in your plugin list as "Hello World" because I haven't changed its name. I'm not sure what happens if you try to use onewin when the plugin isn't enabled.)
There are some known issues with the plugin. You can look at my to-do list if you are interested.
There are also a lot of unknown issues with the plugin. If you find any of them, please tell me.
Finally, I will note that I am building and testing this on Arch Linux i686. I think it should build on any platform where Pidgin builds, but I'm not going to try it. If you do, I'd like to hear about it.
0 comments:
Post a Comment