better module loading

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2019-05-15 15:34:29 +03:00
parent 6c714c12df
commit 019fb2b293
2 changed files with 28 additions and 16 deletions

View File

@ -147,14 +147,16 @@ config = YAML.load_file(options[:config_file])
config['mod_dir'] ||= conf_dir + "/mod" config['mod_dir'] ||= conf_dir + "/mod"
for m in config['modules'] do Dir.new("#{config['mod_dir']}").each_child do |m|
printf("Loading module: #{m}\n")
load("#{config['mod_dir']}/#{m}") load("#{config['mod_dir']}/#{m}")
end end
pipe_r, pipe_w = IO.pipe pipe_r, pipe_w = IO.pipe
Modules.get.each do |k, v| config["modules"].each do |modName, modType|
Object.const_get(v).new(config, k, pipe_w).run modClass = Modules.get[modType]
Object.const_get(modClass).new(config, modName, pipe_w).run
end end
Signal.trap("INT") do cleanup; end Signal.trap("INT") do cleanup; end

View File

@ -7,13 +7,15 @@ fontspec: '-*-terminesspowerline-medium-*-normal-*-14-*-*-*-*-*-iso10646-*'
window_name: 'moltenbar' window_name: 'moltenbar'
active_areas: '128' active_areas: '128'
modules: modules:
- bspwm_pager pager: bspwm_pager
- date taskbar: bspwm_taskbar
- bspwm_taskbar date: date
- load_average la: load_average
- network memory: memory
- memory www: network
format: "@{bspwm_pager}@{bspwm_taskbar}%{r}%{F#467EC2} %{F-}%{B#467EC2} LA: @{load_average} Mem (used): @{memory} Internet: @{network} Warp: @{warp} XNT: @{xnt} @{date} %{B-}" xnt: network
warp: network
format: "@{pager}@{taskbar}%{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'
@ -23,7 +25,7 @@ colours:
# Module settings # Module settings
mod: mod:
bspwm_pager: pager:
colour_focused: '#f9f9f9' colour_focused: '#f9f9f9'
show_empty_desktops: false show_empty_desktops: false
show_single_monitor: false show_single_monitor: false
@ -32,18 +34,18 @@ mod:
blacklist: blacklist:
-0 -0
-p -p
bspwm_taskbar: taskbar:
begin: "%{F#001f1f1f}%{B#467EC2}%{F-} " begin: "%{F#001f1f1f}%{BC{bg_focused}}%{F-} "
end: "%{F#467EC2} %{B-} " end: "%{FC{bg_focused}} %{B-} "
date: date:
format: '%A, %Y.%m.%d %H:%M:%S' format: '%A, %Y.%m.%d %H:%M:%S'
load_average: la:
warn_value: 3 warn_value: 3
crit_value: 4 crit_value: 4
ok_colour: "#00FF00" ok_colour: "#00FF00"
warn_colour: "#FFFF00" warn_colour: "#FFFF00"
crit_colour: "#FF0000" crit_colour: "#FF0000"
network: 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
@ -59,6 +61,14 @@ mod:
ok_colour: "#00FF00" ok_colour: "#00FF00"
warn_colour: "#FFFF00" warn_colour: "#FFFF00"
crit_colour: "#FF0000" crit_colour: "#FF0000"
xnt:
hosts:
- emerald.zorg.sh
- brilliant.zorg.sh
- ui-server17.prod.zorg.sh
ok_colour: "#00FF00"
warn_colour: "#FFFF00"
crit_colour: "#FF0000"
newmail: newmail:
ok_message: "*" ok_message: "*"
ok_colour: "#00FF00" ok_colour: "#00FF00"