def load_config(self) -> Dict[str, Union[str, int, bool]]:
		'''Load config from file, set correct types for values and return a dict'''
		new_config: Dict[str,Union[str, int, bool]] = {}
		conf_file: str = ""
		if os.path.isfile(self.config_file):
			conf_file = self.config_file
		elif SYSTEM == "BSD" and os.path.isfile("/usr/local/etc/bpytop.conf"):
			conf_file = "/usr/local/etc/bpytop.conf"
		elif SYSTEM != "BSD" and os.path.isfile("/etc/bpytop.conf"):
			conf_file = "/etc/bpytop.conf"
		else:
			return new_config
		try:
			with open(conf_file, "r") as f:
				for line in f:
					line = line.strip()
					if line.startswith("#? Config"):
						new_config["version"] = line[line.find("v. ") + 3:]
						continue
					if not '=' in line:
						continue
					key, line = line.split('=', maxsplit=1)
					if not key in self.keys:
						continue
					line = line.strip('"')
					if type(getattr(self, key)) == int:
						try:
							new_config[key] = int(line)
						except ValueError:
							self.warnings.append(f'Config key "{key}" should be an integer!')
					if type(getattr(self, key)) == bool:
						try:
							new_config[key] = bool(strtobool(line))
						except ValueError:
							self.warnings.append(f'Config key "{key}" can only be True or False!')
					if type(getattr(self, key)) == str:
						new_config[key] = str(line)
		except Exception as e:
			errlog.exception(str(e))
		if "proc_sorting" in new_config and not new_config["proc_sorting"] in self.sorting_options:
			new_config["proc_sorting"] = "_error_"
			self.warnings.append(f'Config key "proc_sorted" didn\'t get an acceptable value!')
		if "log_level" in new_config and not new_config["log_level"] in self.log_levels:
			new_config["log_level"] = "_error_"
			self.warnings.append(f'Config key "log_level" didn\'t get an acceptable value!')
		if "update_ms" in new_config and int(new_config["update_ms"]) < 100:
			new_config["update_ms"] = 100
			self.warnings.append(f'Config key "update_ms" can\'t be lower than 100!')
		for net_name in ["net_download", "net_upload"]:
			if net_name in new_config and not new_config[net_name][0].isdigit(): # type: ignore
				new_config[net_name] = "_error_"
		if "cpu_sensor" in new_config and not new_config["cpu_sensor"] in self.cpu_sensors:
			new_config["cpu_sensor"] = "_error_"
			self.warnings.append(f'Config key "cpu_sensor" does not contain an available sensor!')
		if "shown_boxes" in new_config and not new_config["shown_boxes"] == "":
			for box in new_config["shown_boxes"].split(): #type: ignore
				if not box in ["cpu", "mem", "net", "proc"]:
					new_config["shown_boxes"] = "_error_"
					self.warnings.append(f'Config key "shown_boxes" contains invalid box names!')
					break
		for cpu_graph in ["cpu_graph_upper", "cpu_graph_lower"]:
			if cpu_graph in new_config and not new_config[cpu_graph] in self.cpu_percent_fields:
				new_config[cpu_graph] = "_error_"
				self.warnings.append(f'Config key "{cpu_graph}" does not contain an available cpu stat attribute!')
		if "temp_scale" in new_config and not new_config["temp_scale"] in self.temp_scales:
			new_config["temp_scale"] = "_error_"
			self.warnings.append(f'Config key "temp_scale" does not contain a recognized temperature scale!')
		return new_config
Load config from file, set correct types for values and return a dict
bpytop.py