my_config

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2016-10-04 15:34:25 +03:00
parent 5fd9489f14
commit fd3bca11c5
6 changed files with 17 additions and 15 deletions

View File

@ -8,7 +8,7 @@ class BspwmPager < Worker
pipe.each do |line|
monitor = line.split(":")[0]
if @config['mod']['bspwm_pager'].has_key?("monitors") == false || @config['mod']['bspwm_pager']['monitors'].include?(monitor)
if @my_config.has_key?("monitors") == false || @my_config['monitors'].include?(monitor)
self.write parse_data(line)
end
end
@ -22,8 +22,8 @@ class BspwmPager < Worker
string.split(":").each do |part|
n = part[1..-1]
if @config['mod']['bspwm_pager']['blacklist'] != nil
if @config['mod']['bspwm_pager']['blacklist'].include? n
if @my_config['blacklist'] != nil
if @my_config['blacklist'].include? n
next
end
end
@ -36,7 +36,7 @@ class BspwmPager < Worker
when /^o.+/
out << "%{A:bspc desktop -f #{n}:} #{n} %{A}"
when /^f.+/
if @config['mod']['bspwm_pager']['show_empty_desktops']
if @my_config['show_empty_desktops']
out << " #{n} "
end
when /^L.+/

View File

@ -9,7 +9,7 @@ class BspwmTaskbar < Worker
if line == "\n"
self.write ""
else
tmpl = Template.new(@config['mod']['bspwm_taskbar']['begin'] + line.chomp + @config['mod']['bspwm_taskbar']['end'])
tmpl = Template.new(@my_config['begin'] + line.chomp + @my_config['end'])
self.write tmpl.render(@config, nil)
end
end

View File

@ -3,7 +3,7 @@
class ModDate < Worker
def mainloop()
while true do
self.write Time.now.strftime(@config['mod']['date']['format'])
self.write Time.now.strftime(@my_config['format'])
sleep(1)
end
end

View File

@ -6,12 +6,12 @@ class LoadAverage < Worker
file = File.open("/proc/loadavg", "r")
la_m = file.gets.split[0]
if la_m.to_i > @config['mod']['load_average']['crit_value']
fg_colour = @config['mod']['load_average']['crit_colour']
elsif la_m.to_i > @config['mod']['load_average']['warn_value']
fg_colour = @config['mod']['load_average']['warn_colour']
if la_m.to_i > @my_config['crit_value']
fg_colour = @my_config['crit_colour']
elsif la_m.to_i > @my_config['warn_value']
fg_colour = @my_config['warn_colour']
else
fg_colour = @config['mod']['load_average']['ok_colour']
fg_colour = @my_config['ok_colour']
end
self.write "%{F#{fg_colour}}#{la_m}%{F-}"

View File

@ -13,7 +13,7 @@ class Network < Worker
end
def network_status
hosts = @config['mod']['network']['hosts']
hosts = @my_config['hosts']
net_fail = 0
hosts.each do |h|
@ -25,13 +25,13 @@ class Network < Worker
if net_fail == 0
status = "ok"
fg_colour = @config['mod']['network']['ok_colour']
fg_colour = @my_config['ok_colour']
elsif net_fail == hosts.length
status = "CRIT: all hosts failed!"
fg_colour = @config['mod']['network']['crit_colour']
fg_colour = @my_config['crit_colour']
else
status = "WARN: #{net_fail} host(s) failed"
fg_colour = @config['mod']['network']['warn_colour']
fg_colour = @my_config['warn_colour']
end
return "%{F#{fg_colour}}#{status}%{F-}"

View File

@ -8,6 +8,8 @@ class Worker
@config = config
@name = name
@pipe_in = pipe
@my_config = config["mod"][name]
end
def run()