You are not logged in.
So I have a very limited area to work with, something like 176x360 (+/- a few pixels), and I want the ability to show an RSS feed. Well, the feed works of course, but due to the limited width, I'm in great need of word wrapping, and for that problem I have found no solution and going on for 2-3 hours straight, my head hurts ![]()
Anyway, here's my .conkyrc, not that it's needed of course.
# ~/.conkyrc
#
double_buffer yes
use_xft yes
xftfont Bitstream Vera Sans Mono:size=8
xftalpha 0.8
update_interval 1.0
total_run_times 0
own_window yes
own_window_type override
own_window_transparent yes
own_window_colour hotpink
own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager
minimum_size 176 360
maximum_size 176 360
maximum_width 176
draw_shades no
draw_outline no
draw_borders no
stippled_borders 0
border_margin 0
border_width 0
default_color green
default_shade_color green
default_outline_color green
alignment bottom_right
gap_x 16
gap_y 16
no_buffers yes
uppercase no
TEXT
$alignc${nodename}
$alignc${sysname} ${kernel}
$hr
CPU:$alignr$cpu% ${cpubar 10,106}
RAM:$alignr$memperc% ${membar 10,106}
HDD:$alignr${fs_used_perc /}% ${fs_bar 10,106 /}
BAT:$alignr${battery_percent}% ${battery_bar 10,106}
$hr
Download: Upload:
eth0 ${downspeed eth0} $alignr${upspeed eth0}
wlan0 ${downspeed wlan0} $alignr${upspeed wlan0}
$hr
${alignc}ARCH NEWS
${rss http://www.archlinux.org/feeds/news/ 1 item_titles 10 }I know this looks confusing and probably is full of critical error, but that simple because I'm a conky noob. I basically just downloaded a profile I liked and completely changed it over the course of a few hours.
Anyway, I'm rambling again, but if you've got any idea's, please do let me know.
Best regards.
Last edited by zacariaz (2012-08-27 17:19:35)
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
I don't use conky, but IIRC you can use and "exec" command or something to run shell scripts right? If so just pipe the rrs through a fold command.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
It's actually kinda funny. Apparently people do not have this problem in general. At least it's hard to fin sound solutions.
Anyway to answer Trilbys suggest, I have considered creating a script or using some sort of external application. The issue however is that I don't know how, but even more important, that things get a bit more complicated as I also have to somehow parse the RSS feed, which again required some sort of application.
Well I suppose regular expressions can do wonder, but it's not really my area of expertise.
Oh, well, I'm probably gonna find a solution sooner or later. Would have been great though, if someone had done the work for me already...
Best regards.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
Okay, so I've found sort of a solution to part of the problem, so what I have so far look like this:
wget -quiet -O - archlinux.org/feeds/news/ | fmt -w 25 -g 25It works as long as there are no words longer than 25 character, which I should think is rare, even including package names and such.
However there's still the issue parsing the xml so I get only what I want:
<item><title>$content</title><link>This may be solved using some sort of terminal rss parser, but I would rather prefer not to.
Then there's the issue with reloading.
My current conky is set to reload every second, but of course one can't just pull the feed every second and I'm not convinced that conky has any built in solution for that problem. Of course I can always start a cronjob and save it all to a file, but portability would be nice.
anyway, I'll return later.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
Doesn't conky's exec command have a parameter for how often the command should be run?
Something like "exec 600 scriptname" would only rerun the script every 60 seconds.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Doesn't conky's exec command have a parameter for how often the command should be run?
Something like "exec 600 scriptname" would only rerun the script every 60 seconds.
Just looked it up and although you're not completely right, you're pretty damn close. ![]()
"execi 600 scriptname" would do the trick.
I don't know how I've missed it. I've looked through those object for hours on end until I was square in the face.
anyway, thanks for making me look it up. That's one problem less.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
xmllint looks like something that may help some the parsing issue, but I'll be damned if I can figure out how. All it does is to give me a headache.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
Kinda eureka:
wget -q -O - archlinux.org/feeds/news/ | xmllint --xpath //item/title - | something has to happen here | fmt -w 25 -g 25I still need to add newline and possible a space or two at the start of each line, all depending on how it looks, and not least to strip the tags.
I'm not quite sure how to do any of those things, so again I'm at your mercy ![]()
edit:
Oh ya, it was also my intention not to grab all the items, only two or three, but but I'll live.
Last edited by zacariaz (2012-08-27 15:31:50)
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
What if you open another instance of Conky (with it's own config file, geometry and position) ? Would text wrapping work then? Personally, I use an alias, from /etc/bash.bashrc (system-wide), but it will work from ~/bashrc too.
alias n='elinks archlinux.org/feeds/news'
alias nn='firefox archlinux.org/news'PS: Don't download the feed every minute... Don't be a dick. You are visiting that page 60 times an hour. You're killing the servers.
Last edited by DSpider (2012-08-27 14:47:08)
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
PS: Don't download the feed every minute... Don't be a dick. You are visiting that page 60 times an hour. You're killing the servers.
I'm not, why would I want to do that? I know it's called news, but I could probably update once a week and still risk there being no changes.
edit:
oh ya, you posed a question too and no, as far as I've found during my investigation, conky doesn't know the meaning of the term "word wrapping".
Last edited by zacariaz (2012-08-27 14:55:24)
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
I suggested the 60 seconds, sorry for the confusion as DSpider is absolutely right. I just picked that number out of thin air as an example of the exec command. For the present purposes a much longer interval would be called for.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I suggested the 60 seconds, sorry for the confusion as DSpider is absolutely right. I just picked that number out of thin air as an example of the exec command. For the present purposes a much longer interval would be called for.
Well, in my original conkyrc it also reload every 60 sec, so don't feel too bad. After all there is a difference between planning, testing and doing. ![]()
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
SED IS KILLING ME!!!
Will someone please enlighten me as to how the <BLEEP!> you exchange "</title><title>" for a newline, or even just how to remove a random tag?
I couldn't figure it out if my life depended on it.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
Holy moly I think maybe I actually did it:
wget -q -O - archlinux.org/feeds/news/ | xmllint --xpath //item/title - | sed 's/<\/title><title>/\n/g' | sed -e 's/<\/\?title>//g' | fmt -s -w 25 -g 25I'm not actually sure this should work (I'm particular worried about sed, which is Greek to me), so if anyone would like to evaluate and maybe test, that'd be great.
Best regards.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
I'll be damned. Even conky accepts this ![]()
All I need to do now is to somehow only show the first 2-3 items.
Shouldn't be too hard right?
edit:
Of course piping the output through HEAD before FMT solves that issue.
Last edited by zacariaz (2012-08-27 17:12:49)
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline
I'd recommend taking a few moments to read up on awk. That would be much better for this job than sed as it could replace both sed commands and the fmt, and could negate the need for 'head'.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I'd recommend taking a few moments to read up on awk. That would be much better for this job than sed as it could replace both sed commands and the fmt, and could negate the need for 'head'.
If I had that information from the start, my head would probably hurt quite a bit less right now, but thanks anyway.
I am a philosopher, of sorts, not a troll or an imbecile.
My apologies that this is not always obvious, despite my best efforts.
Offline