Tuesday, May 8, 2007

Tuesday, May 1, 2007

Blogger is letting me down

I'm getting very frustrated that I can't upload files to Blogger. I'm going to start looking into other blogging websites so this page will probably move soon.

I'm writing this blog just for my own notes and as a developer my 'notes' generally include a lot of source code. Having to paste code into a blog post seems somewhat ridiculous to me.

If anyone has some suggestions, feel free to post them.

---

Update: I'm going to be setting up a web server for a friend of mine who is willing to share the IP space with me. So, I'll, hopefully, be heading up to the colocation facility sometime this weekend. I've been meaning to play with ubuntu server edition, so this will be my chance. I probably won't be updating this blog until it is set up.

Thursday, April 26, 2007

Screenlets, non-3D

Just a quick post about something that's been bothering me for a while.
For anyone who uses screenlets, ever notice that if you use Beryl (at least 2.*, dunno about newer versions) and have the 3d effects plugin, the screenlets act like they're regular 3d windows? That bothers me so much.

So I updated the screenlets code. It's just a quick hack. Just find your installed screenlets __init__.py file (Mine was at /usr/lib/python2.4/site-packages/screenlets/__init__.py)
Find where it says the following (around line 740):
            self.window.window.set_type_hint(
gtk.gdk.WINDOW_TYPE_HINT_UTILITY)

and then change it to:
            self.window.window.set_type_hint(
gtk.gdk.WINDOW_TYPE_HINT_DOCK)

Then, just set all the screenlets as widgets (Right click -> window -> widget) and restart the screenlets daemon or the beryl 3d effects plugin. (Yeah that's annoying, but it's only got to be done once).
Simple huh? Be careful not to add any extra spacing or anything like that. Python is pretty sensitive with that.

OK, I'll respond to comments/emails tomorrow, I promise.

Monday, April 23, 2007

Instructions to get fullscreen, background wine applications in beryl

Assumptions:
1) You have wine and know how to use it (Running programs, winecfg, etc)
2) You have beryl running.
3) You have some amazing application that you want to run in fullscreen and in the background. (And possibly with different opacity, brightness, etc). I would recommend Dream Aquarium. thedarkmaskter has a tutorial on his blog on how to set it up. (Note, some setting will change from his instructions)
4) You have download the source code to Beryl Window Property Setter. It's a small application I wrote to get this to work. Should just download the file on the home page, then run make.

Instructions:
1) Run winecfg. Go to the graphics tab and check "Emulate a virtual desktop". Set "Desktop Size" to your desktop size. (I have mine set at 1400x900 and it runs smoothly). All other settings shouldn't make a difference. Although, I have "Allow the window manager to control the windows" unchecked. Hit OK.
2) Run the program through wine. ie: wine "C:\\Program Files\\Dream Aquarium\\Dream_Aquarium.scr". Now you should have the screensaver running in a window that is the size of your desktop. Make all settings (Number of fish, etc) you want now, because you won't be able to change them afterwards.
3) run bwpropset as follows: ./bwpropset -fs -s -sp -st -nf -ni -b -op .8
Then you'll see a crosshair. Select the wine window. If all goes well, you should have the window in the background of your desktop, much like xwinwrap.

Some more details:
-fs = fullscreen
-s = sticky
-sp = skip pager
-st = no focus
-ni = no input
-b = background
-op .8 = opacity at 80%

Play around with it until you find settings you like. Use the --help option for other features and possibilities.

Thursday, April 19, 2007

Dream Aquarium Come True

Just to add to my previous post, here's a a small snippet I made using the vidcap plugin in beryl:



As you can see, there are still some issues to work out, but it works pretty well.

Tuesday, April 17, 2007

Swimming in Wine

I finally got a chance to play with editing beryl source code today. I read up on thedarkmaster's blog, a tutorial about how to setup Dream Aquarium on Beryl. Only problem is, it takes up the entire screen and nothing can run above it. So, I've played with the state plugin within beryl to edit the attributes of the window so I can put it on the bottom of all the windows, full screened, and sticky. Here's what I got so far:





Tuesday, April 10, 2007

Vista Black Screen of Death

Got a nice taste of the wonderful world of Vista today. I tried to install it on my Raid 0 (hpt374). I was excited that it let me load the drivers from a CD instead of a floppy disk. Progress! All goes well except once I reboot it tells me the install is corrupt. Can't seem to find the winload.exe file. Of course it can't, it hasn't loaded the drivers for the raid yet! Went to the recovery console and I was right. No drivers were copied over. How does that make sense? So, I don't know too much about how windows works and definitely not a lot about how Vista works, so I said forget it, I'll install it on my regular old ATA drive.

