Jul
29

Conky

For a system monitor on my Ubuntu systems, I have found Conky is a excellent application. It is Script-able so you can make it look how ever you want, and if that isn’t enough it can execeute shell scripts and output the results to your desktop… I’ve seen a lot of people make Ruby scripts to extend conky but since I don’t know Ruby very well I’ve decided to completely misuse PHP and extend my Conky with PHP scripts! In this post, I will Show my Default Conky Appearence and post my .conkyrc file and the scripts I’ve used to make it look this way and explain what they do.

First Install Conky so type this into a Terminal

sudo apt-get install conky

To use the PHP scripts from conky, make sure you install PHP and PHP-CLI which PHP-CLI is pre-packed with PHP since v4.3

Even thou I use GNOME I love Amarok music player, so I use it even thou it requires KDE library files, For this script to work you will require the DCOP-PHP Class which I am hosting here. Please Note : I Did not write this Class, I am just hosting it here, if there is a problem with it please leave a comment below and I will remove it.

Personally I created a PHP directory inside my home directory, this is where i put all my classes and php files for conky to use.

Save this file in your newly created PHP directory, I called it np.php but thats up to you. The following file is a copy and general cleanup of the example script that came with the dcop.php class files. I made it work for amarok and cleaned it up some to save on server resources.


#!/usr/bin/php	// The ever important PHP shebang line
<?php
require("/home/shawnc/php/dcop.class.php");  // change this to the directory you saved the dcop.class.php file to
 
$dcop = new dcop;
$dcop->application("amarok","",""); //1st argument is necessary, 2nd and 3rd are either specified in your class
//or the defaults will be used
 
$dcop->app_function("player","isPlaying"); //decide if amarok is even playing
$isplay = implode(" ",$dcop->call());
 
if ($isplay) // If amarok is playing then keep going, if not don't waste server resources for nothing.
{
 
	$dcop->app_function("player","nowPlaying"); //call amarok's player function and get nowPlaying as an argument
	$playingstring = implode(" ",$dcop->call()); //This should return what's currently playing on juk
 
	$dcop->app_function("player","album"); //gimme the album
	$playingalbum = implode(" ",$dcop->call());
 
	$dcop->app_function("player","totalTime"); //how much is the total time (in seconds)
	$playing_tot_time = implode(" ",$dcop->call());
 
	$dcop->app_function("player","currentTime"); //how much is the current time (in seconds)
	$playing_cur_time = implode(" ",$dcop->call());
 
	echo "Currently playing in Amarok: \n" . $playingstring . "\n from the album: " . $playingalbum  . "\n";
	echo "Currently " . $playing_cur_time . " seconds far in the " . $playing_tot_time . " seconds long song\n\n";
}
 
?>
Jul
26

Ubuntu Linux on Toshiba P205-S6237 -> Part 1

Linux       Share This    Trackback

I just bought a new Toshiba laptop for my web development and all around personal PC, It came equipped with Windows Vista Premium when I first got it and I feel Vista is a improvement over XP in visual appearances but was a resource hog and well since I love PHP coding I find it easier to use Linux for my OS.

I tried afew different live CD distro’s but found Ubuntu Feisty Fawn to be the best running and easiest for me to use. I wanted to keep Vista around since I had it already there and I have a 120GB HD so This guide will be about the steps I took to make everything work as a Dual Boot system.

Step 1 - Disk Partitioning

Boot into Windows Vista and go into Disk Management - right-click My Computer, Manage, Disk Management.

Right-click on the main Vista partition and select Shrink Volume

Vista requires atleast 20 Gigs for its own system files, So I personally left 40 gigs for my installed applications and room to grow for later.

Now that you have shrunk your partition insert your Ubuntu Live-CD into the drive and reboot your computer.

SAFETY NOTICE : Resize your Vista Partition from Windows, DO NOT Let Linux Touch It Yet. I Learned this the hard way. If this has already happened to you then find a Repair CD for windows and try to repair your installation before going any further.

