A Django site.
September 24, 2008

Aaron Toponce
atoponce
Aaron Toponce
» New Irssi Theme - 88_madcows

Yesterday, while students were working on labs, and I was bored stiff, I decided to update my Irssi installation running on my Debian SPARC box. I spent some time cleaning up the config (not by hand, mind you, but through the options in the interface) by updating the servers I connect to, the channels I want to autojoin, the networks, updating aliases and scripts, and a number of other things. Then, I realized it was time for a theme other than default.

I had run the madcow theme in the past, but I wasn’t happy with a few aspects of it. For example, I didn’t like the nicks being right-aligned based on the last character of their nick. Because of this, the developer of the the theme chose a max length for the nicks that meant cutting off any nicks that extended past that max. Why not just left-align it to conserve space? Also, there were aspects of the theme that didn’t tie in well with itself. So, after several hours of hacking, I finally settled on my new theme. It’s not a big departure from the madcow theme, as I loved the color scheme and much of the formatting, and wanted to keep it. However, I also wanted to change what was driving me nuts about the theme. Now, I’m no Irssi theme hacker, so I’m sure there are better ways to reach some of the formatting decisions that I made, but it’s working well, so I’m happy.

I decided to name the theme 88_madcows, after my IRC nick ‘eightyeight’ and keeping homage to the madcow theme developed by dubkat. Below is a screenshot of the theme in action. If you would like to download it, I’ve provided a link as well. I would recommend running the following commands in your Irssi for maximum theme integration (I have usercount.pl, trackbar.pl and nicklist.pl installed):

/set hilight_color %g
/set hilight_act_color %R
/set trackbar_style %g

Full 1680×1050 screenshot here (using the Tango color scheme in gnome-terminal).
Theme download here.

April 17, 2008

John Anderson
sontek
sontek ( John M. Anderson )
» Printing in GTK#

I just finished porting Tomboy’s print code to GTK so that we would be more portable and I thought other Mono apps looking to move from libgnomeprint or wanting to add printing support might find a code example helpful.

First, To start printing you do something like:

private void PrintButtonClicked (object sender, EventArgs args)
{
Gtk.PrintOperation op = new PrintOperation ();
op.BeginPrint += new BeginPrintHandler (OnBeginPrint);
op.DrawPage += new DrawPageHandler(OnDrawPage);

op.Run (Gtk.PrintOperationAction.PrintDialog, this.Window);
}

after the PrintOperation is set off you need to handle the BeginPrint event. The main things that need to be done are finding out how many lines will fit on a page and how many lines you have:

public void OnBeginPrint(object sender, Gtk.BeginPrintArgs args)
{
PrintOperation op = (PrintOperation)sender;
lines_per_page = (int)Math.Floor ((double)args.Context.Height / (double)font_size);
Gtk.TextIter start_iter, end_iter;
this.Buffer.GetBounds (out start_iter, out end_iter);
lines = this.Buffer.GetText (start_iter, end_iter, false).Split ('\n');
op.NPages = (int)Math.Ceiling ((double)lines.Length / (double)lines_per_page);
}

Finally, now that you have the printing setup, you need to actually render the data to be printed:

public void OnDrawPage(object sender, Gtk.DrawPageArgs args)
{
PrintOperation op = (PrintOperation)sender;
Cairo.Context cr = args.Context.CairoContext;

int line = args.PageNr * lines_per_page;
int num_lines = 0;
if (args.PageNr+1 != op.NPages)
num_lines = line + lines_per_page;
else
num_lines = lines.Length;

cr.MoveTo (0, 0);

for (int i = 0; i < lines_per_page && line < num_lines; i++)
{
Pango.Layout layout = args.Context.CreatePangoLayout ();
Pango.FontDescription desc = Pango.FontDescription.FromString (”sans ” + font_size);
desc.Size = (int)(font_size * Pango.Scale.PangoScale);
layout.FontDescription = desc;

layout.SetText (lines[line]);
Pango.CairoHelper.ShowLayout (cr, layout);
cr.RelMoveTo (0, font_size);
line++;
}
}

This does not take into account styles but will give you the basic idea of what needs to be done.

March 4, 2008

Aaron Toponce
atoponce
Aaron Toponce
» Static Windows In Irssi

