def info(config: dict, tag: str, attr: str, fill: str) -> str: """ Create rule in i3 commands format Args: config (dict): extension config. tag (str): target tag. attr (str): tag attrubutes. fill (str): attribute to fill. """ conv_dict_attr = { 'class': 'class', 'instance': 'instance', 'name': 'window_name', 'role': 'window_role' } cmd = '' if fill in attr: if not attr.endswith('_r'): win_attr = conv_dict_attr[attr] else: win_attr = conv_dict_attr[attr[:-2]] start = f'{win_attr}="' + Misc.ch(config[tag][attr], '^') attrlist = [] attrlist = config[tag][attr] if config[tag].get(attr + '_r', ''): attrlist += config[tag][attr + '_r'] if not attr.endswith('_r'): cmd = start + Misc.parse_attr(attrlist, end='') if cmd: cmd += '"' return cmd