Conky, Avant, Cheese, and Streamer [Linux FTW]

conky
A while back my friend/co-worker Zak had installed Debian on his Dell M1530 laptop; he had this cool display on his desktop that would tell him various bits of info about his system’s current status. Stuff that’s just useful to know, sort of like checking your pulse or stepping on the scale. This software displays that kind of information every few seconds, in the background, on your desktop.

The software is called “Conky”. It’s pretty customizable, available on the Aptitude repositories, and relatively easy to setup. Below is my .conkyrc (the significance will be explained later).

To get Conky setup, you can use apt-get to install it from a terminal window. (It’s not yet available in my Add/Remove… menu)

apt-get install conky

That’ll handle the main installation. At this point, you can run it manually, at your leisure. You’ll want to setup your .conkyrc, the settings file that actually creates the template used by conky. Here’s mine (this belongs in your home directory: ~/ )

# THIS CONFIG RELIES ON 2 SCRIPTS, CPUSPEED AND CPUTEMP
# YOUR SYSTEM MAY NOT REQUIRE THEM, REPLACE AS DESIRED

# maintain spacing between certain elements
use_spacer right

# set to yes if you want conky to be forked in the background
background no

use_xft yes

# Xft font when Xft is enabled
#xftfont Bitstream Vera Sans Mono-7:size=16
#xftfont Andale Mono-9
#xftfont Clean-8
#xftfont cubicfive10:pixelsize=8
#xftfont squaredance10:pixelsize=14
#xftfont swf!t_v02:pixelsize=10
font-size 16

# Text alpha when using Xft
xftalpha 1

# Update interval in seconds
update_interval 4.0

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 500 5

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline no # amplifies text

# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 0

# border margins
border_margin 9

# border width
border_width 0

# Default colors and also border colors, grey90 == #e5e5e5
default_color grey90
default_shade_color black
default_outline_color DarkGrey

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
gap_x 100
gap_y 100

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# stuff after ‘TEXT’ will be formatted on screen

