Tag Archives: Twitter

Conky setup with custom gauges, twitter and wlan status.

This is a follow-up of previous posts about conky and a summary.
Full source of the conky setup can be downloaded from here.

The full twitter script can be found in the previous post and along other important files in the archive.

The directory structure I am using is the following:

~/conky
     |- left
     |- right
     |- /scripts
         |- twit.py
         |- conky_lunatico.lua

It’s a simple structure using two conky instances for both sides of the screen with separate configuration files.
The most important bits of the left part are the following:

...
maximum_width 270
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment top_left
...
 
//to set up the window properly and
...
${color1}${execi 60 python ~/conky/scripts/twit.py | fold -w45}
...

to include the twitter script.

Configuration of the right side has the following key items:

...
minimum_size 180 500
maximum_width 180
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tr
...
 
//as previously - setting up the window on the top-right side of the screen and
 
...
lua_load ~/conky/scripts/conky_lunatico.lua
lua_draw_hook_post main
...

To display the nice looking graphs.

And that’s pretty much of it!
For the graph position you will have to edit conky_lunatico.lua script to change values or change the data you are trying to display (I’m showing 7 separate graphs for each value, probably you will want to remove second WLAN graph from the script and config or change the name of your wireless adapter, it’s up to you.

To see it in action simply run conky -c ~/conky/right && conky -c ~/conky/left. For the how-to run this no your system startup and the last post of the overall desktop setup please take a look at the next post explaining Compiz and terminal setup.

Compiling conky with xmms2, lua and basic features support.

This is a second post about configuring my conky setup, yesterday I have posted a script displaying latest tweets from your Twitter account, today I will continue this topic today.

This machine is running Ubuntu 11.10 with Gnome classic desktop, compiz enabled and cairo dock installed.

In next posts I will describe how to create a setup like this:

For this setup I decided I will need the following features:

  • xmms2
  • wlan
  • lua with cairo

These features will be useful in later stages:

  • curl
  • RSS
  • weather

In my case I had few packages missing which were cairo-dock-dev, libiw-dev, libiw-dev and libtolua++5.1-dev.

After making sure you have all the libraries to compile conky you can download conky source, untar it into a temporary directory and run the following command:

./configure --prefix=/opt/conky --enable-xmms2 --disable-mpd --enable-nvidia --enable-weather-metar --enable-curl --enable-rss --enable-wlan --enable-lua --enable-lua-cairo --enable-lua-imlib2

A list of all features you can enable during compilation you can find issuing ./configure –help.

In case of any errors you should download missing package which name you will find in the error message.

When everything goes right you will see the following output:

 * X11:
  X11 support:      yes
  XDamage support:  yes
  XDBE support:     yes
  Xft support:      yes
  ARGB support      yes
 
 * Music detection:
  Audacious:        no
  BMPx:             no
  MPD:              no
  MOC:              yes
  XMMS2:            yes
 
 * General:
  math:             yes
  hddtemp:          yes
  portmon:          yes
  RSS:              yes
  Curl:             yes
  Weather
    METAR:          yes
    XOAP:           no
  wireless:         yes
  IBM:              no
  nvidia:           yes
  eve-online:       no
  config-output:    yes
  Imlib2:           yes
  ALSA mixer:       no
  apcupsd:          yes
  I/O stats:        yes
  ncurses:          yes
 
 * Lua (yes) bindings:
  Cairo:            yes
  Imlib2:           yes

This means you are almost done. Now do sudo make && sudo make install to install conky and try it typing conky in terminal.

In the next posts I will focus on conky scripts I used and how to embed gnome terminal in your desktop, stay tuned!

Latest tweets in your conky setup.

After getting a clean Ubuntu installation I decided to make few tweaks including a custom conky script which included a Twitter feed.

I made a quick research I found out the easiest solution using RSS feed is outdated so I have had to find the other way – and I did here.
As you can read there the only requirement is python-twitter package (and ofcourse python itself).

I have updated the code as it went obsolete when Twitter staff decided to complicate their API even more.

To make this script work you need a few of things:

1. Twitter account (duh)

2. Create Twitter application

3. Receive access tokens

After you will receive all required tokens you have to put them in marked place in the code below.

'''
Original author: Travis Moore (@travist120) from http://travist120.wordpress.com/
Updated by: Peter Kasperski (peter@kasperskiweb.pl) from http://kasperskiweb.pl
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see 
 
'''
import os
import string
import twitter
 
#set your API access details here.
consumer_key='CONSUMER KEY'
consumer_secret='CONSUMER SECRET'
access_token = 'ACCESS TOKEN'
access_token_secret = 'ACCESS TOKEN SECRET'
 
#how many tweets you want displayed at a time
twitterSize = 9;
 
#do not edit beyond this line.
api = twitter.Api(consumer_key, consumer_secret, access_token, access_token_secret)
status = api.GetFriendsTimeline()
i = 0
for s in status:
	i = i+1
	print s.user.name.encode("utf-8"), "(@"+s.user.screen_name.encode("utf-8")+"):"
 
	print s.text.encode("utf-8")
	print
	if i == twitterSize:
		break

The easy way to include it in your conky script is the following:

${execi 60 python ~/conky/scripts/twit.py | fold -w45}

If you will get any error try to run the script alone and make sure you have all required python libraries installed.