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}")
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|
modClass = Modules.get[modType]
Object.const_get(modClass).new(config, 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)
panelConf["modules"].each do |modName, modType|
modClass = Modules.get[modType]
Object.const_get(modClass).new(panelConf, modName, pipe_w).run
end
config['geometry'] = "%{w}x%{h}+%{gap}+%{gap}" % [
w: config['width'],
h: config['height'],
gap: gap
Signal.trap("INT") do cleanup; end
Signal.trap("TERM") do cleanup; end
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 = [
"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(" "))
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)
IO.popen(lemonbar_cmd, "w+") do |pipe_lb|
pipe_lb.sync = true
DoSystem.new("system", pipe_lb).run
DoSystem.new("system", pipe_lb).run
pipe_r.each do |line|
mod_name, data = line.chomp.split("\0")
data ||= ""
p.modData[mod_name] = data
pipe_lb.printf("%s\n", p.render())
pipe_r.each do |line|
mod_name, data = line.chomp.split("\0")
data ||= ""
p.modData[mod_name] = data
pipe_lb.printf("%s\n", p.render())
end
end
end

View File

@ -1,56 +1,58 @@
# vim: ft=yaml sw=2 et
#geometry: '1262x14+9+9'
height: 14
gap: 9
fontspec: '-*-terminesspowerline-medium-*-normal-*-14-*-*-*-*-*-iso10646-*'
window_name: 'moltenbar'
active_areas: '128'
modules:
pager: bspwm_pager
taskbar: bspwm_taskbar
date: date
la: load_average
memory: memory
www: network
xnt: 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-}"
colours:
fg: '#f9f9f9'
fg_focused: '#f9f9f9'
bg: '#001f1f1f'
bg_focused: '#467EC2'
mon_focused: '#46C252'
ok_colour: "#00FF00"
warn_colour: "#FFFF00"
crit_colour: "#FF0000"
panels:
main:
#geometry: '1262x14+9+9'
height: 14
gap: 9
fontspec: '-*-terminesspowerline-medium-*-normal-*-14-*-*-*-*-*-iso10646-*'
window_name: 'moltenbar'
active_areas: '128'
modules:
pager: bspwm_pager
taskbar: bspwm_taskbar
date: date
la: load_average
memory: memory
www: network
xnt: 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-}"
colours:
fg: '#f9f9f9'
fg_focused: '#f9f9f9'
bg: '#001f1f1f'
bg_focused: '#467EC2'
mon_focused: '#46C252'
ok_colour: "#00FF00"
warn_colour: "#FFFF00"
crit_colour: "#FF0000"
# Module settings
mod:
pager:
show_empty_desktops: false
show_single_monitor: false
#monitors:
# - "main"
blacklist:
-0
-p
date:
format: '%A, %Y.%m.%d %H:%M:%S'
la:
warn_value: 3
crit_value: 4
www:
hosts:
- de-ber-as20647.anchors.atlas.ripe.net
- nl-ams-as1101.anchors.atlas.ripe.net
- ru-mow-as15835.anchors.atlas.ripe.net
warp:
hosts:
- malganis.priv
- spike.priv
- builder.virt
memory:
warn_value: 75
crit_value: 90
# Module settings
mod:
pager:
show_empty_desktops: false
show_single_monitor: false
#monitors:
# - "main"
blacklist:
-0
-p
date:
format: '%A, %Y.%m.%d %H:%M:%S'
la:
warn_value: 3
crit_value: 4
www:
hosts:
- de-ber-as20647.anchors.atlas.ripe.net
- nl-ams-as1101.anchors.atlas.ripe.net
- ru-mow-as15835.anchors.atlas.ripe.net
warp:
hosts:
- malganis.priv
- spike.priv
- builder.virt
memory:
warn_value: 75
crit_value: 90