TEXT
${color #ffcb48}$nodename$color  ${color #828282}$sysname $kernel on $machine$color    ${color #98c2c7}Batt:$color ${battery BAT1}

${color #ffcb48}PROCESSING$color
${color #98c2c7}CPU:$color       $cpu%      ${color #78af78}$cpubar
${color #78af78}${cpugraph 78af78 a3a3a3}

${color #98c2c7}NAME            PID       CPU%      MEM%
${color #e5e5e5}${top name 1}   ${top pid 1}   ${top cpu 1}   ${top mem 1}
${color #c4c4c4}${top name 2}   ${top pid 2}   ${top cpu 2}   ${top mem 2}
${color #a3a3a3}${top name 3}   ${top pid 3}   ${top cpu 3}   ${top mem 3}
${color #828282}${top name 4}   ${top pid 4}   ${top cpu 4}   ${top mem 4}

${color #ffcb48}DATA$color ${color #98c2c7}RAM:$color     $memperc%         ${color #78af78}${membar 6}${color}

${color #98c2c7}NAME             PID       CPU%      MEM%
${color #e5e5e5}${top_mem name 1} ${top_mem pid 1}   ${top_mem cpu 1}    ${top_mem mem 1}
${color #c4c4c4}${top_mem name 2} ${top_mem pid 2}   ${top_mem cpu 2}    ${top_mem mem 2}
${color #a3a3a3}${top_mem name 3} ${top_mem pid 3}   ${top_mem cpu 3}    ${top_mem mem 3}
${color #828282}${top_mem name 4} ${top_mem pid 4}   ${top_mem cpu 4}    ${top_mem mem 4}

${color #98c2c7}Swap:$color    $swapperc%         ${color #78af78}${swapbar 6}$color
${color #98c2c7}/:$color       ${fs_free_perc /}%  $fs_free  ${color #78af78}${fs_bar 6 /}$color

${color #ffcb48}INTARWEBS$color
${if_up wlan0}
Speed ${wireless_bitrate wlan0} ${wireless_link_bar 10 30 wlan0}
${color #98c2c7}Upload:$color ${upspeed wlan0}kb/s ${color #98c2c7}Download:${color} ${downspeed wlan0}kb/s
${endif}
${if_up eth0}
${color #98c2c7}Upload:$color  ${upspeed eth0}kb/s${color #98c2c7} Download:$color  ${downspeed eth0}kb/s
${endif}

It looks kind of intimidating at first, I know. Everything above the “TEXT” line is settings — stuff that defines the “rules of the universe” for Conky. Everything below the TEXT line is the template itself. A ${askldfjasldf} is a Conky variable (full list is available on the conky site). Whitespace is conserved — any spaces you add in between text and variables are reflected in the display on your desktop.

My .conkyrc isn’t perfect — A couple of the things aren’t totally hashed out yet (Wireless / Wired connection statuses aren’t updating correctly, neither is the battery status) but I’ll get them figured out soon. As always, the ubuntu forums have been a goldmine of resources about fixing this stuff.

One last thing: If you want Conky to start up when your system starts up, there are two simple things you can do: (Thanks to Zak for this info!)

  1. Create a shell script in your home directory called “conky.sh”
  2. In it, write:
    #!/bin/sh
    sleep 10 && conky &
  3. Save

Now go to System -> Preferences -> Session, choose “add”, and find that script you just saved. That’s it! You’ll need to log out and log back in again to see it automated, but it’ll do that every time you login.

Avant Window Navigator

This thing is cool.

screenshot-1If you’ve ever seen those fancy Mac dock thingies — this is the same thing. It’s called the “Avant Window Navigator”. I found it last night while looking for something unrelated.

It’s available in Add/Remove…, so you can just search for it there. You’ll need to add it to your Session-starter (System -> Preferences -> Add…, then either locate your executable for AWN, or just type in what is PROBABLY the correct command: /usr/bin/avant-window-navigator  (that’s the default, I think). Next time you startup, it will load automatically. You can add stuff to it simply by dragging the icons onto the dock — the mouse cursor will acquire a “+” and that’s when you know you can drop it.

Very cool!

Cheese

So I wanted to get the webcam on Escherichia working — I had seen “Cheese” mentioned elsewhere. It’s some really basic webcam software — allows for snaps and video to be recorded, along with some simple digital effects.

screenshot-cheese

Me watching "2 Girls, 1 Cup" mashed up with a Rick roll.

It’s cute. It doesn’t refresh super-fast — probably every 250 or 500 milliseconds, but it’s fast enough. The digital effects are kind of neat.

0002

Effect: Psychadelic

Outlines

Effect: Outlines

Lucha Libre

Effect: Lucha Libre

Married

Effect: Married

Installing it is easy, of course.

apt-get install cheese

If only real cheese was that easy to get.

Streamer

So Zak and I were talking about the web cam stuff, and he thought of this cool idea: What if you had your computer set up so that when you boot it up, as soon as the webcam comes online, it snaps a picture, then uploads it to a server somewhere.

He was thinking of this from an anti-theft standpoint. I remember reading about a criminal that was caught because his pic was taken by the laptop’s webcam. It seemed interesting.

Of course, the criminal would have to know your credentials and not just say “Linux? Wtf? I want Windows on that biatch.” He’d probably even use a pirated copy of Windows. I mean, you know, he’s a criminal. Why not.

So even if the anti-theft thing didn’t work, it would still be neat to snap a picture every time you log in, and then make a massive timelapse video of it.

I googled around a bit and  found “streamer”, which will take snaps or videos from the command line.

apt-get install streamer

You’ll probably also want the NetPBM library, which features some software to convert from .ppm format to .jpg (or .png or whatever else, I imagine). Streamer is supposed to be able to do other formats like GIF and JPG, but I kept getting errors with it. No biggie.

apt-get install netpbm

I haven’t gotten all of the kinks worked out with how I plan to use this yet, but here’s teh basic commands for taking a single snapshot and saving it to your desktop as “test.jpg”:

streamer -o ~/Desktop/test.ppm && pnmtojpeg ~/Desktop/test.ppm > ~/Desktop/test.jpg && rm ~/Desktop/test.ppm

I’ll probably just make this into a shell-script. I want to see if I can find some documentation about making animated GIFs manually — it would be handy if the image can append directly onto an animated GIF.

that’s it for now!