run commands that lemonbar outputs
This commit is contained in:
parent
699fb758c9
commit
8811476f9f
21
moltenbar
21
moltenbar
|
@ -48,6 +48,19 @@ class Worker
|
||||||
end
|
end
|
||||||
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
|
class ::String
|
||||||
def erb
|
def erb
|
||||||
return ERB.new(self).result
|
return ERB.new(self).result
|
||||||
|
@ -143,11 +156,9 @@ puts "Launching lemonbar as: " + lemonbar_cmd.join(" ")
|
||||||
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
|
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
|
||||||
pipe_lb.sync = true
|
pipe_lb.sync = true
|
||||||
|
|
||||||
fork do
|
sys = DoSystem.new("system", pipe_lb)
|
||||||
pipe_lb.each do |line|
|
workers << sys
|
||||||
system(line)
|
sys.run()
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
pipe_r.each do |line|
|
pipe_r.each do |line|
|
||||||
mod_name, data = line.chomp.split("\0")
|
mod_name, data = line.chomp.split("\0")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user