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,56 +152,58 @@ 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'],
gap: gap 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
]
end
lemonbar_cmd = [
"lemonbar",
"-g", panelConf['geometry'],
"-f", panelConf['fontspec'],
"-n", panelConf['window_name'],
"-a", panelConf['active_areas'],
"-F", panelConf['colours']['fg'],
"-B", panelConf['colours']['bg']
] ]
end
lemonbar_cmd = [ printf("Launching lemonbar as:\n %s\n", lemonbar_cmd.join(" "))
"lemonbar",
"-g", config['geometry'],
"-f", config['fontspec'],
"-n", config['window_name'],
"-a", config['active_areas'],
"-F", config['colours']['fg'],
"-B", config['colours']['bg']
]
printf("Launching lemonbar as:\n %s\n", lemonbar_cmd.join(" ")) p = Panel.new(panelConf)
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.sync = true
p = Panel.new(config) DoSystem.new("system", pipe_lb).run
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.sync = true
DoSystem.new("system", pipe_lb).run pipe_r.each do |line|
mod_name, data = line.chomp.split("\0")
pipe_r.each do |line| data ||= ""
mod_name, data = line.chomp.split("\0") p.modData[mod_name] = data
data ||= "" pipe_lb.printf("%s\n", p.render())
p.modData[mod_name] = data end
pipe_lb.printf("%s\n", p.render())
end end
end end

View File

@ -1,56 +1,58 @@
# 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'
pager: bspwm_pager active_areas: '128'
taskbar: bspwm_taskbar modules:
date: date pager: bspwm_pager
la: load_average taskbar: bspwm_taskbar
memory: memory date: date
www: network la: load_average
xnt: network memory: memory
warp: network www: 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-}" xnt: network
colours: warp: network
fg: '#f9f9f9' 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-}"
fg_focused: '#f9f9f9' colours:
bg: '#001f1f1f' fg: '#f9f9f9'
bg_focused: '#467EC2' fg_focused: '#f9f9f9'
mon_focused: '#46C252' bg: '#001f1f1f'
ok_colour: "#00FF00" bg_focused: '#467EC2'
warn_colour: "#FFFF00" mon_focused: '#46C252'
crit_colour: "#FF0000" ok_colour: "#00FF00"
warn_colour: "#FFFF00"
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
#monitors: #monitors:
# - "main" # - "main"
blacklist: blacklist:
-0 -0
-p -p
date: date:
format: '%A, %Y.%m.%d %H:%M:%S' format: '%A, %Y.%m.%d %H:%M:%S'
la: la:
warn_value: 3 warn_value: 3
crit_value: 4 crit_value: 4
www: www:
hosts: hosts:
- de-ber-as20647.anchors.atlas.ripe.net - de-ber-as20647.anchors.atlas.ripe.net
- nl-ams-as1101.anchors.atlas.ripe.net - nl-ams-as1101.anchors.atlas.ripe.net
- ru-mow-as15835.anchors.atlas.ripe.net - ru-mow-as15835.anchors.atlas.ripe.net
warp: warp:
hosts: hosts:
- malganis.priv - malganis.priv
- spike.priv - spike.priv
- builder.virt - builder.virt
memory: memory:
warn_value: 75 warn_value: 75
crit_value: 90 crit_value: 90