You are not logged in.

#1 2009-06-18 16:10:34

Izobalax
Member
From: UK
Registered: 2008-06-27
Posts: 51
Website

One line, one bar conky...

Can anyone help me? Have a look at this screen:

7689638-71f.png

The bottom bar of the three is conky. I want it to show the time, gmail status and rhythmbox status all in one line across the screen, but it keeps trying to seperate it into lines.

Here's my .conkyrc:

# conky configuration
# edited by kaivalagi

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

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Terminus:size=9

# Text alpha when using Xft
xftalpha 0.8

# Update interval in seconds
update_interval 1.0

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window no

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

# Minimum size of text area
minimum_size 1680 0

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no
draw_graph_borders yes

# Stippled borders?
stippled_borders 0

# border margins
border_margin 0

# border width
border_width 0

# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color white

# own window options
own_window        yes
own_window_transparent    no
own_window_type        widget
own_window_hints    undecorated,below,sticky,skip_taskbar,skip_pager

# 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
# same thing as passing -x at command line
gap_x 0
gap_y 80

# Subtract file system buffers from used memory?
no_buffers yes

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

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale no

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer no

# colours
color1 white
# light blue
color2 6892C6
# orange
color3 E77320
# green
color4 78BF39
# red
color5 CC0000

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen

TEXT
${font Droid Sans:size=8}${color1}${execpi 300 python ~/.scripts/gmail_parser.py <edited email and password> 3}{font Droid Sans:size=8}${color1}${time %H}:${time %M}${time %A}${color1}${font Droid Sans:size=10}${exec conkyRhythmbox --datatype=TI}${color1}${font Droid Sans:size=8} // ${color1}${font Droid Sans:size=8}${exec conkyRhythmbox --datatype=AR}${color1}${font Droid Sans:size=8} // ${color1}${font Droid Sans:Italic:size=8}${exec conkyRhythmbox --datatype=AL}${color1}${font Droid Sans:size=8} // ${color1}${font Droid Sans:size=7 com}${exec conkyRhythmbox --datatype=PT}/${exec conkyRhythmbox --datatype=LE}

What am I doing wrong, O' Wise Ones?

/izo\

Last edited by Izobalax (2009-06-18 20:14:31)


"Eliciting positive quotes about Apple products is a bit like asking children for their view on Christmas; whatever you hear is going to be predictable and pretty much devoid of insight." -- Bill Ray

Offline

#2 2009-06-18 16:17:11

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: One line, one bar conky...

You are missing a $ before the second font definition.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#3 2009-06-18 16:47:29

Izobalax
Member
From: UK
Registered: 2008-06-27
Posts: 51
Website

Re: One line, one bar conky...

rson451 wrote:

You are missing a $ before the second font definition.

Corrected, but after the email checker it still skips a line.

EDIT: for now, I've placed the email variable on the end and it now all flows in one line. For some reason the gmail checker forces a new line. Any ideas?

/izo\


"Eliciting positive quotes about Apple products is a bit like asking children for their view on Christmas; whatever you hear is going to be predictable and pretty much devoid of insight." -- Bill Ray

Offline

#4 2009-06-18 17:24:30

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: One line, one bar conky...

Izobalax wrote:

For some reason the gmail checker forces a new line. Any ideas?

i think we'd have to see gmailparser.py to help on that.

Offline

#5 2009-06-18 17:52:55

Izobalax
Member
From: UK
Registered: 2008-06-27
Posts: 51
Website

Re: One line, one bar conky...

brisbin33 wrote:
Izobalax wrote:

For some reason the gmail checker forces a new line. Any ideas?

i think we'd have to see gmailparser.py to help on that.

## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky

# ======================================================================
# Copyright (C) 2006 Baishampayan Ghose <b.ghose@ubuntu.com>
# Modified 2008 Hunter Loftis <hbloftis@uncc.edu>
# Time-stamp: Mon Jul 31, 2006 20:45+0530
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
# ======================================================================

import sys
import urllib             # For BasicHTTPAuthentication
import feedparser         # For parsing the feed
from textwrap import wrap

