style fix

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2016-10-11 04:54:00 +03:00
parent fd3bca11c5
commit c744364285

View File

@ -37,16 +37,16 @@ class Worker
def kill()
begin
if Process.getpgid(@wpid) == Process.getpgid($$)
puts "Killing pid: #{@wpid}"
printf("Killing pid: %s\n", @wpid)
Process.kill("HUP", @wpid)
end
rescue Errno::ESRCH => err
puts "#{err}: #{@wpid}"
printf("%s: %s\n", err, @wpid)
end
end
def write(data)
@pipe_in.puts @name + "\0" + data
@pipe_in.printf("%s\0%s\n", @name, data)
end
end
@ -70,7 +70,7 @@ module Modules
@modules[name] = class_name
end
def self.get
def self.get()
return @modules
end
end
@ -97,7 +97,7 @@ def cleanup(workers)
exit(0)
end
def get_x_dims
def get_x_dims()
return `xrandr`.scan(/current (\d+) x (\d+)/).flatten
end
@ -115,6 +115,11 @@ OptionParser.new do |opts|
opts.on("-cCONFIG_PATH", "--config=CONFIG_PATH", "Specify and alternative config location") do |v|
options[:config_file] = v
end
opts.on("-h", "--help", "Show this message") do
printf("%s", opts)
exit(0)
end
end.parse!
if ENV["XDG_CONFIG_HOME"] == nil
@ -156,7 +161,7 @@ if config['geometry'] == nil
config['width'] = y.to_i - (gap * 2)
end
config['geometry'] = "#{config['width']}x#{config['height']}+#{gap}+#{gap}"
config['geometry'] = sprintf("%sx%s+%s+%s", config['width'], config['height'], gap, gap)
end
lemonbar_cmd = [
@ -169,7 +174,7 @@ lemonbar_cmd = [
"-B", config['colours']['bg']
]
puts "Launching lemonbar as: " + lemonbar_cmd.join(" ")
printf("Launching lemonbar as:\n %s\n", lemonbar_cmd.join(" "))
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.sync = true
@ -183,6 +188,6 @@ IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
panel_data[mod_name] = data
t = Template.new(config['format'])
pipe_lb.puts t.render(config, panel_data)
pipe_lb.printf("%s\n", t.render(config, panel_data))
end
end