Project

General

Profile

Launching programs from a sublet

Added by sfds DFDS over 7 years ago

Hi all,

I've been fiddling around writing a sublet to display an rss feed. Its a bit rubbish but I've committed it anyway. One issue is I can't work out how to spawn a browser on a click. Here's the code so far

on :mouse_down do |s, x, y, button|
Subtlext:Subtle.spawn "xxxterm %s" % [rss.items0.link ]
case Time.now.strftime("%S").to_i
when 0..9 then Subtlext::Subtle.spawn("surf %s") % [rss.items0.link ]
when 10..19 then Subtlext::Subtle.spawn("surf %s") % [rss.items1.link ]
when 20..29 then Subtlext::Subtle.spawn("surf %s") % [rss.items2.link ]
when 30..39 then Subtlext::Subtle.spawn("surf %s") % [rss.items3.link ]
when 40..49 then Subtlext::Subtle.spawn("surf %s") % [rss.items4.link ]
when 50..59 then Subtlext::Subtle.spawn("surf %s") % [rss.items5.link ]
end
end

Doesn't work, gives me

ERROR: undefined method `items' for nil:NilClass

(eval):17:in `block (2 levels) in run'
/usr/lib/ruby/site_ruby/1.9.1/subtle/sur/test.rb:526:in `block in run'
/usr/lib/ruby/site_ruby/1.9.1/subtle/sur/test.rb:411:in `each'
/usr/lib/ruby/site_ruby/1.9.1/subtle/sur/test.rb:411:in `run'
/usr/lib/ruby/site_ruby/1.9.1/subtle/sur/runner.rb:154:in `run'
/usr/bin/sur:20:in `<main>'

puts doesn't work either, causes a race condition or something that crashes the wm. Does anyone have any ideas?

Cheers


Replies (1)

RE: Launching programs from a sublet - Added by Christoph Kappel over 7 years ago

Well, I don't know where you define rss so I cannot say anything here.

    (1-1/1)