Linux.com

Canto in Fluxbox

 

How to Canto

Canto is a python RSS reader that sits in a terminal. Screenshot: http://www.sidux.com/module-Mediashare-browse-aid-128-mid-1214.html

It is highly configurable, and fairly easy to use.
I have mine sitting in a pre built xfce-terminal window for ease of use. You can of course, just use a regular terminal and invoke "canto", but it just won't be nearly as fun.

I have canto set to use elinks. . . . Screen: http://www.sidux.com/module-Mediashare-browse-aid-128-mid-1215.html , as it resides in the terminal as well.
The canto conf. and the menu entries I post, place an instance of canto on your desktop, with full transparency, with all links opening in elinks for lightening quick access and easy readability.

To open a link just press "g" for go. Everthing closes with "q" for easy off capability.
If you don't have canto and elinks, copy and paste this into a terminal as root.


apt-get update && apt-get install canto elinks


This may drag in some dependancies as well. Nothing unusual I could see.
After all are installed, open up the canto folder at ~/.canto, and make a new file named 'conf', and place these lines into it.

############ canto config edit copy###############
#### last edited 4-27-09-sleekmason


##### set browser type.
import os

link_handler("elinks \"%u\"", text=True)
#link_handler("iceweasel \"%u\"")

# A dedicated image handler, that requires content
# to be fetched for it.
image_handler("xli \"%u\"", fetch=True)

# A dedicated PDF handler (great for LtU)
link_handler("evince \"%u\"", fetch=True, ext="pdf")

def my_resize_hook(cfg):
cfg.columns = cfg.width / 70

resize_hook = my_resize_hook

reader_keys["."] = ["destroy","next_unread","reader"]
reader_keys[","] = ["destroy","prev_unread","reader"]

# This sets the current item as read and automatically
# continues to the next item.

keys['x'] = ["just_read","next_item"]

# This makes the reader show links by default, rather
# than the default, toggling with 'l'
keys[' '] = ["reader","toggle_show_links"]

# A whole mess of feeds with tags, and without.
# A 'None' tag will be replaced with the feeds title
# The first tag is what is show at the top of each feed by default

add("http://sidux.com/xBackends.php?feedtype=rss2&feedlang=eng")
add("http://www.nvnews.net/vbulletin/external.php?type=RSS2&forumids=14")
#add("http://rss.slashdot.org/slashdot/Slashdot", tags=[None, "news"])
add("http://osnews.com/files/recent.xml", tags=[None, "news"])
add("http://www.damninteresting.com/?feed=rss2")
add("http://reddit.com/.rss", tags=["Reddit","news"])
add("http://programming.reddit.com/.rss", tags=["Proggit", "news"])

# Tags can work without configuration, or can be customized.
# This makes the "news" tag default to showing only unread stories
# and sorting by date.

tags = [ None, ["news"], ["Reddit", "Proggit"]]

#######COLORS#######
colors[0] = ("cyan","default") #background
colors[1] = ("cyan","default") #unread print and bg
colors[2] = ("cyan","default") #read print and bg
colors[3] = ("cyan","default") #links
colors[4] = ("green","default") #quotes
###

This file settings above only affect Canto, and will make it look like this screen: http://www.sidux.com/module-Mediashare-browse-aid-128-mid-1214.html , providing you make a couple of other changes.
I have added a bunch of sites that interest me, including some sidux sites. These are all easily changed, commented out, or deleted.
Terminal Settings for canto

The easy way to set up the terminal is to make a sticky-term out of it. Placing these lines:

[app] (name=xfce4-terminal)
[Position] (UPPERLEFT) {162 4}
[Sticky] {yes}
[Close] {no}
[end]


in ~/.fluxbox/apps, will allow you to make your terminal windows open in the same place every time. This allows for no mistakes in placement of the 'canto', as it is easy to set the disabling of borders and such through the fluxbox menu when we call canto.

Whats neat about this, is that we need not disable borders in the xfce4-terminal preferences dialog, in order to have canto use just that, setting an instance of xfce4-terminal without borders, or menus, etc.

NOTE: my screen is 1440x900. You may want to adjust the dimensions and size of canto. Placement can be changed in the ~/.fluxbox/apps file, and the size can be changed by adjusting the ~/.fluxbox menu entry.

You can always get to a menu in the xfce4-terminal by rightclicking anywhere in the terminal space. You will be rewarded with a bunch of options to mess around with.

Here is the ~/.fluxbox menu entry to open a terminal instance of canto, placed how you see it here. Screen: http://www.sidux.com/module-Mediashare-browse-aid-128-mid-1214.html

[exec] (Canto) {xfce4-terminal --geometry=92X32 --hide-borders --hide-menubar --hide-toolbars -e canto}


I set the borders, size, and hide options for the xfce4-terminal, as well as place canto inside without the '--hold' option, so it closes with the simple press of "q".

Elinks can also be turned off with "q" and then "enter", leaving Canto open, until you decide to quit.

The amount of transparency, as well as fonts used, and 'Elinks' font colors, are chosen by right clicking on any xfce4-terminal, and going to >preferences>appearance, and looking at your options. Also, you may want to disable 'bold' fonts to get a better font view. *remember this as it affects all terminal instances, and may need to be changed if your working on something that requires it.

The 'conf' file provided above came from accumulated data off the internet in an attempt to get a good appearance. Edit as needed, its easy to change and add RSS feeds.
Please post any cool changes or ideas you come up with. I would like to know how to change the 'canto' colors further, as they are a bit limited it seems.
This is turning into a neat little gadget to have around on the desktop. I can see a lot of potential for a nice 'custom' 'canto' if somebody knew what they were doing with the code. There are only a few tuturials online. They are fairly in depth on some things, but not at all on others.

Something neat you could do as well is make this instance only on one fluxbox window, and mouse scroll between the two . . .
To have canto update automatically each time you start the program, use 'canto -u' in your fluxbox menu, like so:

[exec] (Canto) {xfce4-terminal --geometry=92X32 --hide-borders --hide-menubar --hide-toolbars -e "canto -u"}



(note the "s) You can also update canto by running 'canto-fetch', or by adding 'canto-fetch -db' to your startup script (.xinitrc, ~/.fluxbox/startup, etc. . .) For more info look at the Canto site: http://codezen.org/canto/start/

 

Please comment if you are using this  'how -to'.  All suggestions and comments welcome. 

 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFS230 Linux Network Management
    06 Oct » 09 Oct - Virtual
    Details
  2. LFD331 Developing Linux Device Drivers
    13 Oct » 17 Oct - Virtual
    Details
  3. LFS430 Linux Enterprise Automation
    13 Oct » 16 Oct - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board