My wife and I have A LOT of DVDs. As any normal logic-based person would do, we categorized the movies alphabetically in ascending order. As our collection grew, we added movies in their appropriate position. Unfortunately, due to the nature of our shelving, this meant taking large chunks of movies, and moving them in masse, to make room for a movie in the “B” section, a movie in the “G” section, a few movies in the “L” section, a couple movies in the “R” section and a movie in the “W” section.

As the collection grew, this grew more and more tedious, until I discovered a simple solution to the problem. Rather than keep the movies back-to-back from A to Z, throw in spaces at periodic points through the alphabet to account for growth. In other words, put some space between sections “F” and “G” to allow for 5 DVDs growth in A-F. Put more space between sections “L and “M” to allow growth for 5 DVDs in G-L. Follow this through the remainder of the alphabet, and sanity has once again entered your DVD collection.

Nothing is more annoying than automatic, especially when automatic is random. I don’t like DHCP, as such, all my IP addresses at home are statically assigned. I don’t like automatic transmissions, rather, I prefer to have granular control over my vehicle. Further, I don’t like the automatic window numbering of Irssi. I would much prefer to have all my windows stay in static locations, regardless of whether or not a join or leave a channel. Just because I close a window, doesn’t mean I want all of my windows there after to be renumbered. I’ve been an Irssi user now for nearly 2 years, and I had no idea that static windows existed until today.

So, with this news, suppose you are in 25 channels. You would like to “categorize” your windows in such a manner that is consistent with the existing channels. For example, maybe you are in 6 ubuntu channels, 5 generic support channels, 7 local channels (LUGs, user groups, etc), and 7 private messages. Further, let’s say you have the categorized together as follows:

1: status
2: &bitlee
3-8: ubuntu channels
9-13: generic support channels
14-20: local channels
21-27: private messages

That’s a fairly clean irssi window list. However, what happens if you want to join a new ubuntu channel? Then, by default, it becomes the last window. So, in our example, it would be window 28. Well, now our list is fragmented. I want all the ubuntu channels together. So, I add it to the Ubuntu window group. However, this has now pushed all of my support channels down by one: My new window list would be as follows:

1: status
2: &bitlee
3-9: ubuntu channels
10-14: generic support channels
15-21: local channels
22-28: private messages

If #irssi was at location number 13, it has now been moved to window location 14. This can be annoying when trying to remember what channel number belongs to what channel, especially if I visit the channel often.

Further, what happens when I leave a channel, or more? All the windows are shifted accordingly, getting renumbered yet again. The new window scheme could be as follows:

1: status
2: &bitlee
3-9: ubuntu channels
10-13: generic support channels
14-19: local channels
20-26: private messages

Talk about insanity! Wouldn’t it be nice if I could have space between groups to allow for growth and shrinkage, without affecting the placement of the rest of the windows, just like my DVDs? Wouldn’t it be nice if I could have my windows organized as follows:

1: status
2: &bitlee
3-9: ubuntu channels
21-25: generic support channels
31-37: local channels
41-47: private messages

In other words, there are now “gaps” between my windows, which allows for growth, without affecting the other windows. Further, if I leave a channel, I don’t want it affecting the others. So, the question remains now, how do we set this up? Luckily, I just need to change an Irssi setting, then I can start my window numbering. The first thing I need to do is turn off automatic window renumbering. I can run the following command from within Irssi:

/set windows_auto_renumber off

With that “feature” turned off, I can now focus on sending my windows to their appropriate spots. If ##jabber was in window 10, but I want to send it to window 21, I can issue the following command (assuming I’m already at the ##jabber window):

/window number 21

With “/window number”, I can send any window to any number in my session, thus giving me the ability to create “gaps” between my windows allowing for growth. Further, now when I close a window or leave a channel, it won’t affect the windows following it by renumbering them.

Don’t forget to save your changes to the config file:

/save

Finally, window categorization sanity! That made my day! Further, if you take advantage of saving your layout, then, when joining previously “remembered” channels, it will go in it’s previous position. This can be done with:

/layout save

Nice.

March 13, 2008

John Anderson
sontek
sontek ( John M. Anderson )
» Update Twitter from irssi

I wrote a quick little perl script/irssi plugin that allows you to update twitter from irssi. It also has autocompletion for names from your friends and follower list. You can get it here: http://devtoo.net/svn/twitter/twitter.pl

To use this script place it in ~/.irssi/scripts and then type /load twitter.pl in irssi

