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"
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}")
end
pipe_r, pipe_w = IO.pipe
Modules.get.each do |k, v|
Object.const_get(v).new(config, k, pipe_w).run
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

View File

@ -7,13 +7,15 @@ fontspec: '-*-terminesspowerline-medium-*-normal-*-14-*-*-*-*-*-iso10646-*'
window_name: 'moltenbar'
active_areas: '128'
modules:
- bspwm_pager
- date
- bspwm_taskbar
- load_average
- network
- memory
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-}"
pager: bspwm_pager
taskbar: bspwm_taskbar
date: date
la: load_average
memory: memory
www: network
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:
fg: '#f9f9f9'
fg_focused: '#f9f9f9'
@ -23,7 +25,7 @@ colours:
# Module settings
mod:
bspwm_pager:
pager:
colour_focused: '#f9f9f9'
show_empty_desktops: false
show_single_monitor: false
@ -32,18 +34,18 @@ mod:
blacklist:
-0
-p
bspwm_taskbar:
begin: "%{F#001f1f1f}%{B#467EC2}%{F-} "
end: "%{F#467EC2} %{B-} "
taskbar:
begin: "%{F#001f1f1f}%{BC{bg_focused}}%{F-} "
end: "%{FC{bg_focused}} %{B-} "
date:
format: '%A, %Y.%m.%d %H:%M:%S'
load_average:
la:
warn_value: 3
crit_value: 4
ok_colour: "#00FF00"
warn_colour: "#FFFF00"
crit_colour: "#FF0000"
network:
www:
hosts:
- de-ber-as20647.anchors.atlas.ripe.net
- nl-ams-as1101.anchors.atlas.ripe.net
@ -59,6 +61,14 @@ mod:
ok_colour: "#00FF00"
warn_colour: "#FFFF00"
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:
ok_message: "*"
ok_colour: "#00FF00"