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,48 +152,49 @@ Dir.new("#{config['mod_dir']}").each_child do |m|
load("#{config['mod_dir']}/#{m}") load("#{config['mod_dir']}/#{m}")
end end
pipe_r, pipe_w = IO.pipe 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] 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
gap = config['gap'].to_i
if config['width'] == nil
y, x = get_x_dims()
config['width'] = y.to_i - (gap * 2)
end end
config['geometry'] = "%{w}x%{h}+%{gap}+%{gap}" % [ Signal.trap("INT") do cleanup; end
w: config['width'], Signal.trap("TERM") do cleanup; end
h: config['height'],
if panelConf['geometry'] == nil
panelConf['gap'] ||= 0
panelConf['height'] ||= 14
gap = panelConf['gap'].to_i
if panelConf['width'] == nil
y, x = get_x_dims()
panelConf['width'] = y.to_i - (gap * 2)
end
panelConf['geometry'] = "%{w}x%{h}+%{gap}+%{gap}" % [
w: panelConf['width'],
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
DoSystem.new("system", pipe_lb).run DoSystem.new("system", pipe_lb).run
@ -204,4 +205,5 @@ IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
p.modData[mod_name] = data p.modData[mod_name] = data
pipe_lb.printf("%s\n", p.render()) pipe_lb.printf("%s\n", p.render())
end end
end
end end

View File

@ -1,12 +1,14 @@
# vim: ft=yaml sw=2 et # vim: ft=yaml sw=2 et
#geometry: '1262x14+9+9' panels:
height: 14 main:
gap: 9 #geometry: '1262x14+9+9'
fontspec: '-*-terminesspowerline-medium-*-normal-*-14-*-*-*-*-*-iso10646-*' height: 14
window_name: 'moltenbar' gap: 9
active_areas: '128' fontspec: '-*-terminesspowerline-medium-*-normal-*-14-*-*-*-*-*-iso10646-*'
modules: window_name: 'moltenbar'
active_areas: '128'
modules:
pager: bspwm_pager pager: bspwm_pager
taskbar: bspwm_taskbar taskbar: bspwm_taskbar
date: date date: date
@ -15,8 +17,8 @@ modules:
www: network www: network
xnt: network xnt: network
warp: network warp: network
format: "@{pager}%{FC{bg}}%{BC{bg_focused}}%{F-} @{taskbar}%{FC{bg_focused}} %{B-} %{r}%{FC{bg_focused}} %{F-}%{BC{bg_focused}} LA: @{la} Mem (used): @{memory} Internet: @{www} Warp: @{warp} XNT: @{xnt} @{date} %{B-}" format: "@{pager}%{FC{bg}}%{BC{bg_focused}}%{F-} @{taskbar}%{FC{bg_focused}} %{B-} %{r}%{FC{bg_focused}} %{F-}%{BC{bg_focused}} LA: @{la} Mem (used): @{memory} Internet: @{www} Warp: @{warp} XNT: @{xnt} @{date} %{B-}"
colours: colours:
fg: '#f9f9f9' fg: '#f9f9f9'
fg_focused: '#f9f9f9' fg_focused: '#f9f9f9'
bg: '#001f1f1f' bg: '#001f1f1f'
@ -26,8 +28,8 @@ colours:
warn_colour: "#FFFF00" warn_colour: "#FFFF00"
crit_colour: "#FF0000" crit_colour: "#FF0000"
# Module settings # Module settings
mod: mod:
pager: pager:
show_empty_desktops: false show_empty_desktops: false
show_single_monitor: false show_single_monitor: false