Usage:
/twitter u I’m updating twitter from irssi
/twitter d sontek I’m direct messasging sontek from irssi

DISCLAIMER: First perl script I’ve ever written, i’m sure I’ve done things wrong.

January 2, 2008

John Anderson
sontek
sontek ( John M. Anderson )
» Pimp my irssi

To start the new year, I was wondering what everyone’s favorite theme, scripts, and hacks for irssi are. I currently use the default irssi theme with the following scripts:

  • nicklist.pl - Allows me to see the user list in each channel, giving it the feel of the majority GUI IRC clients.
  • screen_away.pl - When I detach from my screen it will then set me to away and save any highlighted messages into the status window so I can easily respond to my people who were talking to me.
  • trackbar.pl - Sets a line at the last line that was viewable before I switched channels/windows, that way I can easily find the last place I read and continue from there.
  • splitlong.pl - Splits long messages

outside of the custom scripts I use, I also have:

scrollback_lines 100000
autolog = "yes"
autolog_path = "~/.irssi/irclogs/$tag/$0-%m%y.log"

November 9, 2007

Will Smith
no nic
Explorations
» Text Based Chat Clients

I recently was introduced to a couple of text based chat clients that I tried out for a while. The First, IRSSI. I love IRSSI, it feels more powerful and not so much "made for babies" compared to other IRC clients that I have used. I also love that I can wrap it in screen and then have my same session wherever I ssh from. The auto logging feature is cool, and for being text based was very easy to configure for auto-join server and channels.
That only covers IRC though, so, at the suggestion of a friend I tried CenterICQ. CenterICQ was easy to set up, did my jabber, ICQ, and MSN accounts easily. And then after an easy setup everything else was cumbersome. I really really hated having to use CTRL+x to send a message. That is the most counter-intuitive thing I have ever heard of.

In short, I have yet to find a decent text based chat client for Jabber, ICQ and MSN. If anyone has a suggestion leave a comment and I'll check it out.

September 27, 2007

Aaron Toponce
atoponce
Aaron Toponce
» Call To Irssi Users Everywhere

I’m currently getting tired of my theme (madcow) that I’ve been using in Irssi. It’s been my main theme since practically the day it was released, which was probably a couple years ago. It’s been good, but I’m ready for something new. So, if you use Irssi, and use a theme other than the default provided, I’m interested. I’m following this post at Ubuntuforums.org as well.

  1. What theme do you use?
  2. Why do you use that theme?
  3. Please post a screenshot or a link to one (not a link to the Irssi.org/themes theme) in the comments.

Thanks.

June 27, 2007

Clint Savage
herlo
Sexy Sexy Penguins » Tech
» fnotify Revisited - irssi has a message for you

I’ve debated this for some time. How long should it be to be notified of an instant message (IM), or private message (PM), or someone saying your name in internet relay chat (IRC)? I’ve still not answered this question, but I’ve got at least a tool that will help you when irssi receives a message directly to you.

This tool was first described to me here. And I blogged about it in this previous post. The general idea is to set up an irssi script that will write out data to a file. That file, in turn was read by the tail command over ssh and a notification window would appear anytime a new message was sent directly to you.

That capability hasn’t changed. Instead, I’m trying to improve how that is done. In the old way, a persistent ssh connection was needed to tail the file on the remote machine running irssi. This caused headaches and problems; some were easy to deal with, others much harder. I think for the most part, I’ve addressed these issues.

What does the new script do you ask? Well, the perl part from the original hasn’t changed, the other script have changed, however. Its been divided up into two scripts in fact. The original script irssi-script.sh now obtains the flat file written by the irssi perl plugin using a cron job that runs every minute. The new file fnotify.sh will run every 10 seconds and check to see if the flat file has been downloaded. Once it detects a new file, it will display the contents of that file as messages using the notify-send tool.

All of the scripts are available from my svn repository at http://www.herlo.org/fnotify. Please feel free to check it out as its set up for anonymous checkout.

I’ve provided a README and an INSTALL file which should help you get the script set up for you. Please send an email to clints At UToS . OrG or comment here on the blog with any questions and I’ll happily try to help.

Back to my original question. How long should it take? Will you let me know?  Currently, this script can take as long as 1 minute 10 seconds to send notification of a message.  Is this too long?

Thank you,

Herlo