run commands that lemonbar outputs

This commit is contained in:
Jack L. Frost 2016-09-29 14:12:38 +03:00
parent 699fb758c9
commit 8811476f9f
1 changed files with 16 additions and 5 deletions

View File

@ -48,6 +48,19 @@ class Worker
end
end
class DoSystem < Worker
def initialize(name, pipe)
@name = name
@pipe = pipe
end
def mainloop()
@pipe.each do |cmd|
system(cmd)
end
end
end
class ::String
def erb
return ERB.new(self).result
@ -143,11 +156,9 @@ puts "Launching lemonbar as: " + lemonbar_cmd.join(" ")
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.sync = true
fork do
pipe_lb.each do |line|
system(line)
end
end
sys = DoSystem.new("system", pipe_lb)
workers << sys
sys.run()
pipe_r.each do |line|
mod_name, data = line.chomp.split("\0")