class Barabara::App

Attributes

threads[RW]

Public Class Methods

new(config_path) click to toggle source
# File lib/barabara/app.rb, line 8
def initialize(config_path)
  @threads = []
  @config = GlobalConfig.init(config_path)
  bootstrap
end

Public Instance Methods

run() click to toggle source
# File lib/barabara/app.rb, line 14
def run
  fill_threads
  @threads.each(&:join)
end

Private Instance Methods

bootstrap() click to toggle source
# File lib/barabara/app.rb, line 21
def bootstrap
  @modules = @config.modules
  session  = @config.session
  @modules << Modules::WindowName if session == 'bspwm'
end
fill_threads() click to toggle source
# File lib/barabara/app.rb, line 27
def fill_threads
  @threads << Thread.new do
    Thread.current.name = 'Event Parser'
    Wisper.subscribe(Modules::EventProcessor.new, on: :event)
  end

  @threads << Thread.new do
    Thread.current.name = 'Panel Feed'
    Wisper.subscribe(Modules::Lemonbar.new, on: :update_panel)
  end

  @modules.each do |mod|
    @threads << Thread.new do
      Thread.current.name = mod.to_s
      mod.new.watch
    end
  end
end