Step 2 - Run Ubuntu Installer

After rebooting with the Live-CD in your drive, Click on the Install icon on your new Desktop. This will go through a series of questions, about your Location, Keyboard Lay-out, and some other general things. Once you get to the Disk partitioning section, You will need to select Manual Install. Then select the New Unused Partition you made inside of Vista. Now you will need to create 1 Partition for your SWAP and which is normally 2x the size of the RAM inside of your computer. I Personally used 3gig’s and i have 1 GIG of RAM.

Select this as a SWAP file system. Then Create a new partition with all the rest of your space and select this as ROOT or /

Once you have finished this, click continue and it will finish the installation.

A Step by Step Guide For Ubuntu Installation can be found here.

Step 3 - Testing Features/Fixing Broken Features

Well I must admit, Ubuntu Feisty, pretty much installed without a problem on this computer. Everything was up and running and fully functional in no time at all except for afew minor adjustments. That fairly quickly found the answers to at the Ubuntu Forums via Google.
My Desktop Resolution was stuck in 1280×768 mode which i could not live with since My Laptop has a 17inch Widescreen Display capable of 1440×900. Afew modifcations to XORG.conf and a X-Reboot and that all got sorted out. The Sound Card Output also didn’t appear to function properly but once again some minor XORG.conf tweaks and that too was fixed in no time. Everything else that I’ve tested seems to work fine out of the box pretty much, So I’ll explain my conf file adjustments to make everything work. I Also adjusted my touchpad settings to remove the god awful Tap to Click setting.

So basicly, my Out of the Box Setup Problems were simply

  • 800×600 Resolution
  • Sound Did Not Work
  • Touchpad Was Set for Tap to Click

Well that’s not bad at all and all those problems are easy to fix so let’s fix them!

Please Note : I Have not tested Bluetooth capabilitys, and my multimedia buttons i belive work but I havent fully tested those either yet

Step 4 - Getting my 1440×900 Resolution Back

After much research about problems with the Intel 950GM Graphics Card installed in the Toshiba P205-S6237, it seems the easyest way to get the native 1440×900 resolution working is through the installation of a very easy to use application called 915Resolution. Make sure your Universe Repository’s are enabled in Synaptic Package Manager. Then Just Search for 915Resolution, mark it for installation and install it. Once it is successfully installed, Open a Terminal and type the following commands

    sudo 915resolution -l

This will output a list of all your supported Screen Resolutions and there mode numbers.

Intel 800/900 Series VBIOS Hack : version 0.5.2
 
Chipset: 945GM
BIOS: TYPE 1
Mode Table Offset: $C0000 + $269
Mode Table Entries: 36
 
Mode 30 : 640x480, 8 bits/pixel
Mode 32 : 800x600, 8 bits/pixel
Mode 34 : 1024x768, 8 bits/pixel
Mode 38 : 1280x1024, 8 bits/pixel
Mode 3a : 1600x1200, 8 bits/pixel
Mode 3c : 1920x1440, 8 bits/pixel
Mode 41 : 640x480, 16 bits/pixel
Mode 43 : 800x600, 16 bits/pixel
Mode 45 : 1024x768, 16 bits/pixel
Mode 49 : 1280x1024, 16 bits/pixel
Mode 4b : 1600x1200, 16 bits/pixel
Mode 4d : 1920x1440, 16 bits/pixel
Mode 50 : 640x480, 32 bits/pixel
Mode 52 : 800x600, 32 bits/pixel
Mode 54 : 1024x768, 32 bits/pixel
Mode 58 : 1280x1024, 32 bits/pixel
Mode 5a : 1600x1200, 32 bits/pixel
Mode 5c : 1920x1440, 32 bits/pixel
Mode 60 : 512x771, 8 bits/pixel
Mode 61 : 512x771, 16 bits/pixel
Mode 62 : 512x771, 32 bits/pixel
Mode 63 : 1440x900, 8 bits/pixel
Mode 64 : 1440x900, 16 bits/pixel
Mode 65 : 1440x900, 32 bits/pixel

