yay separate panels

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2019-05-15 16:35:06 +03:00
parent 9c9846a970
commit d3e4787481
2 changed files with 100 additions and 96 deletions

View File

@ -152,47 +152,48 @@ Dir.new("#{config['mod_dir']}").each_child do |m|
load("#{config['mod_dir']}/#{m}")
end
config["panels"].each do |panelName, panelConf|
pipe_r, pipe_w = IO.pipe
config["modules"].each do |modName, modType|
panelConf["modules"].each do |modName, modType|
modClass = Modules.get[modType]
Object.const_get(modClass).new(config, modName, pipe_w).run
Object.const_get(modClass).new(panelConf, modName, pipe_w).run
end
Signal.trap("INT") do cleanup; end
Signal.trap("TERM") do cleanup; end
if config['geometry'] == nil
config['gap'] ||= 0
config['height'] ||= 14
if panelConf['geometry'] == nil
panelConf['gap'] ||= 0
panelConf['height'] ||= 14
gap = config['gap'].to_i
gap = panelConf['gap'].to_i
if config['width'] == nil
if panelConf['width'] == nil
y, x = get_x_dims()
config['width'] = y.to_i - (gap * 2)
panelConf['width'] = y.to_i - (gap * 2)
end
config['geometry'] = "%{w}x%{h}+%{gap}+%{gap}" % [
w: config['width'],
h: config['height'],
panelConf['geometry'] = "%{w}x%{h}+%{gap}+%{gap}" % [
w: panelConf['width'],
h: panelConf['height'],
gap: gap
]
end
lemonbar_cmd = [
"lemonbar",
"-g", config['geometry'],
"-f", config['fontspec'],
"-n", config['window_name'],
"-a", config['active_areas'],
"-F", config['colours']['fg'],
"-B", config['colours']['bg']
"-g", panelConf['geometry'],
"-f", panelConf['fontspec'],
"-n", panelConf['window_name'],
"-a", panelConf['active_areas'],
"-F", panelConf['colours']['fg'],
"-B", panelConf['colours']['bg']
]
printf("Launching lemonbar as:\n %s\n", lemonbar_cmd.join(" "))
p = Panel.new(config)
p = Panel.new(panelConf)
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.sync = true
@ -205,3 +206,4 @@ IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.printf("%s\n", p.render())
end
end
end

View File

@ -1,5 +1,7 @@
# vim: ft=yaml sw=2 et
panels:
main:
#geometry: '1262x14+9+9'
height: 14
gap: 9