#!/usr/bin/perl -w # RitBits is Jen's first script... first of anything like this actually. So expect bugs. # ( http://caffeinated-dreams.net ) # Version: 0.2 (June 29th, 2005) # Do whatever to this script. I don't care. #******Credits****** # Gamakichi for hardrive display improvements, and general perl-support. # Neovanglist for FreeBSD-fu. # Good folks in #Xion on IRC for support and allowing us to spam our testing. That's probably only because they were sleeping though. =) # Only edit hardrive information ($hdd2), the part that may need editing is labled. Otherwise do not touch below this unless you know what you're doing. :P IRC::register("RitBits", "0.2", "", ""); IRC::print "\cC2\cBRitBits loaded!\003 Commands are: /about /gfx /os /desk /cpu /disk /uptime"; IRC::add_command_handler("ritbits", "ritbits"); IRC::add_command_handler("gfx", "gfx"); IRC::add_command_handler("os", "os"); IRC::add_command_handler("client", "client"); IRC::add_command_handler("desk", "desk"); IRC::add_command_handler("cpu", "cpu"); IRC::add_command_handler("disk", "disk"); IRC::add_command_handler("uptime", "uptime"); sub ritbits { IRC::command("\cC2\cBRitBits\cB\003 - A n00b script by Jen, version 0.2 (\cBhttp://caffeinated-dreams.net\cB\)"); return 1; } sub gfx { $xorg = `xdpyinfo | grep X.Org"."version`; chop ($xorg); $res = `xdpyinfo | grep dimensions | awk '{print \$2}'`; chop ($res); $vid = `sysctl dev.drm.0.\%desc | cut -d : -f 2`; chop ($vid); @bits = `xwininfo -root`; foreach (@bits) { if (/^ +?Depth: (.+)/i) {$bits = $1;} } IRC::command("(\cC2\ \cB\Graphics\cB\ \003) \cB $vid \cB,\cB\ $xorg \cB\ (\cC2\ \cB\Resolution\cB\ \003) \cB $res \cB (\cC2\ \cB\Bits\cB\ \003) \cB $bits \cB "); return 1; } sub os { $os =`uname -srm`; chop ($os); IRC::command("(\cC2\ \cB\Operating System\cB\ \003) \cB $os \cB"); return 1; } sub desk { $desk =`kde-config -version | grep KDE`; chop ($desk); IRC::command("(\cC2\ \cB\Desktop Environment\cB\ \003) \cB $desk \cB"); return 1; } sub cpu { $model = `sysctl hw.model | cut -d : -f 2`; chop ($model); # Fix this, find something that works for BSD! $freq = `cat /proc/cpuinfo | grep 'cpu MHz' | head -1 | sed -e 's/^.*: //'`; chop ($freq); IRC::command("( \cC2\cB\CPU\cB\003 ) \cB $model \cB (\cC2 \cB\Frequency\cB\ \003 ) \cB $freq \cB"."MHz"); return 1; } sub disk { open(AWKFILE, ">.dawk") or die "Can't open .dawk: $!"; print AWKFILE '{ print "Used: "$3" Total: "$2 }'; $hdd1 = `df -h | grep /usr | awk -f .dawk`; chop ($hdd1); $hdd2 = `df -h | grep /usr2 | awk -f .dawk`; #Comment out if you don't have a second hard drive; otherwise change /usr2 to wherever the HD is mounted. chop ($hdd2); IRC::command("( \cC2\cB\Hardrives\cB\003 ) \cC2/usr\003: \cB $hdd1 \cB \cC2/usr2\003: \cB $hdd2 \cB"); close AWKFILE; system "rm .dawk"; return 1; } sub uptime { $uptime =`uptime`; chop ($uptime); IRC::command("(\cC2\ \cB\Current Uptime\cB\ \003) \cB $uptime \cB"); return 1; } sub client { $client = IRC::get_info(0); chop ($client); IRC::command("(\cC2\ \cB\IRC Client\cB\ \003) \cB X-Chat $client \cB"); return 1; }