示例#1
0
def get_workspace_icons_representation(workspace: i3ipc.Con) -> str:
    icon_to_count = collections.OrderedDict()
    for window in workspace.leaves():
        icon = get_window_icon(window)
        if icon not in icon_to_count:
            icon_to_count[icon] = 0
        icon_to_count[icon] += 1
    icons_texts = []
    for icon, count in icon_to_count.items():
        if count < 3:
            icon_text = ' '.join(icon for i in range(count))
        else:
            icon_text = '{}x{}'.format(count, icon)
        icons_texts.append(icon_text)
    return ' '.join(icons_texts)
示例#2
0
 def get_workspace_icons(self, workspace: i3ipc.Con) -> str:
     icon_to_count = collections.OrderedDict()
     for window in workspace.leaves():
         icon = self.get_window_icon(window)
         if icon not in icon_to_count:
             icon_to_count[icon] = 0
         icon_to_count[icon] += 1
     icons_texts = []
     delim = self.config['delimiter']
     for icon, count in icon_to_count.items():
         if count < self.config['min_duplicates_count']:
             icon_text = delim.join(icon for i in range(count))
         else:
             icon_text = '{}x{}'.format(count, icon)
         icons_texts.append(icon_text)
     return delim.join(icons_texts)
示例#3
0
 def get_workspace_icons(self, workspace: i3ipc.Con) -> str:
     icon_to_count = collections.OrderedDict()
     for window in workspace.leaves():
         icon = self.get_window_icon(window)
         if icon not in icon_to_count:
             icon_to_count[icon] = 0
         icon_to_count[icon] += 1
     if not icon_to_count:
         return ''
     icons_texts = []
     delim = self.config['delimiter']
     for icon, count in icon_to_count.items():
         if count < self.config['min_duplicates_count']:
             icon_text = delim.join(icon for i in range(count))
         else:
             icon_text = f'{count}x{icon}'
         icons_texts.append(icon_text)
     prefix = self.config.get('prefix', '')
     suffix = self.config.get('suffix', '')
     return prefix + delim.join(icons_texts) + suffix