Of course, I need to partition it. So I use ntfsresize (in linux) and fdisk (quick tutorial coming next post). Pop in the vista CD and... nothing. Sweet sweet blackness. OK, maybe more than nothing, it says its loading, I see the word "Microsoft" and a status bar, and then that disappears and then nothing. How convenient. Maybe I was supposed to just sit around and wait for a while, but I didn't hear anything spinning around so I figured it was dead. Must have been the ntfsresize. I know I'm supposed to run chkdsk on the drive after I use ntfsresize, but I didn't expect this kind of result.

So, to fix it, I pop in the Windows XP cd (thanksfully I had it around). Go into the command line, run chkdsk on the drive. Reboot using the Vista disk and voila, now it works. Finally got it working. All 7.5GBs of it.

Progress indeed.

Monday, April 9, 2007

Gaim Function Hijacking

Although gaim allows plugins to do a lot of different things, sometimes it's necessary to do something that I don't think the developers ever intended. Gaim sends out signals to plugins when certain events happen, but sometimes those signals aren't enough.

In my upcoming facebook plugin, I need to add info to the "Get Info" dialog (for away message stalking). Since there is no signal, I ended up hijacking the notify_userinfo function within the GaimNotifyUiOps structure. Details:


//NOTE: this isn't a full plugin, so don't try to compile this

//Will contain the notify_userinfo function we steal control from
void *(*hijacked_notify_userinfo) (GaimConnection *gc,
const char *who, GaimNotifyUserInfo *user_info);

//this is my notify userinfo, this gets control after a GaimNotifyUserInfo
//is created and is about to be shown
static void *
my_notify_userinfo(GaimConnection *gc, const char *who, GaimNotifyUserInfo *user_info)
{
//Do what we want to the user_info
gaim_notify_user_info_prepend_pair(user_info, "Hijacked by", "Neaveru");

//Now pretend like nothing happened, send control back to where its supposed to go
return hijacked_notify_userinfo(gc, who, user_info);
}

static gboolean
plugin_unload(GaimPlugin *plugin)
{
//Here we just return control to the normal notify_userinfo
GaimNotifyUiOps *ops = gaim_notify_get_ui_ops();

if (ops) //dunno why this wouldn't be true
ops->notify_userinfo = hijacked_notify_userinfo;

}

static gboolean
plugin_load(GaimPlugin *plugin)
{
//Take a look at libgaim/notify.h for definitions of this var
GaimNotifyUiOps *ops;
ops = gaim_notify_get_ui_ops();

//Check that ops and notify_userinfo exist, this is important
//since technically if someone isn't using the default gtkgaim,
//they could have no notify_userinfo function
if (ops && ops->notify_userinfo)
{
hijacked_notify_userinfo = ops->notify_userinfo;
ops->notify_userinfo = my_notify_userinfo;
}
return TRUE;
}


And there you have it, now the order of events when you click on "get info" over a buddy:
1) The protocol plugin (ie oscar, irc etc) will generate a userinfo with all the info to show
2) The user info is sent to the ops->notify_userinfo function, which is now our function
3) Our function has its way with the userinfo. We then send it to the original notify_userinfo
4) The original notify_userinfo does whatever it was going to do before.

Take a look at libgaim/notify.h and libgaim/notify.c for more info

The nice thing about this is that you don't even have to worry about other plugins stealing control of the user info before or after you. This will just chain them along.

gnome-dock

Finally managed to get gnome-dock working on here.
Quick screenshot:


Quick how-to:
1) Get cairo from http://cairographics.org/download. I was able to just get the source and ./configure && make && make install, though some dependencies may be required. I also believe they have a deb file which I should have probably looked into.
2) Get Gnome-dock (cairo-dock) from http://www.gnome-dock.org/trac/browser/trunk
This I just downloaded the zip from the "Zip Archive" link at the bottom. I didn't feel like messing with yet another source repository program.
3) I had had GL linking issues, so I had to install nvidia-glx-dev.
4) For whatever reason, in this version, the execute command was commented out. Uncomment this line:
g_spawn_command_line_async (icon->acCommand, &pError);
5) make
6) If all goes well this far, then run: mkdir ~/.cairo-dock and then copy some .desktop files over. (I just did a cp ~/Desktop/*.desktop ~/.cairo-dock

Facebook Status

I'm currently writing a plug-in to integrate facebook into gaim. More details on it later, but I did manage to reach a minor milestone today:



Notice between "Logged In:" and "Away Message:" there is a "Facebook Status"? Clearly, it needs a lot of work, but it's a start. (By the way, the above away isn't mine. Notice the logged in time of 21 hours? No chance. I've managed to crash gaim so many times, I don't think I've been logged in for more than an hour straight)

Desktop

As a first post, here's what I'm working with:



This is a fresh install of Ubuntu Edgy Eft (6.10) with Beryl.