_URL = "https://mail.google.com/gmail/feed/atom"

uname = sys.argv[1]
password = sys.argv[2]
maxlen = sys.argv[3]

urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password)
    
def auth():
    '''The method to do HTTPBasicAuthentication'''
    opener = urllib.FancyURLopener()
    f = opener.open(_URL)
    feed = f.read()
    return feed


def readmail(feed, maxlen):
    '''Parse the Atom feed and print a summary'''
    atom = feedparser.parse(feed)
    print '${color1} %s new email(s)\n' % (len(atom.entries))
#    for i in range(min(len(atom.entries), maxlen)):
#        print '          ${color2}%s' % atom.entries[i].title
#uncomment the following line if you want to show the name of the sender
#        print '          ${color2}%s' % atom.entries[i].author
#    if len(atom.entries) > maxlen:
#        print ' ${color}more...'

if __name__ == "__main__":
    f = auth()  # Do auth and then get the feed
    readmail(f, int(maxlen)) # Let the feed be chewed by feedparser

/izo\


"Eliciting positive quotes about Apple products is a bit like asking children for their view on Christmas; whatever you hear is going to be predictable and pretty much devoid of insight." -- Bill Ray

Offline

#6 2009-06-18 18:01:14

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: One line, one bar conky...

Try piping gmailparser.py through this:

tr -d '\n'

And also, you may want to remove your password from your post and go change the password on all your accounts that use it (plus any passwords that may be found in any of your emails).

Last edited by fflarex (2009-06-18 18:12:09)

Offline

#7 2009-06-18 20:15:31

Izobalax
Member
From: UK
Registered: 2008-06-27
Posts: 51
Website

Re: One line, one bar conky...

fflarex wrote:

Try piping gmailparser.py through this:

tr -d '\n'

What does this mean and how do I do it?

fflarex wrote:

And also, you may want to remove your password from your post and go change the password on all your accounts that use it (plus any passwords that may be found in any of your emails).

Heh, well noted. Original post changed.

/izo\


"Eliciting positive quotes about Apple products is a bit like asking children for their view on Christmas; whatever you hear is going to be predictable and pretty much devoid of insight." -- Bill Ray

Offline

#8 2009-06-18 20:31:15

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: One line, one bar conky...

Change

${execpi 300 python ~/.scripts/gmail_parser.py <edited email and password> 3}

to

${execpi 300 python ~/.scripts/gmail_parser.py <edited email and password> 3 | tr -d '\n'}

The tr command does simple transformations on strings. The -d option tells it to delete the characters from the specified set, in this case '\n'. So this will hopefully delete any newline characters that gmail_parser.py is adding. Check the man page for more information.

Offline

#9 2009-06-18 20:41:20

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: One line, one bar conky...

Python's "print" adds a newline character to each line so you need to either pipe the output through "tr" to remove it as suggested above or use "sys.stdout.write" instead of "print".


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#10 2009-06-18 21:32:13

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: One line, one bar conky...

Xyne wrote:

Python's "print" adds a newline character to each line so you need to either pipe the output through "tr" to remove it as suggested above or use "sys.stdout.write" instead of "print".

Or use print and add a comma after the print.

print "blah",

archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#11 2009-06-18 21:57:23

Izobalax
Member
From: UK
Registered: 2008-06-27
Posts: 51
Website

Re: One line, one bar conky...

@fflarex: that did the trick! Thank you!

And thanks everyone for your suggestions!

/izo\


"Eliciting positive quotes about Apple products is a bit like asking children for their view on Christmas; whatever you hear is going to be predictable and pretty much devoid of insight." -- Bill Ray

Offline

#12 2009-06-19 15:06:31

hoellp
Member
Registered: 2009-06-16
Posts: 4

Re: One line, one bar conky...

I'm not a coder myself, but isn't the \n the problem?

def readmail(feed, maxlen):
    '''Parse the Atom feed and print a summary'''
    atom = feedparser.parse(feed)
    print '${color1} %s new email(s)\n' % (len(atom.entries))

Offline

Board footer

Powered by FluxBB