Now in this list, find your Monitor’s max supported Resolution and Screen Depth ( on my Toshiba P205-S6237 it’s 1440×900, 32 Bits so mode 65)
Make sure you don’t go over your monitor’s max supported resolution as X will not Start if your lucky and if your not it can destory your monitor but probably won’t happen.

Ok, Now that we found out Mode Number, we need to edit the 915 Config file to remember these settings on each reboot. So Once again in Terminal type

sudo gedit /etc/default/915resolution

Now basicly, you just need to copy your Mode and Width/Height settings but this is my config file which works on my computer

#
# 915resolution default
#
# find free modes by  /usr/sbin/915resolution -l
# and set it to MODE or set to 'MODE=auto'
#
# With 'auto' detection, the panel-size will be fetched from the VBE
# BIOS if possible and the highest-numbered mode in each bit-depth
# will be overwritten with the detected panel-size.
MODE=65
#
# and set resolutions for the mode.
# e.g. use XRESO=1024 and YRESO=768
XRESO=1440
YRESO=900
#
# We can also set the pixel mode.
# e.g. use BIT=32
# Please note that this is optional,
# you can also leave this value blank.
BIT=

Now that we have found our supported mode, setup the config file now we must run 915 Resolution to do the actual work so once again in terminal type

sudo 915resolution 65 1400 900

If everything worked ok, you should see

shawnc@shawnc-laptop:~$ sudo 915resolution 65 1400 900
Intel 800/900 Series VBIOS Hack : version 0.5.2
 
Chipset: 945GM
BIOS: TYPE 1
Mode Table Offset: $C0000 + $269
Mode Table Entries: 36
 
Patch mode 65 to resolution 1400x900 complete

Now just reboot your computer and bingo you should be in your native 1440×900 resolution!

Ok Step 1, anytime you make changes to important config files always make a backup. so Simply do

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup

That makes a backup named xorg.conf_backup, Just incase something bad happens. Now personnally i like using nano for my text editor, but in this tut i’ll explain the graphical method to do this as its easyer

gksudo sudo /etc/X11.xorg.conf

This will ask you for your admin password, then open GNOME’s Gedit Text Editor with our config file. Now Hit CTRL-F to find

Section "Monitor"

This section probably looks like this

Section "Monitor"
	Identifier	"Generic Monitor"
	Option		"DPMS"
	HorizSync	28-72
	VertRefresh	43-60
EndSection

What i did was comment out my old HorizSync and VertRefresh and add new ones, this is mine

Section "Monitor"
	Identifier	"Generic Monitor"
	Option		"DPMS"
#	HorizSync	28-72
#	VertRefresh	43-60
	HorizSync       36-52
	VertRefresh     36-60
EndSection

Removing the Touchpad Tap-To-Click

Now the touchpad tap to click setting, drive’s me nuts,

While were in XORG.conf, let’s fix this annoying touchpad issue too

Just hit CTRL-F and Search for

Synaptics Touchpad

Once your there just add these 3 settings to the bottom of it.

	Option "SHMConfig" "on"
	Option "TappingOff" "1"
	Option "MaxTapTime" "0"

And that fixes your touchpad so you actually have to click the mouse buttons on it to click.

Fixing The Toshiba’s Speakers

Now the last thing I noticed was that my sound card wasn’t working apparently, After abit of googling i found that by simply adding 1 line to the ALSA config it will be fixed sorta. So back in the terminal paste this

gksudo gedit /etc/modprobe.d/alsa-base

Now at the very bottom of the file just add the following

options snd-hda-intel probe_mask=8 model=3stack

Ok, Close and save that file and reboot your computer. you should have a fairly functional Ubuntu Laptop now.

top
Close
E-mail It