Tag Archive "customization"

conky for my desktop

Published April 22nd, 2010 by Chad

At work I have a todo list that I maintain in a simple text file on my system. This todo list looks create and is readable on the command line (using cat) and in vim. However, I was really wanting it in a place where I could see it at a glance.

Also sometimes I miss the Ubuntu notifications in the top right corner of the screen (my background is black and the notifications don’t stand out on a black background since they are also black (I can’t wait until we can easily customize the notification system theme, anyone know how to do that yet?)).>

Another item of information that I love to have visible at all times is the list of my co-workers who are currently online (logged into IM). This helps if I need to ask one of them a quick question.

The solution: Conky

At first conky may scare you, I know it did me. The configuration files have a little bit of a learning curve that may be too steep for some. Conky is mainly used as a “light weight system monitor”. I however don’t need a system monitor (I’ve never really used the information they provide while I am on my desktop computer). System monitors are great for a laptop where I need to worry about what processes might be cramping my speed or draining my battery. I might also use the system monitor to check the temperature of my laptop or the battery level. For my desktop however I don’t need (or want) that stuff. Thankfully conky is so much more than a “light weight system monitor” I can set up scripts to run at any interval I would like and display the output in a nice way in a place where I can (almost) always see it.

Here is my conky configuration file:

background yes
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes

text_buffer_size 1024

use_xft yes
xftfont Inconsolata:size=12
#xftfont Angleterre Book:size=10

alignment top_right
gap_x 20
gap_y 20
maximum_width 400

TEXT

