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

View File

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