from canto.extra import *
import os

# Handlers when in Linux console or xterm
if os.getenv("TERM") == "linux":
    link_handler("elinks \"%u\"", text=True)
    image_handler("fbi \"%u\"", text=True, fetch=True)
else:
    link_handler("firefox \"%u\"")
    image_handler("feh \"%u\"", fetch=True)

# Max column width of 65 characters
def resize_hook (cfg):
    cfg.columns = cfg.width / 65

# Never discard items I haven't seen
never_discard("unread")

# I prefer change_tag to interval
# Uncomment these to use it too

# triggers.remove("interval")
# triggers.append("change_tag")

keys['/'] = search_filter
keys['y'] = yank

# Use [ / ] to switch between global filters
filters=[show_unread, None]

# Make unread items float to the top, when not
# using show_unread filter
default_tag_sorts([by_unread])

# Selected Feeds
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", "reddits", "news"])
add("http://programming.reddit.com/.rss", tags=[None, "reddits"])
add("http://netsec.reddit.com/.rss", tags=[None, "reddits"])
#...

# Some examples
# Uncomment if you've downloaded the script
# add("script:slashdotpolls -external")
#
# Simple password example
# add("http://feedparser.org/docs/examples/digest_auth.xml", username="test",
#        password="digest")


