style fix
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
fd3bca11c5
commit
c744364285
21
moltenbar
21
moltenbar
|
@ -37,16 +37,16 @@ class Worker
|
||||||
def kill()
|
def kill()
|
||||||
begin
|
begin
|
||||||
if Process.getpgid(@wpid) == Process.getpgid($$)
|
if Process.getpgid(@wpid) == Process.getpgid($$)
|
||||||
puts "Killing pid: #{@wpid}"
|
printf("Killing pid: %s\n", @wpid)
|
||||||
Process.kill("HUP", @wpid)
|
Process.kill("HUP", @wpid)
|
||||||
end
|
end
|
||||||
rescue Errno::ESRCH => err
|
rescue Errno::ESRCH => err
|
||||||
puts "#{err}: #{@wpid}"
|
printf("%s: %s\n", err, @wpid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def write(data)
|
def write(data)
|
||||||
@pipe_in.puts @name + "\0" + data
|
@pipe_in.printf("%s\0%s\n", @name, data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ module Modules
|
||||||
@modules[name] = class_name
|
@modules[name] = class_name
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get
|
def self.get()
|
||||||
return @modules
|
return @modules
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -97,7 +97,7 @@ def cleanup(workers)
|
||||||
exit(0)
|
exit(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_x_dims
|
def get_x_dims()
|
||||||
return `xrandr`.scan(/current (\d+) x (\d+)/).flatten
|
return `xrandr`.scan(/current (\d+) x (\d+)/).flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -115,6 +115,11 @@ OptionParser.new do |opts|
|
||||||
opts.on("-cCONFIG_PATH", "--config=CONFIG_PATH", "Specify and alternative config location") do |v|
|
opts.on("-cCONFIG_PATH", "--config=CONFIG_PATH", "Specify and alternative config location") do |v|
|
||||||
options[:config_file] = v
|
options[:config_file] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on("-h", "--help", "Show this message") do
|
||||||
|
printf("%s", opts)
|
||||||
|
exit(0)
|
||||||
|
end
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
if ENV["XDG_CONFIG_HOME"] == nil
|
if ENV["XDG_CONFIG_HOME"] == nil
|
||||||
|
@ -156,7 +161,7 @@ if config['geometry'] == nil
|
||||||
config['width'] = y.to_i - (gap * 2)
|
config['width'] = y.to_i - (gap * 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
config['geometry'] = "#{config['width']}x#{config['height']}+#{gap}+#{gap}"
|
config['geometry'] = sprintf("%sx%s+%s+%s", config['width'], config['height'], gap, gap)
|
||||||
end
|
end
|
||||||
|
|
||||||
lemonbar_cmd = [
|
lemonbar_cmd = [
|
||||||
|
@ -169,7 +174,7 @@ lemonbar_cmd = [
|
||||||
"-B", config['colours']['bg']
|
"-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|
|
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
|
||||||
pipe_lb.sync = true
|
pipe_lb.sync = true
|
||||||
|
@ -183,6 +188,6 @@ IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
|
||||||
panel_data[mod_name] = data
|
panel_data[mod_name] = data
|
||||||
|
|
||||||
t = Template.new(config['format'])
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user