${font Cash Font:bold:size=12}${color #444}TODO:  ${hr 7}

${font}${color gray}${execpi 60 /home/chansen4/conkyTodo.py work}

${font Cash Font:bold:size=12}${color #444}NOTIFICATIONS:  ${hr 7}

${font}${color gray}${execpi 10 /home/chansen4/bin/getLastNotify.py}

${font Cash Font:bold:size=12}${color #444}PEEPS:  ${hr 7}

${execpi 10 conkyPidgin -I co-workers -C C -W U -A A -o -t ~/conkyPidgin.template}

Everything after the “TEXT” is what is displayed (before that are just settings). If you want to change some setting or another you start with the $ (dollar sign) and in {} (curly braces) afterwards specify the property to change and the value to be set.

For example: ${font Cash Font:bold:size=12} sets the font to be the “Cash Font” font, makes it bold and sets the size to 12 point. ${color #444} sets the color to be hex 444. ${hr 7} creates a horizontal rule of 7 pixels thick.

The real interesting part though are the ${execpi commands (the format for these commands is ${execpi [RUN TIME IN SEC] [SCRIPT], not too difficult). This will run an executable script and parse the output at more conky configuration code. There are three such calls in my configuration file. conkyTodo.py (my own script to parse my todo list and display it nicely in conky), getLastNotify.py (once again, my own script to parse the notify-osd.log file to get the last 4 notification messages and display them nicely in conky), and conkyPidgin (which is part of the conky hardcore package and gives one access to the Pidgin contacts).

If any of this is too confusing or you would like some more information/clarification just leave a comment and I will do my best to answer your questions. Thanks!

My current conky theme at work

My current conky theme at work

Update: Here is my getLastNotify.py script.

custom command prompt

Published January 22nd, 2010 by Chad

I spend a lot of time in the terminal and at the command prompt. The default prompt for Ubuntu is very…unhelpful, to say the least. I already know who I am and most of the time I know what machine I am on. So after talking to a friend of mine and doing a little research I have come up with this custom command prompt that suits me just fine.

custom command prompt screenshot

custom command prompt screenshot

The first part is the time that the prompt was given. This idea came from my friend. I like it for things like figuring out just how long that last command took (without having to run it again with the time command) and for simply seeing what time it is (since I am in the terminal a lot).

The next part is the current directory I am working in. I made it a different color to make it stand out a bit more from the rest of the stuff on the screen. So, with a quick glance, I can determine if I am in the right place before running the command.

The last part is the coolest (in my opinion) by far. I found an example of the smiley faces being used and really liked that idea. Once again at a glance I can determine something important. This time, I can determine whether or not the last command was successful. If I see red, I can look back and see what happened. If no red, keep going, everything is just fine. Pretty cool.

Now to the nitty gritty. How exactly do you create a custom prompt like this. After ripping things from a few different places (and doing a lot of my own troubleshooting) I came up with this for my custom command prompt: PS1="[\e[00m][\T] [\e[1;34m]\w `if [ \$? = 0 ]; then echo -e '[\e[01;32m]:)'; else echo -e '[\e[01;31m]:('; fi` [\033[00m]\$[\e[00m] "

Confused? :) I was too. In fact, I am still unsure as to what exactly some of it does. Oh well.

The segments that look like [e[00m] (sometimes with different numbers) are specifying the colors of the different sections. The first part you can see that after the color specification section there is a [\T]. This simply specifies that the current time (\T) needs to be printed between some square brackets ([]).

Next there are some more colors specified followed by \w. This specifies that I want the current working directory displayed. A capital W will display the current working directory without the path.

Then comes the fun stuff. Bash scripting within a string! Basically it says that if the last command was all good, display a smiley face. However, if something went wrong, a frowning face is displayed (in red). The bash scripting is just a simple if-else statement with some echo calls.

The key here is making sure everything is escaped correctly. Add a comment if you have any questions. BTW, here is another good reference for this type of thing.

changing gnome-terminal default window size

Published December 8th, 2009 by Chad

I actually like the default window size for the gnome-terminal in Ubuntu now. But I used to not like it. There was a time when I would run a command, see that the output of the command wasn’t displayed nicely, resize the window manually, and rerun the command. Annoying. If you would like to change the default gnome-terminal window size just follow these steps.

  • Open terminal window.
  • Type: sudo gedit /usr/share/vte/termcap/xterm
  • Find the following line: :co#80:it#8:li#24:\
  • Change to your desired window size (the number after :co is the number of columns and the number after :li is for the number of lines): :co#200:it#8:li#50:\
  • Save and close the file.

Every gnome-terminal you open now with use this new window size as the default. This will only work after you have closed all of the opened gnome-terminal windows first. Enjoy.

custom date and time in panel

Published December 3rd, 2009 by Chad

As you may have noticed by the screenshot from my last post the date and time portion of my panel isn’t the norm. Thanks to one of my new favorite sites OMG Ubuntu (not a fan of the name, but what are you going to do, right?) I was able to easily customize this portion that used to take up so much of my panels real estate.

This post, Some More Gnome Panel Clock Applet Styles, from OMG’s site gives you everything you need to know to make the changes. I will not repeat the steps here.

karmic recap

Published December 3rd, 2009 by Chad

My, my, my how the time flies by. :)

Well its been a while since I first downloaded and installed Ubuntu 9.10 (Karmic Koala) on my work laptop (64 bit). I have to say, it has been fun. I just love it when stuff works. I started off the whole process with a home directory backup. I have a 500 GB external HD that I just copied my whole home directory straight over to. It took quite a bit of time, but then I had everything safely stored in another location so I could completely wipe the HD in the laptop and install a 64 bit OS (previously I was running Ubuntu 9.04 32 bit). The install went fast (from a CD about half an hour) and then I was up and running. The ATI card in the laptop was already supported (no need to install a third party driver to get compiz to work) and within an hour I had everything I needed to get the work I needed to do done. A nice chunk of that hour was spent trying to customize and figure out empathy (the new default IM client for Karmic replacing Pidgin). After that I decided I just needed to install Pidgin for my IM client and everything else went smoothly. I have tried using the new software center a few times now to discover new software that I might like to install. It is great for just that, but don’t try installing anything from it. I don’t know if it is just me it not but it seems to take forever to install anything through that application. I have also done a lot of customizing with the humanity icons in my panel. These are the one color icons that showed up in Karmic. For example my last post shows some of the Pidgin icons I made to look more like the theme. I have since used most of the custom icons posted on OMG Ubuntu.

My work laptop running Ubuntu 9.10

My work laptop running Ubuntu 9.10